diff --git a/.github/workflows/gradle_publish.yml b/.github/workflows/gradle_publish.yml index 6c17e16e1..36f5b7328 100644 --- a/.github/workflows/gradle_publish.yml +++ b/.github/workflows/gradle_publish.yml @@ -7,7 +7,11 @@ jobs: contents: read packages: write steps: - - uses: actions/checkout@v5 + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: recursive - uses: actions/setup-java@v4 with: java-version: '17' diff --git a/build.gradle b/build.gradle index 9132ae134..1caa146a3 100644 --- a/build.gradle +++ b/build.gradle @@ -5,14 +5,6 @@ plugins { id "biz.aQute.bnd" version "6.1.0" apply false } -if (System.getenv("GITHUB_ACTOR") == null) { - throw new Exception("Environment variable GITHUB_ACTOR not set. Please set to your github username.") -} - -if (System.getenv("GITHUB_TOKEN") == null) { - throw new Exception("Environment variable GITHUB_TOKEN not set. Please generate and set to your personal access token: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens") -} - allprojects { group = 'org.sensorhub' } @@ -33,18 +25,14 @@ subprojects { repositories { //mavenLocal() mavenCentral() - maven { - url "https://raw.github.com/eurotech/kura_addons/mvn-repo" - } - maven { - url "https://artifacts.unidata.ucar.edu/repository/unidata-all/" - } - maven { - name = 'osh-core' - url = uri("https://maven.pkg.github.com/opensensorhub/osh-core") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") + if(System.getenv("GITHUB_ACTOR") && System.getenv("GITHUB_TOKEN")) { + maven { + name = 'osh-core' + url = uri("https://maven.pkg.github.com/opensensorhub/osh-core") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } } } } @@ -331,28 +319,20 @@ subprojects { } } } - - // publish to repo - task publishBundle(type: Exec) { - def bundleFile = osgi.outputs.files.singleFile - //commandLine 'curl', '-s', '-X', 'POST', '-H', """artifactUrl: file://${bundleFile}""", 'http://localhost:8181/cave/repository/api/repositories/osh-addons/artifact' - commandLine 'kubectl', 'cp', "${bundleFile}", 'osh-addons-69497bf779-4q65x:/opt/osh-node/data/addons' - } - } - - /*// publish to maven repo - publishing { - repositories { - maven { - name = 'GitHubPackages' - url = 'https://maven.pkg.github.com/opensensorhub/osh-addons' - credentials { - username = '' - password = '' - } + p.tasks.named("publishMavenJavaPublicationToGitHubPackagesRepository") { + onlyIf { + // + MavenArtifactRepository repo = repository as MavenArtifactRepository; + MavenPublication pub = publication as MavenPublication; + + HttpURLConnection connection = new URL("$repo.url/${pub.groupId.replace('.', '/')}/$pub.artifactId/$pub.version/$pub.artifactId-${pub.version}.jar").openConnection(); + connection.setRequestMethod("GET"); + connection.setRequestProperty("Authorization", "Basic ${new String(Base64.getEncoder().encode("$repo.credentials.username:$repo.credentials.password".bytes))}"); + connection.connect(); + return connection.responseCode == 404; } } - }*/ + } } // create one configuration for each distribution diff --git a/comm/sensorhub-comm-ble-dbus/build.gradle b/comm/sensorhub-comm-ble-dbus/build.gradle index 083bf511b..d61e8e935 100644 --- a/comm/sensorhub-comm-ble-dbus/build.gradle +++ b/comm/sensorhub-comm-ble-dbus/build.gradle @@ -2,8 +2,10 @@ description = 'Bluetooth LE Comm Network (D-Bus)' ext.details = 'Bluetooth Smart (Low Energy) network adapter based on D-Bus (Linux only)' def thisProjectDir = projectDir -repositories { - maven { url "file:///$thisProjectDir/libs" } +rootProject.allprojects { + repositories { + maven { url "file:///$thisProjectDir/libs" } + } } dependencies { diff --git a/comm/sensorhub-comm-dio/build.gradle b/comm/sensorhub-comm-dio/build.gradle index e7a53f4d9..1f3b9e226 100644 --- a/comm/sensorhub-comm-dio/build.gradle +++ b/comm/sensorhub-comm-dio/build.gradle @@ -1,6 +1,12 @@ description = 'Device I/O Comm Providers' ext.details = 'Direct device communication using JDK Device I/O library (UART, I2C, SPI, GPIO)' +rootProject.allprojects { + repositories { + maven { url "https://raw.github.com/eurotech/kura_addons/mvn-repo" } + } +} + dependencies { implementation 'org.sensorhub:sensorhub-core:' + oshCoreVersion embeddedImpl 'jdk:jdk.dio:1.0.1' diff --git a/comm/sensorhub-comm-jssc/build.gradle b/comm/sensorhub-comm-jssc/build.gradle index 6a12cb0af..2263aa4c9 100644 --- a/comm/sensorhub-comm-jssc/build.gradle +++ b/comm/sensorhub-comm-jssc/build.gradle @@ -1,6 +1,13 @@ description = 'JSSC Serial Comm Provider' ext.details = 'Serial communication provider based on Java Simple Serial Connector library' +def thisProjectDir = projectDir +rootProject.allprojects { + repositories { + mavenCentral() + } +} + dependencies { implementation 'org.sensorhub:sensorhub-core:' + oshCoreVersion implementation("io.github.java-native:jssc:2.10.2") diff --git a/comm/sensorhub-comm-rxtx/build.gradle b/comm/sensorhub-comm-rxtx/build.gradle index 819ff1e86..386a59312 100644 --- a/comm/sensorhub-comm-rxtx/build.gradle +++ b/comm/sensorhub-comm-rxtx/build.gradle @@ -2,8 +2,10 @@ description = 'RXTX Serial Comm Provider' ext.details = 'Serial communication provider based on RXTX library' def thisProjectDir = projectDir -repositories { - maven { url "file:///$thisProjectDir/libs" } +rootProject.allprojects { + repositories { + maven { url "file:///$thisProjectDir/libs" } + } } dependencies { diff --git a/sensors/others/sensorhub-driver-universalcontroller/build.gradle b/sensors/others/sensorhub-driver-universalcontroller/build.gradle index adf4cf240..816ad6293 100644 --- a/sensors/others/sensorhub-driver-universalcontroller/build.gradle +++ b/sensors/others/sensorhub-driver-universalcontroller/build.gradle @@ -9,6 +9,13 @@ dependencies { testImplementation('junit:junit:4.13.1') } +def thisProjectDir = projectDir +rootProject.allprojects { + repositories { + mavenCentral() + } +} + // exclude tests requiring connection to the sensor // these have to be run manually // If tests are to be excluded list them here as follows diff --git a/sensors/robotics/sensorhub-driver-pwm-servos/build.gradle b/sensors/robotics/sensorhub-driver-pwm-servos/build.gradle index 740a7c70d..0040ff1b4 100644 --- a/sensors/robotics/sensorhub-driver-pwm-servos/build.gradle +++ b/sensors/robotics/sensorhub-driver-pwm-servos/build.gradle @@ -2,6 +2,12 @@ description = 'PCA9685 PWM Servos Driver' ext.details = 'Driver for Adafruit PCA9685 16-channels PWM servo board' version = '0.1-SNAPSHOT' +rootProject.allprojects { + repositories { + maven { url "https://raw.github.com/eurotech/kura_addons/mvn-repo" } + } +} + dependencies { implementation 'org.sensorhub:sensorhub-core:' + oshCoreVersion implementation project(':sensorhub-comm-dio') diff --git a/sensors/video/sensorhub-driver-kinect/build.gradle b/sensors/video/sensorhub-driver-kinect/build.gradle index 157adc98b..dd9a3dd40 100644 --- a/sensors/video/sensorhub-driver-kinect/build.gradle +++ b/sensors/video/sensorhub-driver-kinect/build.gradle @@ -10,8 +10,11 @@ dependencies { } def thisProjectDir = projectDir -repositories { - maven { url "file:///$thisProjectDir/libs" } +rootProject.allprojects { + repositories { + mavenCentral() + maven { url "file:///$thisProjectDir/libs" } + } } // add info to OSGi manifest diff --git a/sensors/video/sensorhub-driver-v4l/build.gradle b/sensors/video/sensorhub-driver-v4l/build.gradle index 2b3cc4624..019266ef5 100644 --- a/sensors/video/sensorhub-driver-v4l/build.gradle +++ b/sensors/video/sensorhub-driver-v4l/build.gradle @@ -3,8 +3,10 @@ ext.details = 'Driver for Video4Linux compatible cameras (only supported on Linu version = '1.1.0' def thisProjectDir = projectDir -repositories { - maven { url "file:///$thisProjectDir/libs" } +rootProject.allprojects { + repositories { + maven { url "file:///$thisProjectDir/libs" } + } } dependencies { diff --git a/sensors/weather/sensorhub-driver-nexrad/build.gradle b/sensors/weather/sensorhub-driver-nexrad/build.gradle index 31fcf3fc2..a6a59621c 100644 --- a/sensors/weather/sensorhub-driver-nexrad/build.gradle +++ b/sensors/weather/sensorhub-driver-nexrad/build.gradle @@ -2,6 +2,12 @@ description = 'Nexrad Doppler Radar Network' ext.details = 'Driver for Nexrad Doppler radars, supporting both Level II and Level III products' version = '1.0.0-SNAPSHOT' +rootProject.allprojects { + repositories { + maven { url 'https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases' } + } +} + dependencies { implementation 'org.sensorhub:sensorhub-core:' + oshCoreVersion embeddedImpl 'org.apache.httpcomponents:httpclient:4.5.13' diff --git a/sensors/weather/sensorhub-utils-grid/build.gradle b/sensors/weather/sensorhub-utils-grid/build.gradle index 93e9b7a4a..29f0d94bd 100644 --- a/sensors/weather/sensorhub-utils-grid/build.gradle +++ b/sensors/weather/sensorhub-utils-grid/build.gradle @@ -2,6 +2,20 @@ description = 'Gridded Dataset Utilities' ext.details = 'Various utilities for handling grid formats based on Unidata library' version = '0.3.3' +def thisProjectDir = projectDir +rootProject.allprojects { + repositories { + /*maven { + name 'unidata' + url 'https://artifacts.unidata.ucar.edu/repository/unidata-all' + }*/ + maven { + name 'unidata-local' + url "file:///$thisProjectDir/libs" + } + } +} + dependencies { implementation 'org.sensorhub:sensorhub-core:' + oshCoreVersion embeddedApi ('edu.ucar:grib:4.6.10') { diff --git a/services/sensorhub-service-sensorthings/build.gradle b/services/sensorhub-service-sensorthings/build.gradle index 95cb5a331..a9828e9f8 100644 --- a/services/sensorhub-service-sensorthings/build.gradle +++ b/services/sensorhub-service-sensorthings/build.gradle @@ -4,8 +4,10 @@ version = '0.1.0' def thisProjectDir = projectDir -repositories { - maven { url "file:///$thisProjectDir/libs" } +rootProject.allprojects { + repositories { + maven { url "file:///$thisProjectDir/libs" } + } } dependencies {