From 5fde0e6a1878a29cd566488ac838248bc20c9776 Mon Sep 17 00:00:00 2001 From: Sergey Nazarov Date: Tue, 11 Jan 2022 16:20:27 +0300 Subject: [PATCH 1/4] wip --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++ zwaves_jni/build_all.sh | 0 zwaves_jni/javalib/build.gradle | 38 ++++++++++++++++----------------- zwaves_jni/javalib/gradlew | 0 4 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/release.yml mode change 100644 => 100755 zwaves_jni/build_all.sh mode change 100644 => 100755 zwaves_jni/javalib/gradlew diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dfaf289 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Publish artfiacts to Sonatype Repo + +on: [push] +jobs: + publish: + runs-on: ubuntu-latest + env: + USERNAME: ${{ secrets.OSSRH_USERNAME }} + PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_KEY_ID: ${{ secrets.OSSRH_GPG_KEY_ID }} + GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }} + steps: + - uses: actions/checkout@v2 + - run: | + echo '${{ secrets.OSSRH_GPG_KEY }}' | base64 -d > secret.gpg + ./zwaves_jni/build_all.sh + - name: Publish Snapshot + if: ${{ !contains(github.ref, '/tags/') }} + run: | + ./gradlew uploadArchives \ + -PsonatypeRepo=https://oss.sonatype.org/content/repositories/snapshots \ + -PwhisperSonatypeUsername='${{ secrets.OSSRH_USERNAME }}' \ + -PwhisperSonatypePassword='${{ secrets.OSSRH_PASSWORD }}' \ + -Psigning.secretKeyRingFile=../secret.gpg \ + -Psigning.keyId='${{ secrets.OSSRH_GPG_KEY_ID }}' \ + -Psigning.password='${{ secrets.OSSRH_GPG_PASSPHRASE }}' + - name: Publish Release + if: contains(github.ref, '/tags/') + run: | + ./gradlew uploadArchives closeAndReleaseRepository \ + -PsonatypeRepo=https://oss.sonatype.org/service/local/staging/deploy/maven2 \ + -PwhisperSonatypeUsername='${{ secrets.OSSRH_USERNAME }}' \ + -PwhisperSonatypePassword='${{ secrets.OSSRH_PASSWORD }}' \ + -Psigning.secretKeyRingFile=../secret.gpg \ + -Psigning.keyId='${{ secrets.OSSRH_GPG_KEY_ID }}' \ + -Psigning.password='${{ secrets.OSSRH_GPG_PASSPHRASE }}' \ No newline at end of file diff --git a/zwaves_jni/build_all.sh b/zwaves_jni/build_all.sh old mode 100644 new mode 100755 diff --git a/zwaves_jni/javalib/build.gradle b/zwaves_jni/javalib/build.gradle index ea8180a..dfe0b0b 100644 --- a/zwaves_jni/javalib/build.gradle +++ b/zwaves_jni/javalib/build.gradle @@ -1,37 +1,37 @@ -/* - * 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' } 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' } - test { useJUnit() maxHeapSize = '1G' } +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.2" + } +} + +apply plugin: 'io.codearte.nexus-staging' + +nexusStaging { + packageGroup = "com.wavesplatform" + username = whisperSonatypeUsername + password = whisperSonatypePassword + numberOfRetries = 100 + delayBetweenRetriesInMillis = 5000 +} diff --git a/zwaves_jni/javalib/gradlew b/zwaves_jni/javalib/gradlew old mode 100644 new mode 100755 From 1a96896b39d11ee075fbec060477c8279f58ffec Mon Sep 17 00:00:00 2001 From: Sergey Nazarov Date: Tue, 11 Jan 2022 16:34:28 +0300 Subject: [PATCH 2/4] wip --- zwaves_jni/build_all.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zwaves_jni/build_all.sh b/zwaves_jni/build_all.sh index 93b1393..3d54fab 100755 --- a/zwaves_jni/build_all.sh +++ b/zwaves_jni/build_all.sh @@ -1,24 +1,28 @@ 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 + 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 +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 +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 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 From c87bed12f6c7073df7baafbe2781f2bcee6bf598 Mon Sep 17 00:00:00 2001 From: Sergey Nazarov Date: Mon, 31 Jul 2023 13:22:14 +0300 Subject: [PATCH 3/4] wip --- .github/workflows/release.yml | 43 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dfaf289..1fbe332 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,36 +1,21 @@ name: Publish artfiacts to Sonatype Repo on: [push] + jobs: - publish: + build-native: runs-on: ubuntu-latest - env: - USERNAME: ${{ secrets.OSSRH_USERNAME }} - PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - GPG_KEY_ID: ${{ secrets.OSSRH_GPG_KEY_ID }} - GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }} steps: - - uses: actions/checkout@v2 - - run: | - echo '${{ secrets.OSSRH_GPG_KEY }}' | base64 -d > secret.gpg - ./zwaves_jni/build_all.sh - - name: Publish Snapshot - if: ${{ !contains(github.ref, '/tags/') }} - run: | - ./gradlew uploadArchives \ - -PsonatypeRepo=https://oss.sonatype.org/content/repositories/snapshots \ - -PwhisperSonatypeUsername='${{ secrets.OSSRH_USERNAME }}' \ - -PwhisperSonatypePassword='${{ secrets.OSSRH_PASSWORD }}' \ - -Psigning.secretKeyRingFile=../secret.gpg \ - -Psigning.keyId='${{ secrets.OSSRH_GPG_KEY_ID }}' \ - -Psigning.password='${{ secrets.OSSRH_GPG_PASSPHRASE }}' - - name: Publish Release - if: contains(github.ref, '/tags/') + - uses: actions/checkout@v3 + - name: Build native image run: | - ./gradlew uploadArchives closeAndReleaseRepository \ - -PsonatypeRepo=https://oss.sonatype.org/service/local/staging/deploy/maven2 \ - -PwhisperSonatypeUsername='${{ secrets.OSSRH_USERNAME }}' \ - -PwhisperSonatypePassword='${{ secrets.OSSRH_PASSWORD }}' \ - -Psigning.secretKeyRingFile=../secret.gpg \ - -Psigning.keyId='${{ secrets.OSSRH_GPG_KEY_ID }}' \ - -Psigning.password='${{ secrets.OSSRH_GPG_PASSPHRASE }}' \ No newline at end of file + cd zwaves_jni + sudo apt-get update + sudo apt-get -y install clang gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev mingw-w64 gcc-multilib + rustup target add x86_64-apple-darwin + rustup target add aarch64-apple-darwin + rustup target add i686-pc-windows-gnu + rustup target add x86_64-pc-windows-gnu + rustup target add i686-unknown-linux-gnu + rustup target add x86_64-unknown-linux-gnu + ./build_all.sh From f51f4c104dc28965524ec3d82e2925fb80959546 Mon Sep 17 00:00:00 2001 From: Sergey Nazarov Date: Mon, 31 Jul 2023 14:13:06 +0300 Subject: [PATCH 4/4] wip --- .github/workflows/release.yml | 16 +++--- zwaves_jni/build_all.sh | 45 ++++++++-------- zwaves_jni/javalib/build.gradle | 51 +++++++++++-------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- zwaves_jni/javalib/settings.gradle | 9 ---- 5 files changed, 62 insertions(+), 61 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1fbe332..b1c8cc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,11 +11,13 @@ jobs: run: | cd zwaves_jni sudo apt-get update - sudo apt-get -y install clang gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev mingw-w64 gcc-multilib - rustup target add x86_64-apple-darwin - rustup target add aarch64-apple-darwin - rustup target add i686-pc-windows-gnu - rustup target add x86_64-pc-windows-gnu - rustup target add i686-unknown-linux-gnu rustup target add x86_64-unknown-linux-gnu - ./build_all.sh + 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 index 3d54fab..596ab24 100755 --- a/zwaves_jni/build_all.sh +++ b/zwaves_jni/build_all.sh @@ -1,31 +1,30 @@ -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 +# 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 -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 +# 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 -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 -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 +# 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 dfe0b0b..034f43e 100644 --- a/zwaves_jni/javalib/build.gradle +++ b/zwaves_jni/javalib/build.gradle @@ -1,37 +1,46 @@ plugins { - id 'java-library' + id "java-library" + id "maven-publish" + id "signing" + id "io.github.gradle-nexus.publish-plugin" version "1.3.0" } repositories { mavenCentral() } -dependencies { - // Use JUnit test framework - testImplementation 'junit:junit:4.12' -} +publishing { + publications { + mavenJava(MavenPublication) { + from(components["java"]) -test { - useJUnit() + pom { + name.set("zwaves") + licenses { + license { + name.set("MIT License") + url.set("LICENSE") + } + } + } + } + } +} - maxHeapSize = '1G' +signing { + useInMemoryPgpKeys(gpgKey, gpgPassphrase) + sign(publishing.publications["mavenJava"]) } -buildscript { +nexusPublishing { repositories { - mavenCentral() - } - dependencies { - classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.2" + repositories { + sonatype { + username = sonatypeUsername + password = sonatypePassword + } + } } } -apply plugin: 'io.codearte.nexus-staging' -nexusStaging { - packageGroup = "com.wavesplatform" - username = whisperSonatypeUsername - password = whisperSonatypePassword - numberOfRetries = 100 - delayBetweenRetriesInMillis = 5000 -} 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/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'