Skip to content

Commit fa056db

Browse files
bestbeforetodaydenyeart
authored andcommitted
Upgrade Gradle version
Include build of the Docker image in tests run on a pull request to ensure the Docker image at least builds cleanly. The integration tests use builders baked into Microfab rather than real Fabric builders and the chaincode Docker images. This means the bare-gradle test chaincode is built using the Gradle version supplied by Microfab, not the version included in the Java chaincode Docker images, and has to be left with outdated plugin versions and build.gradle content. Signed-off-by: Mark S. Lewis <[email protected]>
1 parent 78e4b4b commit fa056db

File tree

31 files changed

+209
-160
lines changed

31 files changed

+209
-160
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
with:
2424
distribution: 'temurin'
2525
java-version: '11'
26-
cache: 'gradle'
2726
- name: Validate Gradle wrapper
2827
uses: gradle/wrapper-validation-action@v2
2928
- name: Build and Unit test
@@ -32,7 +31,7 @@ jobs:
3231
arguments: |
3332
:fabric-chaincode-shim:build
3433
35-
intergationtest:
34+
intergationtest:
3635
runs-on: ubuntu-latest
3736
steps:
3837
- uses: actions/checkout@v4
@@ -42,7 +41,6 @@ jobs:
4241
with:
4342
distribution: 'temurin'
4443
java-version: '11'
45-
cache: 'gradle'
4644
- name: Populate chaincode with latest java-version
4745
run: |
4846
./gradlew -I $GITHUB_WORKSPACE/fabric-chaincode-integration-test/chaincodebootstrap.gradle -PchaincodeRepoDir=$GITHUB_WORKSPACE/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/repository publishShimPublicationToFabricRepository
@@ -67,3 +65,19 @@ jobs:
6765
with:
6866
arguments: |
6967
:fabric-chaincode-integration-test:build
68+
69+
docker:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
with:
74+
ref: ${{ inputs.checkout-ref }}
75+
- uses: actions/setup-java@v4
76+
with:
77+
distribution: 'temurin'
78+
java-version: '11'
79+
- name: Build Docker image
80+
uses: gradle/actions/setup-gradle@v3
81+
with:
82+
arguments: |
83+
:fabric-chaincode-docker:buildImage

build.gradle

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,25 @@ subprojects {
3737
group = 'org.hyperledger.fabric-chaincode-java'
3838
version = rootProject.version
3939

40-
41-
sourceCompatibility = 1.8
42-
targetCompatibility = 1.8
40+
java {
41+
toolchain {
42+
languageVersion = JavaLanguageVersion.of(11)
43+
}
44+
}
4345

4446
dependencies {
45-
implementation group: 'commons-cli', name: 'commons-cli', version: '1.6.0'
46-
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
47-
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.3.1'
48-
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.3.1'
47+
implementation 'commons-cli:commons-cli:1.6.0'
48+
implementation 'commons-logging:commons-logging:1.2'
49+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
50+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
4951

50-
testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
51-
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.23.0'
52-
testImplementation group: 'com.github.stefanbirkner', name: 'system-rules', version: 'system-rules-1.17.0'
52+
testImplementation 'org.hamcrest:hamcrest-library:1.3'
53+
testImplementation 'org.mockito:mockito-core:2.23.0'
54+
testImplementation 'com.github.stefanbirkner:system-rules:system-rules-1.17.0'
5355

54-
testCompileOnly group: 'junit', name: 'junit', version: '4.12'
55-
testRuntimeOnly group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.3.1'
56-
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.9.1'
56+
testCompileOnly 'junit:junit:4.12'
57+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.3.1'
58+
testImplementation 'org.assertj:assertj-core:3.9.1'
5759
}
5860

5961
test {

examples/fabric-contract-example-as-service/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '7.1.2'
2+
id 'com.github.johnrengelman.shadow' version '8.1.1'
33
id 'java'
44
}
55

66
version '0.0.1'
77

8-
sourceCompatibility = 1.8
8+
tasks.compileJava {
9+
options.release.set(11)
10+
}
911

1012
repositories {
1113
mavenLocal()
@@ -20,17 +22,17 @@ repositories {
2022
}
2123

2224
dependencies {
23-
compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.3.+'
25+
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1'
2426
compile 'org.json:json:20231013'
2527
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
2628
testImplementation 'org.assertj:assertj-core:3.11.1'
2729
testImplementation 'org.mockito:mockito-core:2.+'
2830
}
2931

3032
shadowJar {
31-
baseName = 'chaincode'
32-
version = null
33-
classifier = null
33+
archiveBaseName = 'chaincode'
34+
archiveVersion = ''
35+
archiveClassifier = ''
3436
mergeServiceFiles()
3537

3638
manifest {

examples/fabric-contract-example-gradle-kotlin/build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
55

66

77
plugins {
8-
id("com.github.johnrengelman.shadow") version "7.1.2"
9-
id("org.jetbrains.kotlin.jvm") version "1.3.41"
8+
id("com.github.johnrengelman.shadow") version "8.1.1"
9+
id("org.jetbrains.kotlin.jvm") version "1.9.22"
1010
}
1111

1212

@@ -41,9 +41,9 @@ repositories {
4141

4242
tasks {
4343
"shadowJar"(ShadowJar::class) {
44-
baseName = "chaincode"
45-
version = null
46-
classifier = null
44+
archiveBaseName = "chaincode"
45+
archiveVersion = ""
46+
archiveClassifier = ""
4747
mergeServiceFiles()
4848
manifest {
4949
attributes(mapOf("Main-Class" to "org.hyperledger.fabric.contract.ContractRouter"))
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

examples/fabric-contract-example-gradle-kotlin/gradlew

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/fabric-contract-example-gradle-kotlin/gradlew.bat

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/fabric-contract-example-gradle/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '7.1.2'
2+
id 'com.github.johnrengelman.shadow' version '8.1.1'
33
id 'java'
44
}
55

66
version '0.0.1'
77

8-
sourceCompatibility = 1.8
8+
tasks.compileJava {
9+
options.release.set(11)
10+
}
911

1012
repositories {
1113
mavenLocal()
@@ -20,17 +22,17 @@ repositories {
2022
}
2123

2224
dependencies {
23-
compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.5.1'
25+
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1'
2426
compile 'org.json:json:20231013'
2527
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
2628
testImplementation 'org.assertj:assertj-core:3.11.1'
2729
testImplementation 'org.mockito:mockito-core:2.+'
2830
}
2931

3032
shadowJar {
31-
baseName = 'chaincode'
32-
version = null
33-
classifier = null
33+
archiveBaseName = 'chaincode'
34+
archiveVersion = ''
35+
archiveClassifier = ''
3436
mergeServiceFiles()
3537

3638
manifest {

examples/ledger-api/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '7.1.2'
2+
id 'com.github.johnrengelman.shadow' version '8.1.1'
33
id 'java'
44
}
55

66
version '0.0.1'
77

8-
sourceCompatibility = 1.8
8+
tasks.compileJava {
9+
options.release.set(11)
10+
}
911

1012
repositories {
1113
mavenLocal()
@@ -20,17 +22,17 @@ repositories {
2022
}
2123

2224
dependencies {
23-
compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.4.5'
25+
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1'
2426
compile 'org.json:json:20231013'
2527
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
2628
testImplementation 'org.assertj:assertj-core:3.11.1'
2729
testImplementation 'org.mockito:mockito-core:2.+'
2830
}
2931

3032
shadowJar {
31-
baseName = 'chaincode'
32-
version = null
33-
classifier = null
33+
archiveBaseName = 'chaincode'
34+
archiveVersion = ''
35+
archiveClassifier = ''
3436
mergeServiceFiles()
3537

3638
manifest {

0 commit comments

Comments
 (0)