diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3a3bc74e..1357bf02e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,6 @@ jobs: with: distribution: 'temurin' java-version: '11' - cache: 'gradle' - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v2 - name: Build and Unit test @@ -32,7 +31,7 @@ jobs: arguments: | :fabric-chaincode-shim:build - intergationtest: + intergationtest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -42,7 +41,6 @@ jobs: with: distribution: 'temurin' java-version: '11' - cache: 'gradle' - name: Populate chaincode with latest java-version run: | ./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: with: arguments: | :fabric-chaincode-integration-test:build + + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.checkout-ref }} + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + - name: Build Docker image + uses: gradle/actions/setup-gradle@v3 + with: + arguments: | + :fabric-chaincode-docker:buildImage diff --git a/build.gradle b/build.gradle index c3a0584c7..947cabf69 100644 --- a/build.gradle +++ b/build.gradle @@ -37,23 +37,25 @@ subprojects { group = 'org.hyperledger.fabric-chaincode-java' version = rootProject.version - - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } + } dependencies { - implementation group: 'commons-cli', name: 'commons-cli', version: '1.6.0' - implementation group: 'commons-logging', name: 'commons-logging', version: '1.2' - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.3.1' - testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.3.1' + implementation 'commons-cli:commons-cli:1.6.0' + implementation 'commons-logging:commons-logging:1.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1' - testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.23.0' - testImplementation group: 'com.github.stefanbirkner', name: 'system-rules', version: 'system-rules-1.17.0' + testImplementation 'org.hamcrest:hamcrest-library:1.3' + testImplementation 'org.mockito:mockito-core:2.23.0' + testImplementation 'com.github.stefanbirkner:system-rules:system-rules-1.17.0' - testCompileOnly group: 'junit', name: 'junit', version: '4.12' - testRuntimeOnly group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.3.1' - testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.9.1' + testCompileOnly 'junit:junit:4.12' + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.3.1' + testImplementation 'org.assertj:assertj-core:3.9.1' } test { diff --git a/examples/fabric-contract-example-as-service/build.gradle b/examples/fabric-contract-example-as-service/build.gradle index 7c7091532..3f93ce2cf 100644 --- a/examples/fabric-contract-example-as-service/build.gradle +++ b/examples/fabric-contract-example-as-service/build.gradle @@ -1,11 +1,13 @@ plugins { - id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'com.github.johnrengelman.shadow' version '8.1.1' id 'java' } version '0.0.1' -sourceCompatibility = 1.8 +tasks.compileJava { + options.release.set(11) +} repositories { mavenLocal() @@ -20,7 +22,7 @@ repositories { } dependencies { - compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.3.+' + compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' compile 'org.json:json:20231013' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' @@ -28,9 +30,9 @@ dependencies { } shadowJar { - baseName = 'chaincode' - version = null - classifier = null + archiveBaseName = 'chaincode' + archiveVersion = '' + archiveClassifier = '' mergeServiceFiles() manifest { diff --git a/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts b/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts index 45d20f3e2..2d3baf0f1 100644 --- a/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts +++ b/examples/fabric-contract-example-gradle-kotlin/build.gradle.kts @@ -5,8 +5,8 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { - id("com.github.johnrengelman.shadow") version "7.1.2" - id("org.jetbrains.kotlin.jvm") version "1.3.41" + id("com.github.johnrengelman.shadow") version "8.1.1" + id("org.jetbrains.kotlin.jvm") version "1.9.22" } @@ -41,9 +41,9 @@ repositories { tasks { "shadowJar"(ShadowJar::class) { - baseName = "chaincode" - version = null - classifier = null + archiveBaseName = "chaincode" + archiveVersion = "" + archiveClassifier = "" mergeServiceFiles() manifest { attributes(mapOf("Main-Class" to "org.hyperledger.fabric.contract.ContractRouter")) diff --git a/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.jar b/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.jar index afba10928..d64cd4917 100644 Binary files a/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.jar and b/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.properties b/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.properties index b1624c473..a80b22ce5 100644 --- a/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.properties +++ b/examples/fabric-contract-example-gradle-kotlin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/fabric-contract-example-gradle-kotlin/gradlew b/examples/fabric-contract-example-gradle-kotlin/gradlew index 65dcd68d6..1aa94a426 100755 --- a/examples/fabric-contract-example-gradle-kotlin/gradlew +++ b/examples/fabric-contract-example-gradle-kotlin/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/examples/fabric-contract-example-gradle-kotlin/gradlew.bat b/examples/fabric-contract-example-gradle-kotlin/gradlew.bat index 6689b85be..7101f8e46 100644 --- a/examples/fabric-contract-example-gradle-kotlin/gradlew.bat +++ b/examples/fabric-contract-example-gradle-kotlin/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/examples/fabric-contract-example-gradle/build.gradle b/examples/fabric-contract-example-gradle/build.gradle index 1389be1a2..b47477424 100644 --- a/examples/fabric-contract-example-gradle/build.gradle +++ b/examples/fabric-contract-example-gradle/build.gradle @@ -1,11 +1,13 @@ plugins { - id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'com.github.johnrengelman.shadow' version '8.1.1' id 'java' } version '0.0.1' -sourceCompatibility = 1.8 +tasks.compileJava { + options.release.set(11) +} repositories { mavenLocal() @@ -20,7 +22,7 @@ repositories { } dependencies { - compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.5.1' + compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' compile 'org.json:json:20231013' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' @@ -28,9 +30,9 @@ dependencies { } shadowJar { - baseName = 'chaincode' - version = null - classifier = null + archiveBaseName = 'chaincode' + archiveVersion = '' + archiveClassifier = '' mergeServiceFiles() manifest { diff --git a/examples/ledger-api/build.gradle b/examples/ledger-api/build.gradle index 278cb2b5b..b47477424 100644 --- a/examples/ledger-api/build.gradle +++ b/examples/ledger-api/build.gradle @@ -1,11 +1,13 @@ plugins { - id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'com.github.johnrengelman.shadow' version '8.1.1' id 'java' } version '0.0.1' -sourceCompatibility = 1.8 +tasks.compileJava { + options.release.set(11) +} repositories { mavenLocal() @@ -20,7 +22,7 @@ repositories { } dependencies { - compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.4.5' + compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' compile 'org.json:json:20231013' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' @@ -28,9 +30,9 @@ dependencies { } shadowJar { - baseName = 'chaincode' - version = null - classifier = null + archiveBaseName = 'chaincode' + archiveVersion = '' + archiveClassifier = '' mergeServiceFiles() manifest { diff --git a/fabric-chaincode-docker/Dockerfile b/fabric-chaincode-docker/Dockerfile index efc09f580..515a37caa 100644 --- a/fabric-chaincode-docker/Dockerfile +++ b/fabric-chaincode-docker/Dockerfile @@ -1,4 +1,4 @@ -FROM eclipse-temurin:11.0.21_9-jdk as builder +FROM eclipse-temurin:11.0.22_7-jdk as builder ENV DEBIAN_FRONTEND=noninteractive # Build tools @@ -10,10 +10,10 @@ RUN curl -s "https://get.sdkman.io" | bash SHELL ["/bin/bash", "-c"] -RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install gradle 7.6.3 -RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install maven 3.9.5 +RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install gradle 8.6 +RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install maven 3.9.6 -FROM eclipse-temurin:11.0.21_9-jdk as dependencies +FROM eclipse-temurin:11.0.22_7-jdk as dependencies COPY --from=builder /root/.sdkman/candidates/gradle/current /usr/bin/gradle COPY --from=builder /root/.sdkman/candidates/maven/current /usr/bin/maven @@ -53,7 +53,7 @@ RUN mvn -N io.takari:maven:wrapper # Creating final javaenv image which will include all required # dependencies to build and compile java chaincode -FROM eclipse-temurin:11.0.21_9-jdk +FROM eclipse-temurin:11.0.22_7-jdk RUN apt-get update \ && apt-get -y install zip unzip \ diff --git a/fabric-chaincode-docker/build.gradle b/fabric-chaincode-docker/build.gradle index 78ae2759b..a2caaf35a 100644 --- a/fabric-chaincode-docker/build.gradle +++ b/fabric-chaincode-docker/build.gradle @@ -66,6 +66,6 @@ task copyAllDeps(type: Copy) { task buildImage(type: DockerBuildImage) { dependsOn copyAllDeps inputDir = project.file('Dockerfile').parentFile - tags = ['hyperledger/fabric-javaenv', 'hyperledger/fabric-javaenv:amd64-2.5.1', 'hyperledger/fabric-javaenv:amd64-latest'] + tags = ['hyperledger/fabric-javaenv', 'hyperledger/fabric-javaenv:2.5', 'hyperledger/fabric-javaenv:amd64-2.5.1', 'hyperledger/fabric-javaenv:amd64-latest'] } diff --git a/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle b/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle index d1a04496a..f81c5fee2 100644 --- a/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle +++ b/fabric-chaincode-integration-test/src/contracts/bare-gradle/build.gradle @@ -6,7 +6,9 @@ plugins { group 'org.hyperledger.fabric-chaincode-java' version '1.0-SNAPSHOT' -sourceCompatibility = 1.8 +tasks.compileJava { + sourceCompatibility = '1.8' +} repositories { mavenLocal() @@ -18,7 +20,7 @@ repositories { } dependencies { - implementation'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' + implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' implementation 'org.hyperledger.fabric:fabric-protos:0.2.+' } diff --git a/fabric-chaincode-integration-test/src/contracts/bare-maven/pom.xml b/fabric-chaincode-integration-test/src/contracts/bare-maven/pom.xml index 51e9df373..a3a6bebe7 100644 --- a/fabric-chaincode-integration-test/src/contracts/bare-maven/pom.xml +++ b/fabric-chaincode-integration-test/src/contracts/bare-maven/pom.xml @@ -7,7 +7,7 @@ - 1.8 + 8 UTF-8 UTF-8 @@ -49,8 +49,7 @@ maven-compiler-plugin 3.11.0 - ${java.version} - ${java.version} + ${java.version} diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle index 8762d6bd2..b2384ce12 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle +++ b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/build.gradle @@ -1,12 +1,14 @@ plugins { - id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'com.github.johnrengelman.shadow' version '8.1.1' id 'java' } group 'org.hyperledger.fabric-chaincode-java' version '1.0-SNAPSHOT' -sourceCompatibility = 1.8 +tasks.compileJava { + options.release.set(8) +} repositories { mavenLocal() @@ -18,14 +20,14 @@ repositories { } dependencies { - implementation'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' + implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' implementation 'org.hyperledger.fabric:fabric-protos:0.2.+' } shadowJar { - baseName = 'chaincode' - version = null - classifier = null + archiveBaseName = 'chaincode' + archiveVersion = '' + archiveClassifier = '' mergeServiceFiles() manifest { diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.jar b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.jar index afba10928..d64cd4917 100644 Binary files a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.jar and b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.jar differ diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.properties b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.properties index b1624c473..a80b22ce5 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.properties +++ b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew index 65dcd68d6..1aa94a426 100755 --- a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew +++ b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew.bat b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew.bat index 6689b85be..7101f8e46 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew.bat +++ b/fabric-chaincode-integration-test/src/contracts/fabric-ledger-api/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle index fa796caf9..0f1a50ae7 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle +++ b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/build.gradle @@ -1,15 +1,16 @@ plugins { - id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'com.github.johnrengelman.shadow' version '8.1.1' id 'java' } group 'org.hyperledger.fabric-chaincode-java' version '1.0-SNAPSHOT' -sourceCompatibility = 1.8 +tasks.compileJava { + options.release.set(8) +} repositories { - mavenLocal() mavenCentral() maven { url = "https://www.jitpack.io" } maven { @@ -18,16 +19,16 @@ repositories { } dependencies { - implementation'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' + implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.1' implementation 'org.hyperledger.fabric:fabric-protos:0.2.+' implementation 'commons-logging:commons-logging:1.2' implementation 'com.google.code.gson:gson:2.10.1' } shadowJar { - baseName = 'chaincode' - version = null - classifier = null + archiveBaseName = 'chaincode' + archiveVersion = '' + archiveClassifier = '' mergeServiceFiles() manifest { diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.jar b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.jar index afba10928..d64cd4917 100644 Binary files a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.jar and b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.jar differ diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.properties b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.properties index b1624c473..a80b22ce5 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.properties +++ b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew index 65dcd68d6..1aa94a426 100755 --- a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew +++ b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew.bat b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew.bat index 6689b85be..7101f8e46 100644 --- a/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew.bat +++ b/fabric-chaincode-integration-test/src/contracts/fabric-shim-api/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/fabric-chaincode-integration-test/src/contracts/wrapper-maven/pom.xml b/fabric-chaincode-integration-test/src/contracts/wrapper-maven/pom.xml index 069665ac4..50082839a 100644 --- a/fabric-chaincode-integration-test/src/contracts/wrapper-maven/pom.xml +++ b/fabric-chaincode-integration-test/src/contracts/wrapper-maven/pom.xml @@ -7,7 +7,7 @@ - 1.8 + 8 UTF-8 UTF-8 @@ -49,8 +49,7 @@ maven-compiler-plugin 3.11.0 - ${java.version} - ${java.version} + ${java.version} diff --git a/fabric-chaincode-integration-test/src/test/resources/scripts/mfsetup.sh b/fabric-chaincode-integration-test/src/test/resources/scripts/mfsetup.sh index f2cb4d8f1..bfed23327 100755 --- a/fabric-chaincode-integration-test/src/test/resources/scripts/mfsetup.sh +++ b/fabric-chaincode-integration-test/src/test/resources/scripts/mfsetup.sh @@ -9,7 +9,7 @@ mkdir -p "${CFG}" # --- # Setup up Microfab image # using the IBM tagged version until labs workflow is updated -docker kill microfab || true +docker rm -f microfab || true export MICROFAB_CONFIG='{"couchdb":false,"endorsing_organizations":[{"name":"org1"},{"name":"org2"}],"channels":[{"name":"sachannel","endorsing_organizations":["org1","org2"]}],"capability_level":"V2_0"}' diff --git a/fabric-chaincode-shim/build.gradle b/fabric-chaincode-shim/build.gradle index 25d3c1aaf..f9d5b1b3c 100644 --- a/fabric-chaincode-shim/build.gradle +++ b/fabric-chaincode-shim/build.gradle @@ -337,7 +337,7 @@ signing { task sourcesJar(type: Jar) { duplicatesStrategy = 'include' - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index afba10928..d64cd4917 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b1624c473..a80b22ce5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d6..1aa94a426 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85be..7101f8e46 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail