Skip to content

Commit

Permalink
build: Kotlin DSL / Convention Plugins / Java Modules (#1732)
Browse files Browse the repository at this point in the history
Signed-off-by: Jendrik Johannes <[email protected]>
Signed-off-by: Nikita Lebedev <[email protected]>
Co-authored-by: Nikita Lebedev <[email protected]>
  • Loading branch information
jjohannes and thenswan authored Jul 9, 2024
1 parent d7fbbc2 commit 9012a3d
Show file tree
Hide file tree
Showing 323 changed files with 2,090 additions and 1,239 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ updates:
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: gradle
directory: "/gradle/plugins"
schedule:
interval: weekly
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: "/"
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # v3.4.2
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2
with:
cache-read-only: false

- name: Compile SDK & Javadoc
run: ./gradlew assemble :sdk:javadoc -Dfile.encoding=UTF-8 --scan
run: ./gradlew assemble :sdk:javadoc --scan

unit-tests:
name: Unit Tests
Expand Down Expand Up @@ -80,14 +80,17 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # v3.4.2
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2

- name: Install Local Node
run: npm install @hashgraph/hedera-local

- name: Compile Code
run: ./gradlew assemble --scan

- name: Gradle Dependency Scopes Check
run: ./gradlew checkAllModuleInfo --continue --scan

- name: Start Local Node
run: npx @hashgraph/hedera-local start -d --network local

Expand Down Expand Up @@ -138,15 +141,21 @@ jobs:
distribution: temurin
java-version: 17

- name: Setup Android SDK
uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 # v3.2.1

- name: Setup Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # v3.4.2
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2

- name: Install Local Node
run: npm install @hashgraph/hedera-local

- name: Compile Code
run: ./gradlew assemble --scan

- name: Compile Code - Android Example
run: ./gradlew -p example-android assemble --scan

- name: Start the local node
run: npx @hashgraph/hedera-local start -d --network local

Expand Down Expand Up @@ -187,7 +196,7 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # v3.4.2
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2

- name: Install Local Node
run: npm install @hashgraph/hedera-local
Expand All @@ -199,8 +208,7 @@ jobs:
run: npx @hashgraph/hedera-local start -d --network local

- name: Run Tests
run: |
cd tck && ./gradlew test && cd ..
run: ./gradlew :tck:test

- name: Stop the local node
run: npx @hashgraph/hedera-local stop
2 changes: 1 addition & 1 deletion .github/workflows/disabled/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jobs:
cd hedera-services
docker-compose up &
cd ../hedera-sdk-java
./gradlew -PHEDERA_NETWORK=$HEDERA_NETWORK -POPERATOR_KEY=$OPERATOR_KEY -POPERATOR_ID=$OPERATOR_ID integrationTest
./gradlew -PHEDERA_NETWORK=$HEDERA_NETWORK -POPERATOR_KEY=$OPERATOR_KEY -POPERATOR_ID=$OPERATOR_ID testIntegration
2 changes: 1 addition & 1 deletion .github/workflows/disabled/previewnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
OPERATOR_KEY: ${{ secrets.PREVIEWNET_OPERATOR_KEY }}
OPERATOR_ID: ${{ secrets.PREVIEWNET_OPERATOR_ID }}
HEDERA_NETWORK: "previewnet"
run: ./gradlew -PHEDERA_NETWORK=$HEDERA_NETWORK -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY integrationTest
run: ./gradlew -PHEDERA_NETWORK=$HEDERA_NETWORK -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY testIntegration
2 changes: 1 addition & 1 deletion .github/workflows/disabled/testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Compile Tests
run: ./gradlew compileTestJava
- name: Compile Integration Tests
run: ./gradlew compileIntegrationTestJava
run: ./gradlew compileTestIntegrationJava
- name: Compile Examples
run: ./gradlew :examples:compileJava

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # v3.4.2
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2

- name: Compile SDK
run: ./gradlew compileJava --scan

- name: Generate Javadoc
run: ./gradlew sdk:javadoc -Dfile.encoding=UTF-8 --scan
run: ./gradlew sdk:javadoc --scan

- name: Pages
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
Expand Down
30 changes: 5 additions & 25 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # v3.4.2
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2
with:
cache-read-only: false

Expand All @@ -66,7 +66,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
run: |
if [[ "${{ steps.tag.outputs.version }}" != "${{ steps.project.outputs.version }}" ]]; then
echo "::error file=version.gradle,line=5,title=Version Mismatch::Tag version '${{ steps.tag.outputs.version }}' does not match the Gradle project version '${{ steps.project.outputs.version }}'. Please update the 'version.gradle' file before tagging."
echo "::error file=version.txt,line=0,title=Version Mismatch::Tag version '${{ steps.tag.outputs.version }}' does not match the Gradle project version '${{ steps.project.outputs.version }}'. Please update the 'version.txt' file before tagging."
exit 1
fi
Expand Down Expand Up @@ -116,33 +116,13 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # v3.4.2
uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2
with:
cache-read-only: false

- name: Compile SDK & Javadoc
run: ./gradlew assemble :sdk:javadoc -Dfile.encoding=UTF-8 --scan
run: ./gradlew assemble :sdk:javadoc --scan

- name: Nexus Release
if: ${{ github.event_name == 'push' }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --no-parallel -Dfile.encoding=UTF-8 --scan -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}

- name: Nexus Release (workflow_dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: ./gradlew publishToSonatype closeSonatypeStagingRepository --no-parallel -Dfile.encoding=UTF-8 --scan -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}

- name: Nexus Release sdk-full artifacts
if: ${{ github.event_name == 'push' }}
run: |
# This is a temporary fix and should be removed once https://github.com/hashgraph/hedera-sdk-java/pull/1732 is merged
sed -i 's#sdk\.gradle#sdk-full.gradle#g' sdk/build.gradle
git clean -fdx
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --no-parallel -Dfile.encoding=UTF-8 --scan -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
- name: Nexus Release sdk-full artifacts (workflow_dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
# This is a temporary fix and should be removed once https://github.com/hashgraph/hedera-sdk-java/pull/1732 is merged
sed -i 's#sdk\.gradle#sdk-full.gradle#g' sdk/build.gradle
git clean -fdx
./gradlew publishToSonatype closeSonatypeStagingRepository --no-parallel -Dfile.encoding=UTF-8 --scan -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew closeAndReleaseSonatypeStagingRepository --no-configuration-cache --scan -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
20 changes: 0 additions & 20 deletions .gitlab-ci.yml

This file was deleted.

15 changes: 1 addition & 14 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ tasks:

"test:integration":
cmds:
- ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK integrationTest {{.CLI_ARGS}}
- ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK testIntegration {{.CLI_ARGS}}
env:
OPERATOR_KEY: '0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4'
OPERATOR_ID: '0.0.1022'
Expand Down Expand Up @@ -79,16 +79,3 @@ tasks:
- task: "update:proto"
- task: "update:snapshots"
- task: "update:addressbooks"

publish:
env:
FILES: "sdk/src/main/java/com/hedera/hashgraph/sdk/*.java"
preconditions:
- git diff-index --quiet HEAD
cmds:
- git clean -ffdx
- ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
- perl -p -i -e "s#sdk\.gradle#sdk-full.gradle#g" sdk/build.gradle
- git clean -ffdx
- ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
- git restore sdk
111 changes: 0 additions & 111 deletions build.gradle

This file was deleted.

18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
id("com.hedera.gradle.root")
}

dependencyAnalysis.abi {
exclusions {
// Exposes: org.slf4j.Logger
excludeClasses("logger")
// Exposes: com.google.common.base.MoreObjects.ToStringHelper
excludeClasses(".*\\.CustomFee")
// Exposes: com.esaulpaugh.headlong.abi.Tuple
excludeClasses(".*\\.ContractFunctionResult")
// Exposes: org.bouncycastle.crypto.params.KeyParameter
excludeClasses(".*\\.PrivateKey.*")
// Exposes: io.grpc.stub.AbstractFutureStub (and others)
excludeClasses(".*Grpc")
}
}
4 changes: 2 additions & 2 deletions docs/android-app/android-app-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ implementation 'com.hedera.hashgraph:sdk:2.29.0'

2. **gRPC implementation:**
```groovy
// okhttp transport (for lighter-weight applications or Android)
implementation 'io.grpc:grpc-okhttp:1.58.0'
// okhttp transport (for lighter-weight applications or Android
runtimeOnly("io.grpc:grpc-okhttp")
```

## Next steps
Expand Down
Loading

0 comments on commit 9012a3d

Please sign in to comment.