diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b1c8cc6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Publish artfiacts to Sonatype Repo + +on: [push] + +jobs: + build-native: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build native image + run: | + cd zwaves_jni + sudo apt-get update + rustup target add x86_64-unknown-linux-gnu + cargo build --target=x86_64-unknown-linux-gnu --release + cp ../target/x86_64-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux64 + cd javalib + ./gradlew publishToSonatype \ + -PsonatypeUsername='${{ secrets.OSSRH_USERNAME }}' \ + -PsonatypePassword='${{ secrets.OSSRH_PASSWORD }}' \ + -PgpgKey='${{ secrets.OSSRH_GPG_KEY_ASCII }}' \ + -PgpgPassphrase='${{ secrets.OSSRH_GPG_PASSPHRASE }}' + diff --git a/zwaves_jni/build_all.sh b/zwaves_jni/build_all.sh old mode 100644 new mode 100755 index 93b1393..596ab24 --- a/zwaves_jni/build_all.sh +++ b/zwaves_jni/build_all.sh @@ -1,27 +1,30 @@ -if [ ! -d "osxcross" ]; then - git clone https://github.com/tpoechtrager/osxcross - pushd osxcross - wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz - mv MacOSX10.10.sdk.tar.xz tarballs/ - UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh - popd -fi +# if [ ! -d "osxcross" ]; then +# git clone https://github.com/tpoechtrager/osxcross +# pushd osxcross +# wget --quiet -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.10.sdk.tar.xz +# mv MacOSX10.10.sdk.tar.xz tarballs/ +# UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh +# popd +# fi -cargo build --target=i686-unknown-linux-gnu --release -cp ../target/i686-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux32 +# rustup target add i686-unknown-linux-gnu +# cargo build --target=i686-unknown-linux-gnu --release +# cp ../target/i686-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux32 cargo build --target=x86_64-unknown-linux-gnu --release cp ../target/x86_64-unknown-linux-gnu/release/libzwaves_jni.so javalib/src/main/resources/META-INF/native/linux64 -PATH="$(pwd)/osxcross/target/bin:$PATH" CC=o64-clang CXX=o64-clang++ LIBZ_SYS_STATIC=1 cargo build --target x86_64-apple-darwin --release -cp ../target/x86_64-apple-darwin/release/libzwaves_jni.dylib javalib/src/main/resources/META-INF/native/osx - -cargo build --target=i686-pc-windows-gnu --release -cp ../target/i686-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows32 - -cargo build --target=x86_64-pc-windows-gnu --release -cp ../target/x86_64-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows64 +# PATH="$(pwd)/osxcross/target/bin:$PATH" CC=o64-clang CXX=o64-clang++ LIBZ_SYS_STATIC=1 cargo build --target x86_64-apple-darwin --release +# cp ../target/x86_64-apple-darwin/release/libzwaves_jni.dylib javalib/src/main/resources/META-INF/native/osx +# +# rustup target add i686-pc-windows-gnu +# cargo build --target=i686-pc-windows-gnu --release +# cp ../target/i686-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows32 +# +# rustup target add x86_64-pc-windows-gnu +# cargo build --target=x86_64-pc-windows-gnu --release +# cp ../target/x86_64-pc-windows-gnu/release/zwaves_jni.dll javalib/src/main/resources/META-INF/native/windows64 pushd javalib -./gradlew build +./gradlew build -P popd \ No newline at end of file diff --git a/zwaves_jni/javalib/build.gradle b/zwaves_jni/javalib/build.gradle index ea8180a..034f43e 100644 --- a/zwaves_jni/javalib/build.gradle +++ b/zwaves_jni/javalib/build.gradle @@ -1,37 +1,46 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * This generated file contains a sample Java Library project to get you started. - * For more details take a look at the Java Libraries chapter in the Gradle - * User Manual available at https://docs.gradle.org/5.4.1/userguide/java_library_plugin.html - */ - plugins { - // Apply the java-library plugin to add support for Java Library - id 'java-library' + id "java-library" + id "maven-publish" + id "signing" + id "io.github.gradle-nexus.publish-plugin" version "1.3.0" } repositories { - // Use jcenter for resolving your dependencies. - // You can declare any Maven/Ivy/file repository here. - jcenter() + mavenCentral() } -dependencies { - // This dependency is exported to consumers, that is to say found on their compile classpath. - api 'org.apache.commons:commons-math3:3.6.1' - - // This dependency is used internally, and not exposed to consumers on their own compile classpath. - implementation 'com.google.guava:guava:27.0.1-jre' - - // Use JUnit test framework - testImplementation 'junit:junit:4.12' +publishing { + publications { + mavenJava(MavenPublication) { + from(components["java"]) + + pom { + name.set("zwaves") + licenses { + license { + name.set("MIT License") + url.set("LICENSE") + } + } + } + } + } } +signing { + useInMemoryPgpKeys(gpgKey, gpgPassphrase) + sign(publishing.publications["mavenJava"]) +} -test { - useJUnit() - - maxHeapSize = '1G' +nexusPublishing { + repositories { + repositories { + sonatype { + username = sonatypeUsername + password = sonatypePassword + } + } + } } + diff --git a/zwaves_jni/javalib/gradle/wrapper/gradle-wrapper.properties b/zwaves_jni/javalib/gradle/wrapper/gradle-wrapper.properties index f4d7b2b..b7c8c5d 100644 --- a/zwaves_jni/javalib/gradle/wrapper/gradle-wrapper.properties +++ b/zwaves_jni/javalib/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/zwaves_jni/javalib/gradlew b/zwaves_jni/javalib/gradlew old mode 100644 new mode 100755 diff --git a/zwaves_jni/javalib/settings.gradle b/zwaves_jni/javalib/settings.gradle index 059992b..00387bc 100644 --- a/zwaves_jni/javalib/settings.gradle +++ b/zwaves_jni/javalib/settings.gradle @@ -1,10 +1 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/5.4.1/userguide/multi_project_builds.html - */ - rootProject.name = 'zwaves'