mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 17:45:10 +00:00
[FAB-6415] Java 11 support for FabCar sample
Signed-off-by: Simon Stone <sstone1@uk.ibm.com> Change-Id: I97cd3ab48f6f2fe828c3328adfaf706be5124387
This commit is contained in:
parent
e2b7cb7464
commit
3d19014bd7
7 changed files with 51 additions and 23 deletions
|
|
@ -4,8 +4,7 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'checkstyle'
|
id 'checkstyle'
|
||||||
id 'com.github.johnrengelman.shadow' version '2.0.4'
|
id 'java-library-distribution'
|
||||||
id 'java-library'
|
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13,8 +12,9 @@ group 'org.hyperledger.fabric.samples'
|
||||||
version '1.0-SNAPSHOT'
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-SNAPSHOT'
|
compileOnly 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-SNAPSHOT'
|
||||||
implementation 'com.owlike:genson:1.5'
|
implementation 'com.owlike:genson:1.5'
|
||||||
|
testImplementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-SNAPSHOT'
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
|
||||||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||||
testImplementation 'org.mockito:mockito-core:2.+'
|
testImplementation 'org.mockito:mockito-core:2.+'
|
||||||
|
|
@ -43,15 +43,6 @@ checkstyleTest {
|
||||||
source ='src/test/java'
|
source ='src/test/java'
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
baseName = 'chaincode'
|
|
||||||
version = null
|
|
||||||
classifier = null
|
|
||||||
manifest {
|
|
||||||
attributes 'Main-Class': 'org.hyperledger.fabric.contract.ContractRouter'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jacocoTestCoverageVerification {
|
jacocoTestCoverageVerification {
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
classDirectories = files(classDirectories.files.collect {
|
classDirectories = files(classDirectories.files.collect {
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
||||||
22
chaincode/fabcar/java/gradlew
vendored
22
chaincode/fabcar/java/gradlew
vendored
|
|
@ -1,5 +1,21 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
|
|
@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
@ -109,8 +125,8 @@ if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
|
||||||
18
chaincode/fabcar/java/gradlew.bat
vendored
18
chaincode/fabcar/java/gradlew.bat
vendored
|
|
@ -1,3 +1,19 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
|
|
@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS=
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rootProject.name = 'java-chaincode-bootstrap'
|
rootProject.name = 'fabcar'
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,12 @@ if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then
|
||||||
echo Finished vendoring Go dependencies
|
echo Finished vendoring Go dependencies
|
||||||
elif [ "$CC_SRC_LANGUAGE" = "java" ]; then
|
elif [ "$CC_SRC_LANGUAGE" = "java" ]; then
|
||||||
CC_RUNTIME_LANGUAGE=java
|
CC_RUNTIME_LANGUAGE=java
|
||||||
CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/java
|
CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/java/build/install/fabcar
|
||||||
|
echo Compiling Java code ...
|
||||||
|
pushd ../chaincode/fabcar/java
|
||||||
|
./gradlew installDist
|
||||||
|
popd
|
||||||
|
echo Finished compiling Java code
|
||||||
elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then
|
elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then
|
||||||
CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js
|
CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js
|
||||||
CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/javascript
|
CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/javascript
|
||||||
|
|
@ -37,7 +42,7 @@ elif [ "$CC_SRC_LANGUAGE" = "typescript" ]; then
|
||||||
echo Finished compiling TypeScript code into JavaScript
|
echo Finished compiling TypeScript code into JavaScript
|
||||||
else
|
else
|
||||||
echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script
|
echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script
|
||||||
echo Supported chaincode languages are: go, javascript, and typescript
|
echo Supported chaincode languages are: go, java, javascript, and typescript
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue