diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1627cc282..0d37811f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,20 +14,20 @@ env: jobs: build-native-ubuntu: runs-on: ubuntu-22.04 - + steps: # Setup rust - name: Setup Rust uses: actions-rs/toolchain@v1 with: toolchain: 1.69 - + # Checkout the code - name: Checkout uses: actions/checkout@v2 with: submodules: recursive - + - name: Make ubuntu native dependencies run: make @@ -39,23 +39,23 @@ jobs: build-native-macos: runs-on: macos-latest - + steps: # Setup rust - name: Setup Rust uses: actions-rs/toolchain@v1 with: toolchain: 1.69 - + # Checkout the code - name: Checkout uses: actions/checkout@v2 with: submodules: recursive - + - name: Make macos native dependencies run: make - + - name: Upload macos library uses: actions/upload-artifact@master with: @@ -64,30 +64,30 @@ jobs: build-native-windows: runs-on: windows-latest - + steps: # Setup rust - name: Setup Rust uses: actions-rs/toolchain@v1 with: toolchain: 1.69 - + # Checkout the code - name: Checkout uses: actions/checkout@v2 with: submodules: recursive - + - name: Make windows native dependencies run: cd crypto-jni && cargo build --release - + - name: Upload windows library uses: actions/upload-artifact@master with: name: windows-library path: crypto-jni\target\release\crypto_jni.dll - build-aar-library: + build-native-android: runs-on: ubuntu-22.04 steps: - name: Set Up Android tools @@ -107,23 +107,18 @@ jobs: submodules: recursive - name: Make android native dependencies run: make add-android-targets && make android - # Builds and tests the sdk - - name: Initialize root project - run: mvn install -N - - name: Build and test android sdk - run: cd concordium-android-sdk && mvn --batch-mode --update-snapshots install - - name: Upload aar + - name: Upload android uses: actions/upload-artifact@master with: - name: concordium-android-sdk.aar - path: ./concordium-android-sdk/target/concordium-android-sdk.aar + name: android-library + path: ./concordium-android-sdk/native build-and-release-jar: - needs: [build-native-ubuntu, build-native-macos, build-native-windows, build-aar-library] + needs: [build-native-ubuntu, build-native-macos, build-native-windows, build-native-android] # Use fixed OS version because we install packages on the system. runs-on: ubuntu-22.04 environment: release - + if: ${{ !github.event.pull_request.draft }} steps: @@ -131,20 +126,23 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive - + - name: Set Up Android tools + run: | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager \ + --sdk_root=$ANDROID_SDK_ROOT \ + "platform-tools" "platforms;android-27" "build-tools;27.0.3" - name: Setup JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: 8 distribution: 'adopt' cache: maven - - name: Download linux library uses: actions/download-artifact@master with: name: ubuntu-library path: concordium-sdk/native - + - name: Download macos library uses: actions/download-artifact@master with: @@ -157,23 +155,15 @@ jobs: name: windows-library path: concordium-sdk/native - - name: Download aar library + - name: Download android library uses: actions/download-artifact@master with: - name: concordium-android-sdk.aar - path: concordium-android-sdk/target + name: android-library + path: ./concordium-android-sdk/native # Builds and tests the sdk. Delomboks code and generates a javadoc jar from the delombok'ed code - name: Build and test sdk - run: cd concordium-sdk && mvn --batch-mode --update-snapshots install && mvn lombok:delombok -f pom.xml && mvn javadoc:jar -f pom.xml - - # Attach jar files to release (jar, jar-with-dependencies and javadoc-jar) - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: | - concordium-sdk/target/*.jar - concordium-android-sdk/target/concordium-android-sdk.aar + run: cd concordium-sdk && mvn --batch-mode --update-snapshots install -Pwith-dependencies && mvn lombok:delombok -f pom.xml && mvn javadoc:jar -f pom.xml && mvn source:jar - name: Deploy javadoc uses: MathieuSoysal/Javadoc-publisher.yml@v2.4.0 @@ -186,4 +176,39 @@ jobs: without-checkout: true project: maven custom-command: cd concordium-sdk && mvn javadoc:javadoc -f pom.xml # Generates javadoc from the delombok'ed code - + - name: Release github + uses: softprops/action-gh-release@v1 + with: + files: | + concordium-sdk/target/*-with-dependencies.jar + concordium-sdk/target/*-javadoc.jar + concordium-sdk/target/*-sources.jar + - name: Setup and maven central + uses: actions/setup-java@v4 + with: # running setup-java again overwrites the settings.xml + distribution: 'adopt' + java-version: '8' + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_PASSWORD # env variable for token in deploy + gpg-private-key: ${{ secrets.SONATYPE_PKEY }} # Value of the GPG private key to import + gpg-passphrase: GPG_PASSPHRASE # Passphrase for the GPG private key + - name: Publish java package to central maven repository + run: cd concordium-sdk && mvn --batch-mode deploy -Pdeploy + env: + MAVEN_USERNAME: ${{ secrets.SONATYPE_USR }} + MAVEN_PASSWORD: ${{ secrets.SONATYPE_PWD }} + GPG_PASSPHRASE: ${{secrets.SONATYPE_PHRASE }} + - name: Copy javadocs and sources for android + run: > + mkdir -p concordium-android-sdk/target + && mv concordium-sdk/target/*-javadoc.jar concordium-android-sdk/target/concordium-android-sdk-javadoc.jar + && mv concordium-sdk/target/*-sources.jar concordium-android-sdk/target/concordium-android-sdk-sources.jar + - name: Publish android package to central maven repository + run: cd concordium-android-sdk && mvn --batch-mode deploy -Pdeploy + env: + MAVEN_USERNAME: ${{ secrets.SONATYPE_USR }} + MAVEN_PASSWORD: ${{ secrets.SONATYPE_PWD }} + GPG_PASSPHRASE: ${{secrets.SONATYPE_PHRASE }} + + diff --git a/.gitignore b/.gitignore index f8ffc7a98..e39e4abee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .vscode -*.iml \ No newline at end of file +*.iml +.flattened-pom.xml +pom.xml.versionsBackup diff --git a/README.md b/README.md index f1bd250dc..a27adadb1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Concordium Java SDK The Concordium Java SDK provides an interface to communicating with a Concordium node. +The package is released on [Maven Central](https://central.sonatype.com/artifact/com.concordium.sdk/concordium-sdk). +The Android compatible package is also released on [Maven Central](https://central.sonatype.com/artifact/com.concordium.sdk/concordium-android-sdk). # Prerequisites 1. Java 1.8 @@ -86,20 +88,6 @@ git clone https://github.com/Concordium/concordium-java-sdk.git --recurse-submod And the final step builds the aar file `concordium-android-sdk.aar` in the [target](./concordium-android-sdk/target) folder, which can be used in android projects. Note that this uses the [Android Maven Plugin](http://simpligility.github.io/android-maven-plugin/), which is what requires the Android SDK, the specific version can be seen in its documentation. -For the library to work on android, the following packages must be added to the project (Shown in the gradle style) -```gradle -dependencies { - // gRPC - implementation 'io.grpc:grpc-okhttp:1.60.0' - implementation 'io.grpc:grpc-protobuf:1.40.1' - implementation 'io.grpc:grpc-stub:1.60.0' - compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+ - implementation 'com.fasterxml.jackson.core:jackson-core:2.10.1' - implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.1' - implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.1' -} -``` - Note that the minimum android SDK version for this package is 26. # Usage diff --git a/concordium-android-sdk/.gitignore b/concordium-android-sdk/.gitignore index 0ab27ff9c..9c7ed7198 100644 --- a/concordium-android-sdk/.gitignore +++ b/concordium-android-sdk/.gitignore @@ -3,3 +3,4 @@ /target /native/* /delombok + diff --git a/concordium-android-sdk/pom.xml b/concordium-android-sdk/pom.xml index bff5d42fd..22242c59f 100644 --- a/concordium-android-sdk/pom.xml +++ b/concordium-android-sdk/pom.xml @@ -5,7 +5,7 @@ com.concordium.sdk concordium-sdk-base - 6.0.1-SNAPSHOT + 6.1.0 concordium-android-sdk @@ -18,11 +18,29 @@ UTF-8 + concordium-android-sdk + An SDK for interacting with the Concordium blockchain packaged for Android + - com.concordium.sdk - concordium-sdk - 6.0.1-SNAPSHOT + io.grpc + grpc-netty-shaded + 1.40.1 + + + commons-io + commons-io + 2.11.0 + + + commons-codec + commons-codec + 1.15 + + + org.projectlombok + lombok + 1.18.26 io.grpc @@ -58,6 +76,12 @@ org.bitcoinj bitcoinj-core 0.16.2 + + + com.google.protobuf + protobuf-javalite + + @@ -139,6 +163,79 @@ + + deploy + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + + --pinentry-mode + loopback + + + + + sign-artifacts + install + + sign + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + attach-javadoc-and-source + package + + attach-artifact + + + + + target/concordium-android-sdk-javadoc.jar + jar + javadoc + + + target/concordium-android-sdk-sources.jar + jar + sources + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.6.0 + + + flatten + process-resources + + flatten + + + ossrh + + + + + + + @@ -203,5 +300,11 @@ - - \ No newline at end of file + + + ossrh + Central Repository OSSRH + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + diff --git a/concordium-sdk-examples/pom.xml b/concordium-sdk-examples/pom.xml index 821930fcc..af8fcabdd 100644 --- a/concordium-sdk-examples/pom.xml +++ b/concordium-sdk-examples/pom.xml @@ -23,7 +23,7 @@ com.concordium.sdk concordium-sdk - 6.0.1-SNAPSHOT + 6.1.0 compile diff --git a/concordium-sdk/pom.xml b/concordium-sdk/pom.xml index 1909facc8..db5359535 100644 --- a/concordium-sdk/pom.xml +++ b/concordium-sdk/pom.xml @@ -5,16 +5,16 @@ 4.0.0 - com.concordium.sdk + com.concordium.sdk concordium-sdk-base - 6.0.1-SNAPSHOT + 6.1.0 com.concordium.sdk concordium-sdk concordium-sdk - https://github.com/Concordium/concordium-java-sdk + An SDK for interacting with the Concordium blockchain UTF-8 @@ -27,6 +27,12 @@ org.bitcoinj bitcoinj-core 0.16.2 + + + com.google.protobuf + protobuf-javalite + + io.grpc @@ -135,18 +141,7 @@ - - org.apache.maven.plugins - maven-assembly-plugin - 3.3.0 - - - jar-with-dependencies - - - - @@ -181,6 +176,13 @@ + + + + + with-dependencies + + org.apache.maven.plugins maven-assembly-plugin @@ -194,6 +196,79 @@ + + deploy + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + + --pinentry-mode + loopback + + + + + sign-artifacts + install + + sign + + + + + + org.codehaus.mojo + flatten-maven-plugin + 1.6.0 + + + flatten + process-resources + + flatten + + + ossrh + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.5.0 + + + attach-javadoc-and-source + package + + attach-artifact + + + + + target/concordium-sdk-${project.version}-javadoc.jar + jar + javadoc + + + target/concordium-sdk-${project.version}-sources.jar + jar + sources + + + + + + + + + @@ -308,4 +383,11 @@ + + + ossrh + Central Repository OSSRH + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + diff --git a/pom.xml b/pom.xml index b96ddf234..cfe2b7967 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,36 @@ com.concordium.sdk concordium-sdk-base - 6.0.1-SNAPSHOT + 6.1.0 pom + https://github.com/Concordium/concordium-java-sdk + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Concordium Software + support@concordium.software + Concordium Software + https://concordium.com + + + + + scm:git:git://github.com:Concordium/concordium-java-sdk.git + scm:git:ssh://github.com:Concordium/concordium-java-sdk.git + https://github.com/Concordium/concordium-java-sdk/tree/main + + concordium-sdk concordium-android-sdk concordium-sdk-examples - \ No newline at end of file +