diff --git a/Basic/build.gradle b/Basic/build.gradle new file mode 100644 index 00000000..3b0d2b58 --- /dev/null +++ b/Basic/build.gradle @@ -0,0 +1,8 @@ +plugins { + id 'base' +} + +wrapper { + gradleVersion = '7.4.2' + distributionType = Wrapper.DistributionType.BIN +} diff --git a/Basic/constants.properties b/Basic/constants.properties deleted file mode 100644 index 6425fb0b..00000000 --- a/Basic/constants.properties +++ /dev/null @@ -1,12 +0,0 @@ -cordaReleaseGroup=net.corda -cordaCoreReleaseGroup=net.corda -cordaVersion=4.8.5 -cordaCoreVersion=4.8.5 -gradlePluginsVersion=5.0.12 -kotlinVersion=1.2.71 -junitVersion=4.12 -quasarVersion=0.7.10 -log4jVersion =2.17.1 -platformVersion=10 -slf4jVersion=1.7.25 -nettyVersion=4.1.22.Final diff --git a/Basic/cordapp-example/build.gradle b/Basic/cordapp-example/build.gradle index d6473780..045fe1ef 100644 --- a/Basic/cordapp-example/build.gradle +++ b/Basic/cordapp-example/build.gradle @@ -1,104 +1,80 @@ -buildscript {//properties that you need to build the project - Properties constants = new Properties() - file("$projectDir/../constants.properties").withInputStream { constants.load(it) } +import static org.gradle.jvm.toolchain.JavaLanguageVersion.of +import net.corda.plugins.Cordform - ext { - corda_release_group = constants.getProperty("cordaReleaseGroup") - corda_core_release_group = constants.getProperty("cordaCoreReleaseGroup") - corda_release_version = constants.getProperty("cordaVersion") - corda_core_release_version = constants.getProperty("cordaCoreVersion") - corda_gradle_plugins_version = constants.getProperty("gradlePluginsVersion") - kotlin_version = constants.getProperty("kotlinVersion") - junit_version = constants.getProperty("junitVersion") - quasar_version = constants.getProperty("quasarVersion") - log4j_version = constants.getProperty("log4jVersion") - slf4j_version = constants.getProperty("slf4jVersion") - corda_platform_version = constants.getProperty("platformVersion").toInteger() - //springboot - spring_boot_version = '2.0.2.RELEASE' - spring_boot_gradle_plugin_version = '2.0.2.RELEASE' - } - - repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://software.r3.com/artifactory/corda-releases' } - } +plugins { + id 'net.corda.plugins.cordformation' + id 'base' +} - dependencies { - classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" - classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version" - classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version" - classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version" +configurations { + ganache { + canBeConsumed = false + transitive = false } } -allprojects {//Properties that you need to compile your project (The application) - apply from: "${rootProject.projectDir}/repositories.gradle" - apply plugin: 'java' - - repositories { - mavenLocal() +subprojects { //Properties that you need to compile your project (The application) + pluginManager.withPlugin('java') { + java { + toolchain { + languageVersion = of(8) + } + } - mavenCentral() - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://jitpack.io' } + tasks.withType(JavaCompile).configureEach { + options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. + } } - tasks.withType(JavaCompile) { - options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. + def subPath = it.path + pluginManager.withPlugin('net.corda.plugins.cordapp') { + rootProject.dependencies { + ganache project(path: subPath, configuration: 'cordaCordapp') + } } - jar { - // This makes the JAR's SHA-256 hash repeatable. - preserveFileTimestamps = false - reproducibleFileOrder = true - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } -} - -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' - -sourceSets { - main { - resources { - srcDir rootProject.file("config/dev") + configurations.matching { it.name.endsWith("Classpath") }.configureEach { + resolutionStrategy { + dependencySubstitution { + substitute module('com.fasterxml.jackson.module:jackson-module-kotlin') with module("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.7") + substitute module('org.gradle:gradle-tooling-api') with module("org.gradle:gradle-tooling-api:${gradle.gradleVersion}") + } } } } + //Module dependencis dependencies { - // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" + cordaBootstrapper "$corda_release_group:corda-node-api:$corda_release_version" + cordaBootstrapper "org.slf4j:slf4j-simple:$slf4j_version" + corda "$corda_release_group:corda:$corda_release_version" // CorDapp dependencies. - cordapp project(":workflows") - cordapp project(":contracts") - - cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}" - cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version" + cordapp project(':workflows') + cordapp project(':contracts') } -//Task to deploy the nodes in order to bootstrap a network -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { +//Task to build the jar for ganache. +tasks.register('ganache') { + dependsOn configurations.ganache.buildDependencies + doLast { + copy { + from configurations.ganache + into layout.buildDirectory.dir('libs') + } + } +} +tasks.register('deployNodes', Cordform) { /* This property will load the CorDapps to each of the node by default, including the Notary. You can find them * in the cordapps folder of the node at build/nodes/Notary/cordapps. However, the notary doesn't really understand * the notion of cordapps. In production, Notary does not need cordapps as well. This is just a short cut to load * the Corda network bootstrapper. */ nodeDefaults { - projectCordapp { - deploy = false - } - cordapp project(':contracts') cordapp project(':workflows') + cordapp project(':contracts') + rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] runSchemaMigration = true //This configuration is for any CorDapps with custom schema, We will leave this as true to avoid //problems for developers who are not familiar with Corda. If you are not using custom schemas, you can change //it to false for quicker project compiling time. @@ -111,6 +87,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10003") adminAddress("localhost:10043") } + rpcUsers = [] } node { name "O=PartyA,L=London,C=GB" @@ -119,7 +96,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10006") adminAddress("localhost:10046") } - rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] } node { name "O=PartyB,L=New York,C=US" @@ -128,6 +104,5 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10009") adminAddress("localhost:10049") } - rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] } } diff --git a/Basic/cordapp-example/clients/build.gradle b/Basic/cordapp-example/clients/build.gradle index 7ea1f1ec..ea1f9706 100644 --- a/Basic/cordapp-example/clients/build.gradle +++ b/Basic/cordapp-example/clients/build.gradle @@ -1,54 +1,60 @@ -apply plugin: 'org.springframework.boot' +plugins { + id 'org.springframework.boot' + id 'java' +} sourceSets { main { resources { - srcDir rootProject.file("config/dev") + srcDir file("$rootDir/config/dev") } } } dependencies { // Corda dependencies. - compile "$corda_release_group:corda-rpc:$corda_release_version" - compile "net.corda:corda-jackson:$corda_release_version" + implementation "$corda_release_group:corda-rpc:$corda_release_version" + implementation "net.corda:corda-jackson:$corda_release_version" // CorDapp dependencies. - compile project(":contracts") - compile project(":workflows") - compile("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") { + implementation project(':contracts') + implementation project(':workflows') + implementation("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") { exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" } - compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - compile "org.apache.logging.log4j:log4j-web:${log4j_version}" - compile "org.slf4j:jul-to-slf4j:$slf4j_version" + runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" + runtimeOnly "org.apache.logging.log4j:log4j-web:$log4j_version" } + springBoot { - mainClassName = "net.corda.samples.example.webserver.Starter" + mainClassName = "net.corda.samples.example.webserver.ServerKt" } /* The Client is the communication channel between the external and the node. This task will help you immediately * execute your rpc methods in the main method of the client.kt. You can somewhat see this as a quick test of making * RPC calls to your nodes. */ -task runTestClient(type: JavaExec, dependsOn: assemble) { +tasks.register('runTestClient', JavaExec) { + dependsOn assemble classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.samples.example.webserver.Client' + main = 'net.corda.samples.example.ClientKt' args 'localhost:10006', 'user1', 'test' } /* This task will start the springboot server that connects to your node (via RPC connection). All of the http requests * are in the Controller file. You can leave the Server.kt and NodeRPCConnection.kt file untouched for your use. */ -task runPartyAServer(type: JavaExec, dependsOn: assemble) { +tasks.register('runPartyAServer', JavaExec) { + dependsOn assemble classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.samples.example.webserver.Starter' + main = 'net.corda.samples.example.webserver.ServerKt' args '--server.port=50005', '--config.rpc.host=localhost', '--config.rpc.port=10006', '--config.rpc.username=user1', '--config.rpc.password=test' } -task runPartyBServer(type: JavaExec, dependsOn: assemble) { +tasks.register('runPartyBServer', JavaExec) { + dependsOn assemble classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.samples.example.webserver.Starter' + main = 'net.corda.samples.example.webserver.ServerKt' args '--server.port=50006', '--config.rpc.host=localhost', '--config.rpc.port=10009', '--config.rpc.username=user1', '--config.rpc.password=test' } diff --git a/Basic/cordapp-example/contracts/build.gradle b/Basic/cordapp-example/contracts/build.gradle index bfec0ad9..d38cb7f3 100644 --- a/Basic/cordapp-example/contracts/build.gradle +++ b/Basic/cordapp-example/contracts/build.gradle @@ -1,35 +1,21 @@ -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' +plugins { + id 'net.corda.plugins.cordapp' +} cordapp { - targetPlatformVersion corda_platform_version - minimumPlatformVersion corda_platform_version + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion corda_platform_version.toInteger() contract { - name "Cordapp-example Contracts" + name "Example-Cordapp Contracts" vendor "Corda Open Source" licence "Apache License, Version 2.0" versionId 1 } } -sourceSets { - main{ - java { - srcDir 'src/main/java' - java.outputDir = file('bin/main') - } - } - test{ - java{ - srcDir 'src/test/java' - java.outputDir = file('bin/test') - } - } -} - dependencies { + testImplementation "$corda_release_group:corda-node-driver:$corda_release_version" + // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" -} \ No newline at end of file + cordaProvided "$corda_core_group:corda-core:$corda_release_version" +} diff --git a/Basic/cordapp-example/workflows/src/main/resources/migration/iou.changelog-master.xml b/Basic/cordapp-example/contracts/src/main/resources/migration/iou.changelog-master.xml similarity index 100% rename from Basic/cordapp-example/workflows/src/main/resources/migration/iou.changelog-master.xml rename to Basic/cordapp-example/contracts/src/main/resources/migration/iou.changelog-master.xml diff --git a/Basic/cordapp-example/workflows/src/main/resources/migration/iou.changelog-v1.xml b/Basic/cordapp-example/contracts/src/main/resources/migration/iou.changelog-v1.xml similarity index 100% rename from Basic/cordapp-example/workflows/src/main/resources/migration/iou.changelog-v1.xml rename to Basic/cordapp-example/contracts/src/main/resources/migration/iou.changelog-v1.xml diff --git a/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/ContractTests.java b/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/ContractTests.java index b379b76d..f7f74334 100644 --- a/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/ContractTests.java +++ b/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/ContractTests.java @@ -8,14 +8,14 @@ import net.corda.testing.node.MockServices; import org.junit.Test; -import static java.util.Arrays.asList; import static net.corda.testing.node.NodeTestUtils.ledger; public class ContractTests { - static private final MockServices ledgerServices = new MockServices(); - static private final TestIdentity megaCorp = new TestIdentity(new CordaX500Name("MegaCorp", "London", "GB")); - static private final TestIdentity miniCorp = new TestIdentity(new CordaX500Name("MiniCorp", "London", "GB")); - static private final int iouValue = 1; + private static final TestIdentity megaCorp = new TestIdentity(new CordaX500Name("MegaCorp", "London", "GB")); + private static final TestIdentity miniCorp = new TestIdentity(new CordaX500Name("MiniCorp", "London", "GB")); + private static final int iouValue = 1; + + private final MockServices ledgerServices = new MockServices(); @Test public void transactionMustIncludeCreateCommand() { diff --git a/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/StateTests.java b/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/StateTests.java index d10780d3..f2b67a65 100644 --- a/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/StateTests.java +++ b/Basic/cordapp-example/contracts/src/test/java/net/corda/samples/example/contracts/StateTests.java @@ -1,17 +1,16 @@ package net.corda.samples.example.contracts; import net.corda.samples.example.states.IOUState; -import net.corda.testing.node.MockServices; import org.junit.Test; -public class StateTests { - private final MockServices ledgerServices = new MockServices(); +import static org.junit.Assert.assertSame; +public class StateTests { @Test public void hasAmountFieldOfCorrectType() throws NoSuchFieldException { // Does the message field exist? IOUState.class.getDeclaredField("value"); // Is the message field of the correct type? - assert(IOUState.class.getDeclaredField("value").getType().equals(Integer.class)); + assertSame(IOUState.class.getDeclaredField("value").getType(), Integer.class); } -} \ No newline at end of file +} diff --git a/Basic/cordapp-example/gradle.properties b/Basic/cordapp-example/gradle.properties index 4727f23c..4c5fdece 100644 --- a/Basic/cordapp-example/gradle.properties +++ b/Basic/cordapp-example/gradle.properties @@ -1,3 +1,23 @@ +org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -Dfile.encoding=UTF-8 +org.gradle.java.installations.auto-download=false +org.gradle.caching=false + name=Example Cordapp group=com.example -version=0.1 \ No newline at end of file +version=1.0 + +# Artifactory +artifactoryContextUrl = https://software.r3.com/artifactory + +corda_release_group=net.corda +corda_core_group=net.corda +corda_release_version=4.9 +corda_platform_version=10 +corda_gradle_plugins_version=5.1.0-RC01 +junit_version=4.13.2 +quasar_version=0.7.14_r3 +log4j_version=2.17.1 +slf4j_version=1.7.30 +netty_version=4.1.22.Final + +spring_boot_version=2.3.12.RELEASE diff --git a/Basic/cordapp-example/gradle/wrapper/gradle-wrapper.jar b/Basic/cordapp-example/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 99340b4a..00000000 Binary files a/Basic/cordapp-example/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Basic/cordapp-example/gradle/wrapper/gradle-wrapper.properties b/Basic/cordapp-example/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 0188225a..00000000 --- a/Basic/cordapp-example/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Fri Aug 25 12:50:39 BST 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip - diff --git a/Basic/cordapp-example/gradlew b/Basic/cordapp-example/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/Basic/cordapp-example/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -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. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -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. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/Basic/cordapp-example/repositories.gradle b/Basic/cordapp-example/repositories.gradle deleted file mode 100644 index 3198e5c6..00000000 --- a/Basic/cordapp-example/repositories.gradle +++ /dev/null @@ -1,8 +0,0 @@ -repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://jitpack.io' } - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://repo.gradle.org/gradle/libs-releases' } -} diff --git a/Basic/cordapp-example/settings.gradle b/Basic/cordapp-example/settings.gradle index 2514aca2..bf61b401 100644 --- a/Basic/cordapp-example/settings.gradle +++ b/Basic/cordapp-example/settings.gradle @@ -1,3 +1,35 @@ +pluginManagement { + repositories { + maven { + url "$artifactoryContextUrl/corda-releases" + } + gradlePluginPortal() + } + + plugins { + id 'net.corda.plugins.cordapp' version corda_gradle_plugins_version + id 'net.corda.plugins.cordformation' version corda_gradle_plugins_version + id 'net.corda.plugins.quasar-utils' version corda_gradle_plugins_version + id 'org.springframework.boot' version spring_boot_version + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + maven { + url "$artifactoryContextUrl/corda" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://repo.gradle.org/gradle/libs-releases' + } + } +} + include 'workflows' include 'contracts' -include 'clients' \ No newline at end of file +include 'clients' diff --git a/Basic/cordapp-example/workflows/build.gradle b/Basic/cordapp-example/workflows/build.gradle index 6bf44b06..dd02e527 100644 --- a/Basic/cordapp-example/workflows/build.gradle +++ b/Basic/cordapp-example/workflows/build.gradle @@ -1,12 +1,13 @@ -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' +plugins { + id 'net.corda.plugins.cordapp' + id 'net.corda.plugins.quasar-utils' +} cordapp { - targetPlatformVersion corda_platform_version - minimumPlatformVersion corda_platform_version + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion corda_platform_version.toInteger() workflow { - name "Cordapp-example Flows" + name "Example-Cordapp Flows" vendor "Corda Open Source" licence "Apache License, Version 2.0" versionId 1 @@ -14,22 +15,9 @@ cordapp { } sourceSets { - main { - java { - srcDir 'src/main/java' - java.outputDir = file('bin/main') - } - resources { - srcDir rootProject.file("config/dev") - } - } test { - java { - srcDir 'src/test/java' - java.outputDir = file('bin/main') - } resources { - srcDir rootProject.file("config/test") + srcDir file("$rootDir/config/test") } } integrationTest { @@ -42,25 +30,22 @@ sourceSets { } configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime + integrationTestImplementation.extendsFrom testImplementation + integrationTestRuntimeOnly.extendsFrom testRuntimeOnly } dependencies { - testCompile "junit:junit:$junit_version" + testImplementation "$corda_release_group:corda-node-driver:$corda_release_version" + testImplementation "junit:junit:$junit_version" // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" - cordaCompile group: 'com.google.guava', name: 'guava', version: '23.5-jre' - + cordaProvided "$corda_core_group:corda-core:$corda_release_version" // CorDapp dependencies. - cordapp project(":contracts") + cordapp project(':contracts') } -task integrationTest(type: Test, dependsOn: []) { +tasks.register('integrationTest', Test) { testClassesDirs = sourceSets.integrationTest.output.classesDirs classpath = sourceSets.integrationTest.runtimeClasspath -} \ No newline at end of file +} diff --git a/Basic/cordapp-example/workflows/src/main/java/net/corda/samples/example/flows/ExampleFlow.java b/Basic/cordapp-example/workflows/src/main/java/net/corda/samples/example/flows/ExampleFlow.java index 6074cee8..ad541896 100644 --- a/Basic/cordapp-example/workflows/src/main/java/net/corda/samples/example/flows/ExampleFlow.java +++ b/Basic/cordapp-example/workflows/src/main/java/net/corda/samples/example/flows/ExampleFlow.java @@ -4,7 +4,6 @@ import net.corda.samples.example.contracts.IOUContract; import net.corda.samples.example.states.IOUState; import net.corda.core.contracts.Command; -import net.corda.core.contracts.ContractState; import net.corda.core.contracts.UniqueIdentifier; import net.corda.core.crypto.SecureHash; import net.corda.core.flows.*; @@ -15,6 +14,7 @@ import net.corda.core.utilities.ProgressTracker.Step; import java.util.Arrays; +import java.util.List; import static net.corda.core.contracts.ContractsDSL.requireThat; import net.corda.core.identity.CordaX500Name; @@ -142,9 +142,9 @@ private SignTxFlow(FlowSession otherPartyFlow, ProgressTracker progressTracker) @Override protected void checkTransaction(SignedTransaction stx) { requireThat(require -> { - ContractState output = stx.getTx().getOutputs().get(0).getData(); - require.using("This must be an IOU transaction.", output instanceof IOUState); - IOUState iou = (IOUState) output; + List ious = stx.getTx().outputsOfType(IOUState.class); + require.using("This must be an IOU transaction.", !ious.isEmpty()); + IOUState iou = ious.get(0); require.using("I won't accept IOUs with a value over 100.", iou.getValue() <= 100); return null; }); diff --git a/Basic/cordapp-example/workflows/src/test/java/net/corda/samples/example/FlowTests.java b/Basic/cordapp-example/workflows/src/test/java/net/corda/samples/example/FlowTests.java index 7a8a0bf8..7098ea50 100644 --- a/Basic/cordapp-example/workflows/src/test/java/net/corda/samples/example/FlowTests.java +++ b/Basic/cordapp-example/workflows/src/test/java/net/corda/samples/example/FlowTests.java @@ -106,7 +106,7 @@ public void recordedTransactionHasNoInputsAndASingleOutputTheInputIOU() throws E for (StartedMockNode node : ImmutableList.of(a, b)) { SignedTransaction recordedTx = node.getServices().getValidatedTransactions().getTransaction(signedTx.getId()); List> txOutputs = recordedTx.getTx().getOutputs(); - assert (txOutputs.size() == 1); + assertEquals(1, txOutputs.size()); IOUState recordedState = (IOUState) txOutputs.get(0).getData(); assertEquals(recordedState.getValue(), iouValue); diff --git a/Basic/flow-database-access/README.md b/Basic/flow-database-access/README.md index ac15bbdf..e2393a0e 100644 --- a/Basic/flow-database-access/README.md +++ b/Basic/flow-database-access/README.md @@ -25,7 +25,7 @@ For development environment setup, please refer to: [Setup Guide](https://docs.c Open a terminal and go to the project root directory and type: (to deploy the nodes using bootstrapper) ``` -./gradlew clean deployNodes +../gradlew clean deployNodes ``` Then type: (to run the nodes) ``` diff --git a/Basic/flow-database-access/build.gradle b/Basic/flow-database-access/build.gradle index 16b1aef4..000b425c 100644 --- a/Basic/flow-database-access/build.gradle +++ b/Basic/flow-database-access/build.gradle @@ -1,89 +1,53 @@ -buildscript {//properties that you need to build the project - Properties constants = new Properties() - file("$projectDir/../constants.properties").withInputStream { constants.load(it) } +import static org.gradle.jvm.toolchain.JavaLanguageVersion.of +import net.corda.plugins.Cordform - ext { - corda_release_group = constants.getProperty("cordaReleaseGroup") - corda_core_release_group = constants.getProperty("cordaCoreReleaseGroup") - corda_release_version = constants.getProperty("cordaVersion") - corda_core_release_version = constants.getProperty("cordaCoreVersion") - corda_gradle_plugins_version = constants.getProperty("gradlePluginsVersion") - kotlin_version = constants.getProperty("kotlinVersion") - junit_version = constants.getProperty("junitVersion") - quasar_version = constants.getProperty("quasarVersion") - log4j_version = constants.getProperty("log4jVersion") - slf4j_version = constants.getProperty("slf4jVersion") - corda_platform_version = constants.getProperty("platformVersion").toInteger() - } - - repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://software.r3.com/artifactory/corda-releases' } - } - - dependencies { - classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" - classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version" - classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version" - } +plugins { + id 'net.corda.plugins.cordformation' + id 'base' } -allprojects {//Properties that you need to compile your project (The application) - apply plugin: 'java' - - repositories { - mavenLocal() - - mavenCentral() - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://jitpack.io' } - } - - tasks.withType(JavaCompile) { - options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. - } +subprojects { //Properties that you need to compile your project (The application) + pluginManager.withPlugin('java') { + java { + toolchain { + languageVersion = of(8) + } + } - jar { - // This makes the JAR's SHA-256 hash repeatable. - preserveFileTimestamps = false - reproducibleFileOrder = true - duplicatesStrategy = DuplicatesStrategy.EXCLUDE + tasks.withType(JavaCompile).configureEach { + options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. + } } -} - -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' -sourceSets { - main { - resources { - srcDir rootProject.file("config/dev") + configurations.matching { it.name.endsWith("Classpath") }.configureEach { + resolutionStrategy { + dependencySubstitution { + substitute module('com.fasterxml.jackson.module:jackson-module-kotlin') with module("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.7") + substitute module('org.gradle:gradle-tooling-api') with module("org.gradle:gradle-tooling-api:${gradle.gradleVersion}") + } } } } + //Module dependencis dependencies { - // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" + cordaBootstrapper "$corda_release_group:corda-node-api:$corda_release_version" + cordaBootstrapper "org.slf4j:slf4j-simple:$slf4j_version" + corda "$corda_release_group:corda:$corda_release_version" // CorDapp dependencies. - cordapp project(":workflows") + cordapp project(':workflows') - cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}" - cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version" + cordaDriver "$corda_release_group:corda-shell:$corda_release_version" } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { +tasks.register('deployNodes', Cordform) { + /* This property will load the CorDapps to each of the node by default, including the Notary. You can find them + * in the cordapps folder of the node at build/nodes/Notary/cordapps. However, the notary doesn't really understand + * the notion of cordapps. In production, Notary does not need cordapps as well. This is just a short cut to load + * the Corda network bootstrapper. + */ nodeDefaults { - projectCordapp { - deploy = false - } cordapp project(':workflows') runSchemaMigration = true //This configuration is for any CorDapps with custom schema, We will leave this as true to avoid //problems for developers who are not familiar with Corda. If you are not using custom schemas, you can change @@ -96,11 +60,10 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10006") adminAddress("localhost:10046") } - cordapps = [] rpcUsers = [[user: "user1", "password": "test", "permissions": [ - "StartFlow.com.flowdb.AddTokenValueFlow", - "StartFlow.com.flowdb.UpdateTokenValueFlow", - "StartFlow.com.flowdb.QueryTokenValueFlow" + "StartFlow.com.flowdb.AddTokenValueFlow", + "StartFlow.com.flowdb.UpdateTokenValueFlow", + "StartFlow.com.flowdb.QueryTokenValueFlow" ]]] } } diff --git a/Basic/flow-database-access/gradle.properties b/Basic/flow-database-access/gradle.properties index a3b8705b..1ce9ed89 100644 --- a/Basic/flow-database-access/gradle.properties +++ b/Basic/flow-database-access/gradle.properties @@ -1,3 +1,23 @@ -name=Flow Database Access +org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -Dfile.encoding=UTF-8 +org.gradle.java.installations.auto-download=false +org.gradle.caching=false + +name=Flow Database Cordapp group=com.flowdb version=0.1 + +# Artifactory +artifactoryContextUrl = https://software.r3.com/artifactory + +corda_release_group=net.corda +corda_core_group=net.corda +corda_release_version=4.9 +corda_platform_version=10 +corda_gradle_plugins_version=5.1.0-RC01 +junit_version=4.13.2 +quasar_version=0.7.14_r3 +log4j_version=2.17.1 +slf4j_version=1.7.30 +netty_version=4.1.22.Final + +spring_boot_version=2.3.12.RELEASE diff --git a/Basic/flow-database-access/gradle/wrapper/gradle-wrapper.jar b/Basic/flow-database-access/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7a3265ee..00000000 Binary files a/Basic/flow-database-access/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Basic/flow-database-access/gradlew b/Basic/flow-database-access/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/Basic/flow-database-access/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -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. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -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. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/Basic/flow-database-access/gradlew.bat b/Basic/flow-database-access/gradlew.bat deleted file mode 100644 index f9553162..00000000 --- a/Basic/flow-database-access/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -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. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -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. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/Basic/flow-database-access/lib/README.txt b/Basic/flow-database-access/lib/README.txt deleted file mode 100644 index b0592c95..00000000 --- a/Basic/flow-database-access/lib/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -The Quasar.jar in this directory is for runtime instrumentation of classes by Quasar. - -When running corda outside of the given gradle building you must add the following flag with the -correct path to your call to Java: - - java -javaagent:path-to-quasar-jar.jar ... - -See the Quasar docs for more information: http://docs.paralleluniverse.co/quasar/ \ No newline at end of file diff --git a/Basic/flow-database-access/lib/quasar.jar b/Basic/flow-database-access/lib/quasar.jar deleted file mode 100644 index 7282d8c8..00000000 Binary files a/Basic/flow-database-access/lib/quasar.jar and /dev/null differ diff --git a/Basic/flow-database-access/settings.gradle b/Basic/flow-database-access/settings.gradle index 768052d4..1acec812 100644 --- a/Basic/flow-database-access/settings.gradle +++ b/Basic/flow-database-access/settings.gradle @@ -1 +1,33 @@ -include 'workflows' \ No newline at end of file +pluginManagement { + repositories { + maven { + url "$artifactoryContextUrl/corda-releases" + } + gradlePluginPortal() + } + + plugins { + id 'net.corda.plugins.cordapp' version corda_gradle_plugins_version + id 'net.corda.plugins.cordformation' version corda_gradle_plugins_version + id 'net.corda.plugins.quasar-utils' version corda_gradle_plugins_version + id 'org.springframework.boot' version spring_boot_version + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + maven { + url "$artifactoryContextUrl/corda" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://repo.gradle.org/gradle/libs-releases' + } + } +} + +include 'workflows' diff --git a/Basic/flow-database-access/workflows/build.gradle b/Basic/flow-database-access/workflows/build.gradle index 2cc9e4b8..906a0103 100644 --- a/Basic/flow-database-access/workflows/build.gradle +++ b/Basic/flow-database-access/workflows/build.gradle @@ -1,20 +1,6 @@ -apply plugin: 'java' -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' - -jar { - // CorDapps do not configure the Node's logging. - exclude '**/log4j2*.xml' -} - -repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://jitpack.io' } - maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } - maven { url 'https://repo.gradle.org/gradle/libs-releases' } +plugins { + id 'net.corda.plugins.cordapp' + id 'net.corda.plugins.quasar-utils' } cordapp { @@ -29,19 +15,13 @@ cordapp { } dependencies { - testCompile "junit:junit:$junit_version" + testImplementation "junit:junit:$junit_version" // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaCompile "$corda_release_group:corda-jackson:$corda_release_version" - cordaCompile "$corda_release_group:corda-rpc:$corda_release_version" - cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" - - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" - cordaRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" -} + cordaProvided "$corda_core_group:corda-core:$corda_release_version" + cordaProvided "$corda_release_group:corda-jackson:$corda_release_version" + cordaProvided "$corda_release_group:corda-rpc:$corda_release_version" -tasks.withType(JavaCompile) { - options.compilerArgs << "-parameters" // Required for shell commands. + testImplementation "$corda_release_group:corda-node-driver:$corda_release_version" + testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" } diff --git a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/AddTokenValueFlow.java b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/AddTokenValueFlow.java index ce679210..b88ccfdb 100644 --- a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/AddTokenValueFlow.java +++ b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/AddTokenValueFlow.java @@ -42,7 +42,7 @@ public Void call() throws FlowException { try { databaseService.addtokenValue(token, value); } catch (SQLException e) { - e.printStackTrace(); + throw new FlowException(e.getMessage(), e); } return null; } diff --git a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/CryptoValuesDatabaseService.java b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/CryptoValuesDatabaseService.java index 49a3da60..16ed9b68 100644 --- a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/CryptoValuesDatabaseService.java +++ b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/CryptoValuesDatabaseService.java @@ -32,7 +32,7 @@ protected void addtokenValue(String token, Integer value) throws SQLException { params.put(2, value); executeUpdate(query, params); - log.info("Token " + token + " added to crypto_values table."); + log.info("Token {} added to crypto_values table.", token); } /** @@ -45,7 +45,7 @@ protected void updateTokenValue(String token, Integer value) throws SQLException params.put(2, token); executeUpdate(query, params); - log.info("Token " + token + " updated in crypto_values table."); + log.info("Token {} updated in crypto_values table.", token); } /** @@ -74,7 +74,7 @@ protected Integer queryTokenValue(String token) throws SQLException { throw new IllegalArgumentException("Error list has more than one element"); } - log.info("Token " + token + "read from crypto_values table."); + log.info("Token {} read from crypto_values table.", token); return (Integer) results.get(0); } diff --git a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/QueryTokenValueFlow.java b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/QueryTokenValueFlow.java index 0d541065..5323a0b3 100644 --- a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/QueryTokenValueFlow.java +++ b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/QueryTokenValueFlow.java @@ -31,11 +31,11 @@ public ProgressTracker getProgressTracker() { @Override public Integer call() throws FlowException { final CryptoValuesDatabaseService databaseService = getServiceHub().cordaService(CryptoValuesDatabaseService.class); - Integer val = null; + Integer val; try { val = databaseService.queryTokenValue(token); } catch (SQLException e) { - e.printStackTrace(); + throw new FlowException(e.getMessage(), e); } return val; } diff --git a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/UpdateTokenValueFlow.java b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/UpdateTokenValueFlow.java index 5a3e5c73..669e280a 100644 --- a/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/UpdateTokenValueFlow.java +++ b/Basic/flow-database-access/workflows/src/main/java/net/corda/samples/flowdb/UpdateTokenValueFlow.java @@ -36,7 +36,7 @@ public Void call() throws FlowException { try { databaseService.updateTokenValue(token, value); } catch (SQLException e) { - e.printStackTrace(); + throw new FlowException(e.getMessage(), e); } return null; } diff --git a/Basic/flow-database-access/workflows/src/main/resources/log4j2-test.xml b/Basic/flow-database-access/workflows/src/main/resources/log4j2-test.xml deleted file mode 100644 index 5c456762..00000000 --- a/Basic/flow-database-access/workflows/src/main/resources/log4j2-test.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - build/logs - flowdb-${hostName} - - - - - - - [%-5level] %d{HH:mm:ss.SSS} [%t] %c{1}.%M - %msg%n - > - - - - - - - - - - - - - - - - - diff --git a/Basic/flow-database-access/workflows/src/test/java/net/corda/samples/flowdb/FlowTests.java b/Basic/flow-database-access/workflows/src/test/java/net/corda/samples/flowdb/FlowTests.java index 32747447..00e5a395 100644 --- a/Basic/flow-database-access/workflows/src/test/java/net/corda/samples/flowdb/FlowTests.java +++ b/Basic/flow-database-access/workflows/src/test/java/net/corda/samples/flowdb/FlowTests.java @@ -19,13 +19,12 @@ import static org.junit.Assert.assertEquals; public class FlowTests { - private final String BITCOIN = "bitcoin"; - private final String E_CASH = "eCash"; - private final Integer INITIAL_BITCOIN_VALUE = 7000; - private final Integer NEW_BITCOIN_VALUE = 8000; - private final Integer INITIAL_E_CASH_VALUE = 100; - private final Integer NEW_E_CASH_VALUE = 200; - + private static final String BITCOIN = "bitcoin"; + private static final String E_CASH = "eCash"; + private static final int INITIAL_BITCOIN_VALUE = 7000; + private static final Integer NEW_BITCOIN_VALUE = 8000; + private static final int INITIAL_E_CASH_VALUE = 100; + private static final Integer NEW_E_CASH_VALUE = 200; private MockNetwork network; private StartedMockNode node; diff --git a/Basic/flow-http-access/README.md b/Basic/flow-http-access/README.md index bafa01f4..522ee4ed 100644 --- a/Basic/flow-http-access/README.md +++ b/Basic/flow-http-access/README.md @@ -27,13 +27,13 @@ It works mostly as you'd expect, using a request builder to make a request at a ```java public String call() throws FlowException { final Request httpRequest = new Request.Builder().url(Constants.BITCOIN_README_URL).build(); - String value = null; - Response httpResponse = null; + String value; + Response httpResponse; try { httpResponse = new OkHttpClient().newCall(httpRequest).execute(); value = httpResponse.body().string(); } catch (IOException e) { - e.printStackTrace(); + throw new FlowException(e.getMessage(), e); } return value; } @@ -52,7 +52,7 @@ For development environment setup, please refer to: [Setup Guide](https://docs.c Open a terminal and go to the project root directory and type: (to deploy the nodes using bootstrapper) ``` -./gradlew clean deployNodes +../gradlew clean deployNodes ``` Then type: (to run the nodes) ``` diff --git a/Basic/flow-http-access/build.gradle b/Basic/flow-http-access/build.gradle index 31cefdce..efe8a568 100644 --- a/Basic/flow-http-access/build.gradle +++ b/Basic/flow-http-access/build.gradle @@ -1,98 +1,53 @@ -buildscript {//properties that you need to build the project - Properties constants = new Properties() - file("$projectDir/../constants.properties").withInputStream { constants.load(it) } +import static org.gradle.jvm.toolchain.JavaLanguageVersion.of +import net.corda.plugins.Cordform - ext { - corda_release_group = constants.getProperty("cordaReleaseGroup") - corda_core_release_group = constants.getProperty("cordaCoreReleaseGroup") - corda_release_version = constants.getProperty("cordaVersion") - corda_core_release_version = constants.getProperty("cordaCoreVersion") - corda_gradle_plugins_version = constants.getProperty("gradlePluginsVersion") - kotlin_version = constants.getProperty("kotlinVersion") - junit_version = constants.getProperty("junitVersion") - quasar_version = constants.getProperty("quasarVersion") - log4j_version = constants.getProperty("log4jVersion") - slf4j_version = constants.getProperty("slf4jVersion") - corda_platform_version = constants.getProperty("platformVersion").toInteger() - //special dependencies - okhttp_version = '3.5.0' - } - - repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://software.r3.com/artifactory/corda-releases' } - } - - dependencies { - classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" - classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version" - classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version" - } +plugins { + id 'net.corda.plugins.cordformation' + id 'base' } -allprojects {//Properties that you need to compile your project (The application) - apply from: "${rootProject.projectDir}/repositories.gradle" - apply plugin: 'java' - - repositories { - mavenLocal() - - mavenCentral() - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://jitpack.io' } - } - - tasks.withType(JavaCompile) { - options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. - } +subprojects { //Properties that you need to compile your project (The application) + pluginManager.withPlugin('java') { + java { + toolchain { + languageVersion = of(8) + } + } - jar { - // This makes the JAR's SHA-256 hash repeatable. - preserveFileTimestamps = false - reproducibleFileOrder = true - duplicatesStrategy = DuplicatesStrategy.EXCLUDE + tasks.withType(JavaCompile).configureEach { + options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. + } } -} -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' - -sourceSets { - main { - resources { - srcDir rootProject.file("config/dev") + configurations.matching { it.name.endsWith("Classpath") }.configureEach { + resolutionStrategy { + dependencySubstitution { + substitute module('com.fasterxml.jackson.module:jackson-module-kotlin') with module("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.7") + substitute module('org.gradle:gradle-tooling-api') with module("org.gradle:gradle-tooling-api:${gradle.gradleVersion}") + } } } } + //Module dependencis dependencies { - // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" + cordaBootstrapper "$corda_release_group:corda-node-api:$corda_release_version" + cordaBootstrapper "org.slf4j:slf4j-simple:$slf4j_version" + corda "$corda_release_group:corda:$corda_release_version" // CorDapp dependencies. - cordapp project(":workflows") + cordapp project(':workflows') - cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}" - cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version" + cordaDriver "$corda_release_group:corda-shell:$corda_release_version" } - -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { +tasks.register('deployNodes', Cordform) { /* This property will load the CorDapps to each of the node by default, including the Notary. You can find them * in the cordapps folder of the node at build/nodes/Notary/cordapps. However, the notary doesn't really understand * the notion of cordapps. In production, Notary does not need cordapps as well. This is just a short cut to load * the Corda network bootstrapper. */ nodeDefaults { - projectCordapp { - deploy = false - } cordapp project(':workflows') runSchemaMigration = true //This configuration is for any CorDapps with custom schema, We will leave this as true to avoid //problems for developers who are not familiar with Corda. If you are not using custom schemas, you can change @@ -105,7 +60,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10006") adminAddress("localhost:10046") } - cordapps = [] rpcUsers = [[ user: "user1", "password": "test", "permissions": ["StartFlow.com.flowhttp.HttpCallFlow"]]] } } diff --git a/Basic/flow-http-access/gradle.properties b/Basic/flow-http-access/gradle.properties index 672acb72..ed2bebe6 100644 --- a/Basic/flow-http-access/gradle.properties +++ b/Basic/flow-http-access/gradle.properties @@ -1,3 +1,26 @@ +org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -Dfile.encoding=UTF-8 +org.gradle.java.installations.auto-download=false +org.gradle.caching=false +kotlin.incremental=false + name=Flow Http Access group=com.flowhttp version=1.0 + +okhttp_version=3.5.0 + +# Artifactory +artifactoryContextUrl = https://software.r3.com/artifactory + +corda_release_group=net.corda +corda_core_group=net.corda +corda_release_version=4.9 +corda_platform_version=10 +corda_gradle_plugins_version=5.1.0-RC01 +junit_version=4.13.2 +quasar_version=0.7.14_r3 +log4j_version=2.17.1 +slf4j_version=1.7.30 +netty_version=4.1.22.Final + +spring_boot_version=2.3.12.RELEASE diff --git a/Basic/flow-http-access/gradle/wrapper/gradle-wrapper.jar b/Basic/flow-http-access/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7a3265ee..00000000 Binary files a/Basic/flow-http-access/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Basic/flow-http-access/gradle/wrapper/gradle-wrapper.properties b/Basic/flow-http-access/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 674bdda0..00000000 --- a/Basic/flow-http-access/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/Basic/flow-http-access/gradlew b/Basic/flow-http-access/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/Basic/flow-http-access/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -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. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -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. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/Basic/flow-http-access/gradlew.bat b/Basic/flow-http-access/gradlew.bat deleted file mode 100644 index f9553162..00000000 --- a/Basic/flow-http-access/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -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. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -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. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/Basic/flow-http-access/lib/README.txt b/Basic/flow-http-access/lib/README.txt deleted file mode 100644 index b0592c95..00000000 --- a/Basic/flow-http-access/lib/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -The Quasar.jar in this directory is for runtime instrumentation of classes by Quasar. - -When running corda outside of the given gradle building you must add the following flag with the -correct path to your call to Java: - - java -javaagent:path-to-quasar-jar.jar ... - -See the Quasar docs for more information: http://docs.paralleluniverse.co/quasar/ \ No newline at end of file diff --git a/Basic/flow-http-access/lib/quasar.jar b/Basic/flow-http-access/lib/quasar.jar deleted file mode 100644 index 7282d8c8..00000000 Binary files a/Basic/flow-http-access/lib/quasar.jar and /dev/null differ diff --git a/Basic/flow-http-access/repositories.gradle b/Basic/flow-http-access/repositories.gradle deleted file mode 100644 index 3198e5c6..00000000 --- a/Basic/flow-http-access/repositories.gradle +++ /dev/null @@ -1,8 +0,0 @@ -repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://jitpack.io' } - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://repo.gradle.org/gradle/libs-releases' } -} diff --git a/Basic/flow-http-access/settings.gradle b/Basic/flow-http-access/settings.gradle index 768052d4..1acec812 100644 --- a/Basic/flow-http-access/settings.gradle +++ b/Basic/flow-http-access/settings.gradle @@ -1 +1,33 @@ -include 'workflows' \ No newline at end of file +pluginManagement { + repositories { + maven { + url "$artifactoryContextUrl/corda-releases" + } + gradlePluginPortal() + } + + plugins { + id 'net.corda.plugins.cordapp' version corda_gradle_plugins_version + id 'net.corda.plugins.cordformation' version corda_gradle_plugins_version + id 'net.corda.plugins.quasar-utils' version corda_gradle_plugins_version + id 'org.springframework.boot' version spring_boot_version + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + maven { + url "$artifactoryContextUrl/corda" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://repo.gradle.org/gradle/libs-releases' + } + } +} + +include 'workflows' diff --git a/Basic/flow-http-access/workflows/build.gradle b/Basic/flow-http-access/workflows/build.gradle index 7a5ffa3c..000b3371 100644 --- a/Basic/flow-http-access/workflows/build.gradle +++ b/Basic/flow-http-access/workflows/build.gradle @@ -1,9 +1,7 @@ -apply plugin: 'java' -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' - -apply from: '../repositories.gradle' +plugins { + id 'net.corda.plugins.cordapp' + id 'net.corda.plugins.quasar-utils' +} cordapp { targetPlatformVersion corda_platform_version.toInteger() @@ -17,37 +15,16 @@ cordapp { } dependencies { - testCompile "junit:junit:$junit_version" + testImplementation "junit:junit:$junit_version" // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaCompile "$corda_release_group:corda-jackson:$corda_release_version" - cordaCompile "$corda_release_group:corda-rpc:$corda_release_version" - cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" + cordaProvided "$corda_core_group:corda-core:$corda_release_version" + cordaProvided "$corda_release_group:corda-jackson:$corda_release_version" + cordaProvided "$corda_release_group:corda-rpc:$corda_release_version" - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" - cordaRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" + testImplementation "$corda_release_group:corda-node-driver:$corda_release_version" + testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" // OkHTTP: A simple HTTP library. - compile "com.squareup.okhttp3:okhttp:$okhttp_version" -} - -jar { - // CorDapps do not configure the Node's logging. - exclude '**/log4j2*.xml' -} - -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { - node { - name "O=PartyA,L=London,C=GB" - p2pPort 10005 - rpcSettings { - address("localhost:10006") - adminAddress("localhost:10046") - } - cordapps = [] - runSchemaMigration = true - rpcUsers = [[ user: "user1", "password": "test", "permissions": ["StartFlow.com.flowhttp.HttpCallFlow"]]] - } + implementation "com.squareup.okhttp3:okhttp:$okhttp_version" } diff --git a/Basic/flow-http-access/workflows/src/main/java/net/corda/samples/flowhttp/HttpCallFlow.java b/Basic/flow-http-access/workflows/src/main/java/net/corda/samples/flowhttp/HttpCallFlow.java index 16631c11..4c170c02 100644 --- a/Basic/flow-http-access/workflows/src/main/java/net/corda/samples/flowhttp/HttpCallFlow.java +++ b/Basic/flow-http-access/workflows/src/main/java/net/corda/samples/flowhttp/HttpCallFlow.java @@ -32,13 +32,13 @@ public String call() throws FlowException { // currently support suspending to await an HTTP call's response // 2. The request must be idempotent. If the flow fails and has to // restart from a checkpoint, the request will also be replayed - String value = null; - Response httpResponse = null; + String value; + Response httpResponse; try { httpResponse = new OkHttpClient().newCall(httpRequest).execute(); value = httpResponse.body().string(); } catch (IOException e) { - e.printStackTrace(); + throw new FlowException(e.getMessage(), e); } return value; } diff --git a/Basic/flow-http-access/workflows/src/main/resources/log4j2-test.xml b/Basic/flow-http-access/workflows/src/main/resources/log4j2-test.xml deleted file mode 100644 index 50038860..00000000 --- a/Basic/flow-http-access/workflows/src/main/resources/log4j2-test.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - build/logs - flowhttp-${hostName} - - - - - - - [%-5level] %d{HH:mm:ss.SSS} [%t] %c{1}.%M - %msg%n - > - - - - - - - - - - - - - - - - - diff --git a/Basic/gradle/wrapper/gradle-wrapper.jar b/Basic/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..41d9927a Binary files /dev/null and b/Basic/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Basic/flow-database-access/gradle/wrapper/gradle-wrapper.properties b/Basic/gradle/wrapper/gradle-wrapper.properties similarity index 92% rename from Basic/flow-database-access/gradle/wrapper/gradle-wrapper.properties rename to Basic/gradle/wrapper/gradle-wrapper.properties index 674bdda0..aa991fce 100644 --- a/Basic/flow-database-access/gradle/wrapper/gradle-wrapper.properties +++ b/Basic/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/Basic/gradlew b/Basic/gradlew new file mode 100755 index 00000000..1b6c7873 --- /dev/null +++ b/Basic/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original 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 POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# 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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +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. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + 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. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/Basic/cordapp-example/gradlew.bat b/Basic/gradlew.bat similarity index 66% rename from Basic/cordapp-example/gradlew.bat rename to Basic/gradlew.bat index f9553162..107acd32 100644 --- a/Basic/cordapp-example/gradlew.bat +++ b/Basic/gradlew.bat @@ -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 @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @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 if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/Basic/ping-pong/README.md b/Basic/ping-pong/README.md index e61f1985..f2710731 100644 --- a/Basic/ping-pong/README.md +++ b/Basic/ping-pong/README.md @@ -63,7 +63,7 @@ For development environment setup, please refer to: [Setup Guide](https://docs.c Open a terminal and go to the project root directory and type: (to deploy the nodes using bootstrapper) ``` -./gradlew clean deployNodes +../gradlew clean deployNodes ``` Then type: (to run the nodes) ``` diff --git a/Basic/ping-pong/build.gradle b/Basic/ping-pong/build.gradle index ed80ed98..65bc1cbc 100644 --- a/Basic/ping-pong/build.gradle +++ b/Basic/ping-pong/build.gradle @@ -1,107 +1,46 @@ -buildscript { //properties that you need to build the project +import static org.gradle.jvm.toolchain.JavaLanguageVersion.of +import net.corda.plugins.Cordform - Properties constants = new Properties() - file("$projectDir/../constants.properties").withInputStream { constants.load(it) } - - ext { - corda_release_group = constants.getProperty("cordaReleaseGroup") - corda_core_release_group = constants.getProperty("cordaCoreReleaseGroup") - corda_release_version = constants.getProperty("cordaVersion") - corda_core_release_version = constants.getProperty("cordaCoreVersion") - corda_gradle_plugins_version = constants.getProperty("gradlePluginsVersion") - kotlin_version = constants.getProperty("kotlinVersion") - junit_version = constants.getProperty("junitVersion") - quasar_version = constants.getProperty("quasarVersion") - log4j_version = constants.getProperty("log4jVersion") - slf4j_version = constants.getProperty("slf4jVersion") - corda_platform_version = constants.getProperty("platformVersion").toInteger() - //springboot - spring_boot_version = '2.0.2.RELEASE' - spring_boot_gradle_plugin_version = '2.0.2.RELEASE' - } - - repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://software.r3.com/artifactory/corda-releases' } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" - classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version" - classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version" - classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version" - } +plugins { + id 'net.corda.plugins.cordformation' + id 'base' } -allprojects { //Properties that you need to compile your project (The application) - apply from: "${rootProject.projectDir}/repositories.gradle" - apply plugin: 'kotlin' - - repositories { - mavenLocal() - - mavenCentral() - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://jitpack.io' } - } - - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { - kotlinOptions { - languageVersion = "1.2" - apiVersion = "1.2" - jvmTarget = "1.8" - javaParameters = true // Useful for reflection. +subprojects { //Properties that you need to compile your project (The application) + pluginManager.withPlugin('java') { + java { + toolchain { + languageVersion = of(8) + } } - } - - jar { - // This makes the JAR's SHA-256 hash repeatable. - preserveFileTimestamps = false - reproducibleFileOrder = true - } -} -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' - -sourceSets { - main { - resources { - srcDir rootProject.file("config/dev") + tasks.withType(JavaCompile).configureEach { + options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. } } } //Module dependencis dependencies { - // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaRuntime "$corda_release_group:corda-node-api:$corda_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" + cordaBootstrapper "$corda_release_group:corda-node-api:$corda_release_version" + cordaBootstrapper "org.slf4j:slf4j-simple:$slf4j_version" + corda "$corda_release_group:corda:$corda_release_version" // CorDapp dependencies. - cordapp project(":workflows") + cordapp project(':workflows') - cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}" - cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version" + cordaDriver "$corda_release_group:corda-shell:$corda_release_version" } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { +tasks.register('deployNodes', Cordform) { /* This property will load the CorDapps to each of the node by default, including the Notary. You can find them * in the cordapps folder of the node at build/nodes/Notary/cordapps. However, the notary doesn't really understand * the notion of cordapps. In production, Notary does not need cordapps as well. This is just a short cut to load * the Corda network bootstrapper. */ nodeDefaults { - projectCordapp { - deploy = false - } cordapp project(':workflows') + rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] runSchemaMigration = true //This configuration is for any CorDapps with custom schema, We will leave this as true to avoid //problems for developers who are not familiar with Corda. If you are not using custom schemas, you can change //it to false for quicker project compiling time. @@ -114,6 +53,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10003") adminAddress("localhost:10043") } + rpcUsers = [] } node { name "O=PartyA,L=London,C=GB" @@ -122,8 +62,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10006") adminAddress("localhost:10046") } - runSchemaMigration = true - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] } node { name "O=PartyB,L=New York,C=US" @@ -132,7 +70,5 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10009") adminAddress("localhost:10049") } - runSchemaMigration = true - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] } } diff --git a/Basic/ping-pong/client/build.gradle b/Basic/ping-pong/client/build.gradle index ebb9c997..57ee88d6 100644 --- a/Basic/ping-pong/client/build.gradle +++ b/Basic/ping-pong/client/build.gradle @@ -1,30 +1,28 @@ -apply plugin: 'org.springframework.boot' - -sourceSets { - main { - resources { - srcDir rootProject.file("config/dev") - } - } +plugins { + id 'org.springframework.boot' + id 'java' } dependencies { // Corda dependencies. - compile "$corda_release_group:corda-rpc:$corda_release_version" + implementation "$corda_release_group:corda-rpc:$corda_release_version" // CorDapp dependencies. - compile project(":workflows") - compile("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") { - exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" + implementation project(':workflows') + implementation("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' } - compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - compile "org.apache.logging.log4j:log4j-web:${log4j_version}" - compile "org.slf4j:jul-to-slf4j:$slf4j_version" + runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" + runtimeOnly "org.apache.logging.log4j:log4j-web:$log4j_version" } -task pingPartyBJava(type: JavaExec) { +/* The Client is the communication channel between the external and the node. This task will help you immediately + * execute your rpc methods in the main method of the client.kt. You can somewhat see this as a quick test of making + * RPC calls to your nodes. + */ +tasks.register('pingPartyBKotlin', JavaExec) { + dependsOn assemble classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.samples.pingpong.Client' + main = 'net.corda.samples.pingpong.ClientKt' args 'localhost:10006', 'O=PartyB,L=New York,C=US' - -} \ No newline at end of file +} diff --git a/Basic/ping-pong/gradle.properties b/Basic/ping-pong/gradle.properties index 9bf84472..2e3ad043 100644 --- a/Basic/ping-pong/gradle.properties +++ b/Basic/ping-pong/gradle.properties @@ -1,3 +1,24 @@ +org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -Dfile.encoding=UTF-8 +org.gradle.java.installations.auto-download=false +org.gradle.caching=false +kotlin.incremental=false + name=ping-pong Cordapp group=com.pingpong version=1.0 + +# Artifactory +artifactoryContextUrl = https://software.r3.com/artifactory + +corda_release_group=net.corda +corda_core_group=net.corda +corda_release_version=4.9 +corda_platform_version=10 +corda_gradle_plugins_version=5.1.0-RC01 +junit_version=4.13.2 +quasar_version=0.7.14_r3 +log4j_version=2.17.1 +slf4j_version=1.7.30 +netty_version=4.1.22.Final + +spring_boot_version=2.3.12.RELEASE diff --git a/Basic/ping-pong/gradle/wrapper/gradle-wrapper.jar b/Basic/ping-pong/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7a3265ee..00000000 Binary files a/Basic/ping-pong/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Basic/ping-pong/gradle/wrapper/gradle-wrapper.properties b/Basic/ping-pong/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 674bdda0..00000000 --- a/Basic/ping-pong/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/Basic/ping-pong/gradlew b/Basic/ping-pong/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/Basic/ping-pong/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -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. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -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. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/Basic/ping-pong/gradlew.bat b/Basic/ping-pong/gradlew.bat deleted file mode 100644 index f9553162..00000000 --- a/Basic/ping-pong/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -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. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -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. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/Basic/ping-pong/lib/README.txt b/Basic/ping-pong/lib/README.txt deleted file mode 100644 index b0592c95..00000000 --- a/Basic/ping-pong/lib/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -The Quasar.jar in this directory is for runtime instrumentation of classes by Quasar. - -When running corda outside of the given gradle building you must add the following flag with the -correct path to your call to Java: - - java -javaagent:path-to-quasar-jar.jar ... - -See the Quasar docs for more information: http://docs.paralleluniverse.co/quasar/ \ No newline at end of file diff --git a/Basic/ping-pong/lib/quasar.jar b/Basic/ping-pong/lib/quasar.jar deleted file mode 100644 index 7282d8c8..00000000 Binary files a/Basic/ping-pong/lib/quasar.jar and /dev/null differ diff --git a/Basic/ping-pong/repositories.gradle b/Basic/ping-pong/repositories.gradle deleted file mode 100644 index 117d8a1e..00000000 --- a/Basic/ping-pong/repositories.gradle +++ /dev/null @@ -1,8 +0,0 @@ -repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://jitpack.io' } - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://repo.gradle.org/gradle/libs-releases' } -} \ No newline at end of file diff --git a/Basic/ping-pong/settings.gradle b/Basic/ping-pong/settings.gradle index 0e011d93..b6f31a9a 100644 --- a/Basic/ping-pong/settings.gradle +++ b/Basic/ping-pong/settings.gradle @@ -1,2 +1,34 @@ +pluginManagement { + repositories { + maven { + url "$artifactoryContextUrl/corda-releases" + } + gradlePluginPortal() + } + + plugins { + id 'net.corda.plugins.cordapp' version corda_gradle_plugins_version + id 'net.corda.plugins.cordformation' version corda_gradle_plugins_version + id 'net.corda.plugins.quasar-utils' version corda_gradle_plugins_version + id 'org.springframework.boot' version spring_boot_version + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + maven { + url "$artifactoryContextUrl/corda" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://repo.gradle.org/gradle/libs-releases' + } + } +} + include 'workflows' -include 'client' \ No newline at end of file +include 'client' diff --git a/Basic/ping-pong/workflows/build.gradle b/Basic/ping-pong/workflows/build.gradle index a555eff6..c79effd7 100644 --- a/Basic/ping-pong/workflows/build.gradle +++ b/Basic/ping-pong/workflows/build.gradle @@ -1,11 +1,13 @@ -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.quasar-utils' +plugins { + id 'net.corda.plugins.cordapp' + id 'net.corda.plugins.quasar-utils' +} cordapp { - targetPlatformVersion corda_platform_version - minimumPlatformVersion corda_platform_version + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion corda_platform_version.toInteger() workflow { - name "Pingpng Flows" + name "PingPong Flows" vendor "Corda Open Source" licence "Apache License, Version 2.0" versionId 1 @@ -13,43 +15,29 @@ cordapp { } sourceSets { - main { - resources { - srcDir rootProject.file("config/dev") - } - } - test { - resources { - srcDir rootProject.file("config/test") - } - } integrationTest { - kotlin { + java { compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output - srcDir file('src/integrationTest/kotlin') + srcDir file('src/integrationTest/java') } } } configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime + integrationTestImplementation.extendsFrom testImplementation + integrationTestRuntimeOnly.extendsFrom testRuntimeOnly } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" - testCompile "junit:junit:$junit_version" + testImplementation "$corda_release_group:corda-node-driver:$corda_release_version" + testImplementation "junit:junit:$junit_version" // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" - + cordaProvided "$corda_core_group:corda-core:$corda_release_version" } -task integrationTest(type: Test, dependsOn: []) { +tasks.register('integrationTest', Test) { testClassesDirs = sourceSets.integrationTest.output.classesDirs classpath = sourceSets.integrationTest.runtimeClasspath -} \ No newline at end of file +} diff --git a/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Ping.java b/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Ping.java index b70ef4ed..c02eb98f 100644 --- a/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Ping.java +++ b/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Ping.java @@ -21,7 +21,9 @@ public Void call() throws FlowException { final FlowSession counterpartySession = initiateFlow(counterparty); final UntrustworthyData counterpartyData = counterpartySession.sendAndReceive(String.class, "ping"); counterpartyData.unwrap( msg -> { - assert(msg.equals("pong")); + if (!msg.equals("pong")) { + throw new IllegalArgumentException("Invalid message: " + msg); + } return true; }); return null; diff --git a/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Pong.java b/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Pong.java index 972b149e..fd0d9e83 100644 --- a/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Pong.java +++ b/Basic/ping-pong/workflows/src/main/java/net/corda/samples/pingpong/flows/Pong.java @@ -22,7 +22,9 @@ public Pong(FlowSession counterpartySession) { public Void call() throws FlowException { UntrustworthyData counterpartyData = counterpartySession.receive(String.class); counterpartyData.unwrap(msg -> { - assert (msg.equals("ping")); + if (!msg.equals("ping")) { + throw new IllegalArgumentException("Invalid message: " + msg); + } return true; }); counterpartySession.send("pong"); diff --git a/Basic/settings.gradle b/Basic/settings.gradle new file mode 100644 index 00000000..1b93b12f --- /dev/null +++ b/Basic/settings.gradle @@ -0,0 +1,5 @@ +includeBuild 'cordapp-example' +includeBuild 'flow-database-access' +includeBuild 'flow-http-access' +includeBuild 'ping-pong' +includeBuild 'tutorial-applestamp' diff --git a/Basic/tutorial-applestamp/build.gradle b/Basic/tutorial-applestamp/build.gradle index b6e91906..bbb031b9 100644 --- a/Basic/tutorial-applestamp/build.gradle +++ b/Basic/tutorial-applestamp/build.gradle @@ -1,105 +1,55 @@ -buildscript {//properties that you need to build the project - Properties constants = new Properties() - file("$projectDir/../constants.properties").withInputStream { constants.load(it) } +import static org.gradle.jvm.toolchain.JavaLanguageVersion.of +import net.corda.plugins.Cordform - ext { - corda_release_group = constants.getProperty("cordaReleaseGroup") - corda_core_release_group = constants.getProperty("cordaCoreReleaseGroup") - corda_release_version = constants.getProperty("cordaVersion") - corda_core_release_version = constants.getProperty("cordaCoreVersion") - corda_gradle_plugins_version = constants.getProperty("gradlePluginsVersion") - kotlin_version = constants.getProperty("kotlinVersion") - junit_version = constants.getProperty("junitVersion") - quasar_version = constants.getProperty("quasarVersion") - log4j_version = constants.getProperty("log4jVersion") - slf4j_version = constants.getProperty("slf4jVersion") - corda_platform_version = constants.getProperty("platformVersion").toInteger() - //springboot - spring_boot_version = '2.0.2.RELEASE' - spring_boot_gradle_plugin_version = '2.0.2.RELEASE' - } - - repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://software.r3.com/artifactory/corda-releases' } - } - - dependencies { - classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" - classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version" - classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version" - classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version" - } +plugins { + id 'net.corda.plugins.cordformation' + id 'base' } -allprojects {//Properties that you need to compile your project (The application) - apply from: "${rootProject.projectDir}/repositories.gradle" - apply plugin: 'java' - - repositories { - mavenLocal() - - mavenCentral() - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://jitpack.io' } - } - - tasks.withType(JavaCompile) { - options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. - } +subprojects { //Properties that you need to compile your project (The application) + pluginManager.withPlugin('java') { + java { + toolchain { + languageVersion = of(8) + } + } - jar { - // This makes the JAR's SHA-256 hash repeatable. - preserveFileTimestamps = false - reproducibleFileOrder = true - duplicatesStrategy = DuplicatesStrategy.EXCLUDE + tasks.withType(JavaCompile).configureEach { + options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. + } } -} - -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' -sourceSets { - main { - resources { - srcDir rootProject.file("config/dev") + configurations.matching { it.name.endsWith("Classpath") }.configureEach { + resolutionStrategy { + dependencySubstitution { + substitute module('com.fasterxml.jackson.module:jackson-module-kotlin') with module("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.7") + substitute module('org.gradle:gradle-tooling-api') with module("org.gradle:gradle-tooling-api:${gradle.gradleVersion}") + } } } } + //Module dependencis dependencies { - // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" + cordaBootstrapper "$corda_release_group:corda-node-api:$corda_release_version" + cordaBootstrapper "org.slf4j:slf4j-simple:$slf4j_version" + corda "$corda_release_group:corda:$corda_release_version" // CorDapp dependencies. - cordapp project(":workflows") - cordapp project(":contracts") - - cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}" - cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version" + cordapp project(':workflows') + cordapp project(':contracts') } - -//Task to deploy the nodes in order to bootstrap a network -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { - +tasks.register('deployNodes', Cordform) { /* This property will load the CorDapps to each of the node by default, including the Notary. You can find them * in the cordapps folder of the node at build/nodes/Notary/cordapps. However, the notary doesn't really understand * the notion of cordapps. In production, Notary does not need cordapps as well. This is just a short cut to load * the Corda network bootstrapper. */ nodeDefaults { - projectCordapp { - deploy = false - } cordapp project(':contracts') cordapp project(':workflows') + rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] runSchemaMigration = true //This configuration is for any CorDapps with custom schema, We will leave this as true to avoid //problems for developers who are not familiar with Corda. If you are not using custom schemas, you can change //it to false for quicker project compiling time. @@ -112,6 +62,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10003") adminAddress("localhost:10043") } + rpcUsers = [] } node { name "O=AppleFarm,L=London,C=GB" @@ -120,7 +71,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10006") adminAddress("localhost:10046") } - rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] } node { name "O=Peter,L=New York,C=US" @@ -129,6 +79,5 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10009") adminAddress("localhost:10049") } - rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] } } diff --git a/Basic/tutorial-applestamp/contracts/build.gradle b/Basic/tutorial-applestamp/contracts/build.gradle index b23fdd2b..c505e37c 100644 --- a/Basic/tutorial-applestamp/contracts/build.gradle +++ b/Basic/tutorial-applestamp/contracts/build.gradle @@ -1,9 +1,10 @@ -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' +plugins { + id 'net.corda.plugins.cordapp' +} cordapp { - targetPlatformVersion corda_platform_version - minimumPlatformVersion corda_platform_version + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion corda_platform_version.toInteger() contract { name "4.8LTS Tutorial Contracts" vendor "Corda Open Source" @@ -12,24 +13,7 @@ cordapp { } } -sourceSets { - main{ - java { - srcDir 'src/main/java' - java.outputDir = file('bin/main') - } - } - test{ - java{ - srcDir 'src/test/java' - java.outputDir = file('bin/test') - } - } -} - dependencies { - // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" -} \ No newline at end of file + cordaProvided "$corda_core_group:corda-core:$corda_release_version" + testImplementation "$corda_release_group:corda-node-driver:$corda_release_version" +} diff --git a/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/AppleStamp.java b/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/AppleStamp.java index bd899291..ca73cf82 100644 --- a/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/AppleStamp.java +++ b/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/AppleStamp.java @@ -16,15 +16,15 @@ public class AppleStamp implements LinearState { //Private Variables - private String stampDesc; //For example: "One stamp can exchange for a basket of HoneyCrispy Apple" - private Party issuer; //The person who issued the stamp - private Party holder; //The person who currently owns the stamp + private final String stampDesc; //For example: "One stamp can exchange for a basket of HoneyCrispy Apple" + private final Party issuer; //The person who issued the stamp + private final Party holder; //The person who currently owns the stamp //LinearState required variable. - private UniqueIdentifier linearID; + private final UniqueIdentifier linearID; //ALL Corda State required parameter to indicate storing parties - private List participants; + private final List participants; //Constructor Tips: Command + N in IntelliJ can auto generate constructor. @ConstructorForDeserialization diff --git a/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/BasketOfApples.java b/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/BasketOfApples.java index 869e1d7e..104f3079 100644 --- a/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/BasketOfApples.java +++ b/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/BasketOfApples.java @@ -15,13 +15,13 @@ public class BasketOfApples implements ContractState { //Private Variables - private String description; //Brand or type - private Party farm; //Origin of the apple - private Party owner; //The person who exchange the basket of apple with the stamp. - private int weight; + private final String description; //Brand or type + private final Party farm; //Origin of the apple + private final Party owner; //The person who exchange the basket of apple with the stamp. + private final int weight; //ALL Corda State required parameter to indicate storing parties - private List participants; + private final List participants; //Constructors //Basket of Apple creation. Only farm name is stored. diff --git a/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/TemplateState.java b/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/TemplateState.java index a73bc4f0..9bb4f8a9 100644 --- a/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/TemplateState.java +++ b/Basic/tutorial-applestamp/contracts/src/main/java/com/tutorial/states/TemplateState.java @@ -16,9 +16,9 @@ public class TemplateState implements ContractState { //private variables - private String msg; - private Party sender; - private Party receiver; + private final String msg; + private final Party sender; + private final Party receiver; /* Constructor of your Corda state */ public TemplateState(String msg, Party sender, Party receiver) { diff --git a/Basic/tutorial-applestamp/contracts/src/test/java/com/tutorial/contracts/StateTests.java b/Basic/tutorial-applestamp/contracts/src/test/java/com/tutorial/contracts/StateTests.java index 61c570e2..e0c08919 100644 --- a/Basic/tutorial-applestamp/contracts/src/test/java/com/tutorial/contracts/StateTests.java +++ b/Basic/tutorial-applestamp/contracts/src/test/java/com/tutorial/contracts/StateTests.java @@ -5,25 +5,27 @@ import net.corda.core.identity.Party; import org.junit.Test; +import static org.junit.Assert.assertSame; + public class StateTests { //Mock State test check for if the state has correct parameters type @Test public void hasFieldOfCorrectType() throws NoSuchFieldException { TemplateState.class.getDeclaredField("msg"); - assert (TemplateState.class.getDeclaredField("msg").getType().equals(String.class)); + assertSame(String.class, TemplateState.class.getDeclaredField("msg").getType()); } @Test public void AppleStampStateHasFieldOfCorrectType() throws NoSuchFieldException { AppleStamp.class.getDeclaredField("stampDesc"); - assert (AppleStamp.class.getDeclaredField("stampDesc").getType().equals(String.class)); + assertSame(String.class, AppleStamp.class.getDeclaredField("stampDesc").getType()); AppleStamp.class.getDeclaredField("issuer"); - assert (AppleStamp.class.getDeclaredField("issuer").getType().equals(Party.class)); + assertSame(Party.class, AppleStamp.class.getDeclaredField("issuer").getType()); AppleStamp.class.getDeclaredField("holder"); - assert (AppleStamp.class.getDeclaredField("issuer").getType().equals(Party.class)); + assertSame(Party.class, AppleStamp.class.getDeclaredField("issuer").getType()); } } \ No newline at end of file diff --git a/Basic/tutorial-applestamp/gradle.properties b/Basic/tutorial-applestamp/gradle.properties index ef7e526c..bc18245a 100644 --- a/Basic/tutorial-applestamp/gradle.properties +++ b/Basic/tutorial-applestamp/gradle.properties @@ -1,3 +1,24 @@ +org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -Dfile.encoding=UTF-8 +org.gradle.java.installations.auto-download=false +org.gradle.caching=false +kotlin.incremental=false + name=Test group=com.tutorial -version=0.1 \ No newline at end of file +version=0.1 + +# Artifactory +artifactoryContextUrl = https://software.r3.com/artifactory + +corda_release_group=net.corda +corda_core_group=net.corda +corda_release_version=4.9 +corda_platform_version=10 +corda_gradle_plugins_version=5.1.0-RC01 +junit_version=4.13.2 +quasar_version=0.7.14_r3 +log4j_version=2.17.1 +slf4j_version=1.7.30 +netty_version=4.1.22.Final + +spring_boot_version=2.3.12.RELEASE diff --git a/Basic/tutorial-applestamp/gradle/wrapper/gradle-wrapper.jar b/Basic/tutorial-applestamp/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 99340b4a..00000000 Binary files a/Basic/tutorial-applestamp/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Basic/tutorial-applestamp/gradle/wrapper/gradle-wrapper.properties b/Basic/tutorial-applestamp/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 0188225a..00000000 --- a/Basic/tutorial-applestamp/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -#Fri Aug 25 12:50:39 BST 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip - diff --git a/Basic/tutorial-applestamp/gradlew b/Basic/tutorial-applestamp/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/Basic/tutorial-applestamp/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -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. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -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. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/Basic/tutorial-applestamp/gradlew.bat b/Basic/tutorial-applestamp/gradlew.bat deleted file mode 100644 index f9553162..00000000 --- a/Basic/tutorial-applestamp/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -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. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -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. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/Basic/tutorial-applestamp/repositories.gradle b/Basic/tutorial-applestamp/repositories.gradle deleted file mode 100644 index 3198e5c6..00000000 --- a/Basic/tutorial-applestamp/repositories.gradle +++ /dev/null @@ -1,8 +0,0 @@ -repositories { - mavenLocal() - mavenCentral() - - maven { url 'https://jitpack.io' } - maven { url 'https://software.r3.com/artifactory/corda' } - maven { url 'https://repo.gradle.org/gradle/libs-releases' } -} diff --git a/Basic/tutorial-applestamp/settings.gradle b/Basic/tutorial-applestamp/settings.gradle index 2514aca2..f69c5221 100644 --- a/Basic/tutorial-applestamp/settings.gradle +++ b/Basic/tutorial-applestamp/settings.gradle @@ -1,3 +1,34 @@ +pluginManagement { + repositories { + maven { + url "$artifactoryContextUrl/corda-releases" + } + gradlePluginPortal() + } + + plugins { + id 'net.corda.plugins.cordapp' version corda_gradle_plugins_version + id 'net.corda.plugins.cordformation' version corda_gradle_plugins_version + id 'net.corda.plugins.quasar-utils' version corda_gradle_plugins_version + id 'org.springframework.boot' version spring_boot_version + } +} + +dependencyResolutionManagement { + repositories { + mavenCentral() + maven { + url "$artifactoryContextUrl/corda" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://repo.gradle.org/gradle/libs-releases' + } + } +} + include 'workflows' include 'contracts' -include 'clients' \ No newline at end of file diff --git a/Basic/tutorial-applestamp/workflows/build.gradle b/Basic/tutorial-applestamp/workflows/build.gradle index 44d454a0..6584651c 100644 --- a/Basic/tutorial-applestamp/workflows/build.gradle +++ b/Basic/tutorial-applestamp/workflows/build.gradle @@ -1,10 +1,11 @@ -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' +plugins { + id 'net.corda.plugins.cordapp' + id 'net.corda.plugins.quasar-utils' +} cordapp { - targetPlatformVersion corda_platform_version - minimumPlatformVersion corda_platform_version + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion corda_platform_version.toInteger() workflow { name "4.8LTS Tutorial Flows" vendor "Corda Open Source" @@ -14,20 +15,7 @@ cordapp { } sourceSets { - main { - java { - srcDir 'src/main/java' - java.outputDir = file('bin/main') - } - resources { - srcDir rootProject.file("config/dev") - } - } test { - java { - srcDir 'src/test/java' - java.outputDir = file('bin/main') - } resources { srcDir rootProject.file("config/test") } @@ -42,23 +30,23 @@ sourceSets { } configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime + integrationTestImplementation.extendsFrom testImplementation + integrationTestRuntimeOnly.extendsFrom testRuntimeOnly } dependencies { - testCompile "junit:junit:$junit_version" + testImplementation "junit:junit:$junit_version" // Corda dependencies. - cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" - cordaRuntime "$corda_release_group:corda:$corda_release_version" - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" + cordaProvided "$corda_core_group:corda-core:$corda_release_version" + testImplementation "$corda_release_group:corda-node-driver:$corda_release_version" + testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" // CorDapp dependencies. - cordapp project(":contracts") + cordapp project(':contracts') } -task integrationTest(type: Test, dependsOn: []) { +tasks.register('integrationTest', Test) { testClassesDirs = sourceSets.integrationTest.output.classesDirs classpath = sourceSets.integrationTest.runtimeClasspath -} \ No newline at end of file +}