diff --git a/examples/cordapp-sweepstake/cordapp/README.md b/examples/cordapp-sweepstake/README.md similarity index 88% rename from examples/cordapp-sweepstake/cordapp/README.md rename to examples/cordapp-sweepstake/README.md index be230961..a5784038 100644 --- a/examples/cordapp-sweepstake/cordapp/README.md +++ b/examples/cordapp-sweepstake/README.md @@ -22,16 +22,15 @@ See https://docs.corda.net/getting-set-up.html. # Usage -From the root directory run the following commands: +Build and run the nodes: -* `./gradlew clean deployNodesX` -* `examples/cordapp-sweepstake/cordapp/build/nodes/runnodes` +* `./gradlew clean deployNodes` +* `./build/nodes/runnodes` -Once built, start the spring boot web application `WorldCupApplication` using the following command: +Start the Spring Boot web application `WorldCupApplication`: * `./gradlew runTournamentServer` -Navigate to the server -`http://localhost:8080/` +Navigate to the server http://localhost:8080 1. Click the 'Import players' button 2. Click the 'Create accounts and issue teams' button. Wait for the two columns on the table to be populated diff --git a/examples/cordapp-sweepstake/build.gradle b/examples/cordapp-sweepstake/build.gradle new file mode 100644 index 00000000..e202b006 --- /dev/null +++ b/examples/cordapp-sweepstake/build.gradle @@ -0,0 +1,131 @@ +buildscript { + ext { + corda_release_group = 'net.corda' + corda_release_version = '4.3-RC02' + corda_gradle_plugins_version = '4.0.42' + accounts_release_group = 'com.r3.corda.lib.accounts' + accounts_release_version = '1.0-RC04' + confidential_id_release_group = "com.r3.corda.lib.ci" + confidential_id_release_version = "1.0-RC03" + tokens_release_group = 'com.r3.corda.lib.tokens' + tokens_release_version = '1.0' + quasar_version = '0.7.10' + kotlin_version = '1.2.71' + spring_boot_version = '2.0.2.RELEASE' + junit_version = '4.12' + } + + repositories { + mavenCentral() + jcenter() + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + } + + 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:2.0.5.RELEASE") + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + jcenter() + mavenCentral() + maven { url "https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev" } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + //This is needed until the accounts sdk is official + maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib-dev" } + maven { url 'http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib' } + //Corda testing node-driver requires gradle-tooling-api + maven { url 'https://repo.gradle.org/gradle/libs-releases-local/' } + //Crash Shell dependencies are not published correctly in R3 repo + maven { url 'https://jitpack.io' } + } + + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + languageVersion = "1.2" + apiVersion = "1.2" + jvmTarget = "1.8" + javaParameters = true // Useful for reflection. + } + } +} + +wrapper { + gradleVersion = "4.10.2" + distributionType = Wrapper.DistributionType.ALL +} + +apply plugin: 'kotlin' +apply plugin: 'net.corda.plugins.cordapp' +apply plugin: 'net.corda.plugins.cordformation' +apply plugin: 'net.corda.plugins.quasar-utils' + +dependencies { + cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" + cordaCompile "$confidential_id_release_group:ci-workflows:$confidential_id_release_version" + + // CorDapp dependencies. + cordapp project(":contracts") + cordapp project(":workflows") + cordapp "$accounts_release_group:accounts-contracts:$accounts_release_version" + cordapp "$accounts_release_group:accounts-workflows:$accounts_release_version" + cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version" + // Tokens + cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version" + cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version" + cordapp "$tokens_release_group:tokens-money:$tokens_release_version" +} + +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { + + nodeDefaults { + projectCordapp { + deploy = false + } + cordapp project(':contracts') + cordapp project(':workflows') + cordapp("$accounts_release_group:accounts-contracts:$accounts_release_version") + cordapp("$accounts_release_group:accounts-workflows:$accounts_release_version") + cordapp("$confidential_id_release_group:ci-workflows:$confidential_id_release_version") + cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version" + cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version" + cordapp "$tokens_release_group:tokens-money:$tokens_release_version" + } + + node { + name "O=Notary,L=London,C=GB" + notary = [validating: false] + p2pPort 10000 + sshdPort 2222 + rpcSettings { + address("localhost:10001") + adminAddress("localhost:10002") + } + } + node { + name "O=TournamentA,L=London,C=GB" + p2pPort 10004 + sshdPort 2223 + rpcSettings { + address("localhost:10005") + adminAddress("localhost:10006") + } + rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] + } + node { + name "O=TournamentB,L=London,C=GB" + p2pPort 10008 + sshdPort 2224 + rpcSettings { + address("localhost:10009") + adminAddress("localhost:10010") + } + rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] + } +} diff --git a/examples/cordapp-sweepstake/states/build.gradle b/examples/cordapp-sweepstake/contracts/build.gradle similarity index 78% rename from examples/cordapp-sweepstake/states/build.gradle rename to examples/cordapp-sweepstake/contracts/build.gradle index 3443ac30..037e4b3f 100644 --- a/examples/cordapp-sweepstake/states/build.gradle +++ b/examples/cordapp-sweepstake/contracts/build.gradle @@ -3,7 +3,6 @@ apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.cordformation' apply plugin: 'net.corda.plugins.quasar-utils' - cordapp { info { name "World Cup Sweepstake - Contracts" @@ -17,9 +16,12 @@ cordapp { } dependencies { + // Kotlin. + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + // Corda. cordaCompile "$corda_release_group:corda-core:$corda_release_version" + cordaCompile "$accounts_release_group:accounts-contracts:$accounts_release_version" + cordaRuntime "$corda_release_group:corda:$corda_release_version" - // Kotlin. - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" } \ No newline at end of file diff --git a/examples/cordapp-sweepstake/states/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/contracts/TournamentContract.kt b/examples/cordapp-sweepstake/contracts/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/contracts/TournamentContract.kt similarity index 100% rename from examples/cordapp-sweepstake/states/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/contracts/TournamentContract.kt rename to examples/cordapp-sweepstake/contracts/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/contracts/TournamentContract.kt diff --git a/examples/cordapp-sweepstake/states/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/AccountGroup.kt b/examples/cordapp-sweepstake/contracts/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/AccountGroup.kt similarity index 100% rename from examples/cordapp-sweepstake/states/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/AccountGroup.kt rename to examples/cordapp-sweepstake/contracts/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/AccountGroup.kt diff --git a/examples/cordapp-sweepstake/states/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/TeamState.kt b/examples/cordapp-sweepstake/contracts/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/TeamState.kt similarity index 100% rename from examples/cordapp-sweepstake/states/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/TeamState.kt rename to examples/cordapp-sweepstake/contracts/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/contracts/states/TeamState.kt diff --git a/examples/cordapp-sweepstake/cordapp/build.gradle b/examples/cordapp-sweepstake/cordapp/build.gradle deleted file mode 100644 index e2ffe1cd..00000000 --- a/examples/cordapp-sweepstake/cordapp/build.gradle +++ /dev/null @@ -1,132 +0,0 @@ -apply plugin: 'kotlin' -apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' -apply plugin: 'net.corda.plugins.quasar-utils' - -cordapp { - info { - name "World Cup Sweepstake App" - vendor "Corda Open Source" - targetPlatformVersion 4 - minimumPlatformVersion 4 - } - signing { - enabled false - } -} - - -sourceSets { - integrationTest { - kotlin { - compileClasspath += main.output + test.output - runtimeClasspath += main.output + test.output - srcDir file('src/integrationTest/kotlin') - } - } -} - -configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime -} - - -dependencies { - // Accounts - cordapp project(":workflows") - cordapp project(":contracts") - cordapp project(":examples:cordapp-sweepstake:states") - cordapp project(":examples:cordapp-sweepstake:flows") - - // Corda - cordaRuntime "$corda_release_group:corda:$corda_release_version" - cordaCompile "$corda_release_group:corda-core:$corda_release_version" - cordaCompile "$corda_release_group:corda-rpc:$corda_release_version" - cordaCompile "$corda_release_group:corda-jackson:$corda_release_version" - - // Tokens - cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version" - cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version" - cordapp "$tokens_release_group:tokens-money:$tokens_release_version" - - // Spring - compile("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") { - exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" - } - - // JSON parser - compile "com.beust:klaxon:5.0.1" - - // Kotlin - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - - // Testing - testCompile project(":examples:cordapp-sweepstake:states") - testCompile project(":examples:cordapp-sweepstake:flows") - testCompile "$corda_release_group:corda-node-driver:$corda_release_version" - testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" - testCompile "junit:junit:$junit_version" - testCompile ("org.springframework.boot:spring-boot-starter-test:2.0.2.RELEASE") { - exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" - } -} - -task deployNodesX(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { - - nodeDefaults { - projectCordapp { - deploy = false - } - cordapp project(":workflows") - cordapp project(":contracts") - cordapp project(":examples:cordapp-sweepstake:states") - cordapp project(":examples:cordapp-sweepstake:flows") - cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version" - cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version" - cordapp "$tokens_release_group:tokens-money:$tokens_release_version" - } - - directory "./build/nodes" - node { - name "O=Notary,L=London,C=GB" - notary = [validating: false] - p2pPort 10000 - sshdPort 2222 - rpcSettings { - address("localhost:10001") - adminAddress("localhost:10002") - } - } - node { - name "O=TournamentA,L=London,C=GB" - p2pPort 10004 - sshdPort 2223 - rpcSettings { - address("localhost:10005") - adminAddress("localhost:10006") - } - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] - } - node { - name "O=TournamentB,L=London,C=GB" - p2pPort 10008 - sshdPort 2224 - rpcSettings { - address("localhost:10009") - adminAddress("localhost:10010") - } - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] - } -} - -task integrationTest(type: Test, dependsOn: []) { - testClassesDirs = sourceSets.integrationTest.output.classesDirs - classpath = sourceSets.integrationTest.runtimeClasspath -} - -task runTournamentServer(type: JavaExec, dependsOn: assemble) { - classpath = sourceSets.main.runtimeClasspath - main = 'com.r3.corda.lib.accounts.examples.sweepstake.cordapp.clients.WorldCupApplication' - args '--server.port=8080', '--config.rpc.host=localhost', '--config.rpc.port=10005', '--config.rpc.username=user1', '--config.rpc.password=test' -} \ No newline at end of file diff --git a/examples/cordapp-sweepstake/gradle.properties b/examples/cordapp-sweepstake/gradle.properties new file mode 100644 index 00000000..1731faca --- /dev/null +++ b/examples/cordapp-sweepstake/gradle.properties @@ -0,0 +1,4 @@ +group=com.r3.corda.examples +name=cordapp-sweepstake +version=0.1 +kotlin.incremental=false \ No newline at end of file diff --git a/examples/cordapp-sweepstake/gradle/wrapper/gradle-wrapper.jar b/examples/cordapp-sweepstake/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..94336fca Binary files /dev/null and b/examples/cordapp-sweepstake/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/cordapp-sweepstake/gradle/wrapper/gradle-wrapper.properties b/examples/cordapp-sweepstake/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d76b502e --- /dev/null +++ b/examples/cordapp-sweepstake/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/examples/cordapp-sweepstake/gradlew b/examples/cordapp-sweepstake/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/examples/cordapp-sweepstake/gradlew @@ -0,0 +1,172 @@ +#!/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/examples/cordapp-sweepstake/gradlew.bat b/examples/cordapp-sweepstake/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/examples/cordapp-sweepstake/gradlew.bat @@ -0,0 +1,84 @@ +@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/examples/cordapp-sweepstake/settings.gradle b/examples/cordapp-sweepstake/settings.gradle new file mode 100644 index 00000000..426df67b --- /dev/null +++ b/examples/cordapp-sweepstake/settings.gradle @@ -0,0 +1,3 @@ +include 'contracts' +include 'workflows' +include 'web' diff --git a/examples/cordapp-sweepstake/web/build.gradle b/examples/cordapp-sweepstake/web/build.gradle new file mode 100644 index 00000000..91199dc0 --- /dev/null +++ b/examples/cordapp-sweepstake/web/build.gradle @@ -0,0 +1,52 @@ +apply plugin: 'kotlin' + +sourceSets { + integrationTest { + kotlin { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + srcDir file('src/integrationTest/kotlin') + } + } +} + +configurations { + integrationTestCompile.extendsFrom testCompile + integrationTestRuntime.extendsFrom testRuntime +} + +dependencies { + compile project(":workflows") + compile project(":contracts") + compile "$corda_release_group:corda-rpc:$corda_release_version" + + // Spring + compile("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") { + exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" + } + + // JSON parser + compile "com.beust:klaxon:5.0.1" + + // Kotlin + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + + // Testing + testCompile "$corda_release_group:corda-node-driver:$corda_release_version" + testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" + testCompile "junit:junit:$junit_version" + testCompile ("org.springframework.boot:spring-boot-starter-test:2.0.2.RELEASE") { + exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" + } +} + +task integrationTest(type: Test, dependsOn: []) { + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath +} + +task runTournamentServer(type: JavaExec, dependsOn: assemble) { + classpath = sourceSets.main.runtimeClasspath + main = 'com.r3.corda.lib.accounts.examples.sweepstake.cordapp.clients.WorldCupApplication' + args '--server.port=8080', '--config.rpc.host=localhost', '--config.rpc.port=10005', '--config.rpc.username=user1', '--config.rpc.password=test' +} \ No newline at end of file diff --git a/examples/cordapp-sweepstake/cordapp/src/integrationTest/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/integration/test/SimulateWorldCup.kt b/examples/cordapp-sweepstake/web/src/integrationTest/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/integration/test/SimulateWorldCup.kt similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/integrationTest/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/integration/test/SimulateWorldCup.kt rename to examples/cordapp-sweepstake/web/src/integrationTest/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/integration/test/SimulateWorldCup.kt diff --git a/examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/NodeRPCConnection.kt b/examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/NodeRPCConnection.kt similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/NodeRPCConnection.kt rename to examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/NodeRPCConnection.kt diff --git a/examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupApplication.kt b/examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupApplication.kt similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupApplication.kt rename to examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupApplication.kt diff --git a/examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupController.kt b/examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupController.kt similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupController.kt rename to examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/clients/WorldCupController.kt diff --git a/examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/service/TournamentJsonParser.kt b/examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/service/TournamentJsonParser.kt similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/service/TournamentJsonParser.kt rename to examples/cordapp-sweepstake/web/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/cordapp/service/TournamentJsonParser.kt diff --git a/examples/cordapp-sweepstake/cordapp/src/main/resources/application.properties b/examples/cordapp-sweepstake/web/src/main/resources/application.properties similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/resources/application.properties rename to examples/cordapp-sweepstake/web/src/main/resources/application.properties diff --git a/examples/cordapp-sweepstake/cordapp/src/main/resources/participants.txt b/examples/cordapp-sweepstake/web/src/main/resources/participants.txt similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/resources/participants.txt rename to examples/cordapp-sweepstake/web/src/main/resources/participants.txt diff --git a/examples/cordapp-sweepstake/cordapp/src/main/resources/static/index.html b/examples/cordapp-sweepstake/web/src/main/resources/static/index.html similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/resources/static/index.html rename to examples/cordapp-sweepstake/web/src/main/resources/static/index.html diff --git a/examples/cordapp-sweepstake/cordapp/src/main/resources/static/sweepstake.css b/examples/cordapp-sweepstake/web/src/main/resources/static/sweepstake.css similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/resources/static/sweepstake.css rename to examples/cordapp-sweepstake/web/src/main/resources/static/sweepstake.css diff --git a/examples/cordapp-sweepstake/cordapp/src/main/resources/static/sweepstake.js b/examples/cordapp-sweepstake/web/src/main/resources/static/sweepstake.js similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/resources/static/sweepstake.js rename to examples/cordapp-sweepstake/web/src/main/resources/static/sweepstake.js diff --git a/examples/cordapp-sweepstake/cordapp/src/main/resources/worldcupteams.txt b/examples/cordapp-sweepstake/web/src/main/resources/worldcupteams.txt similarity index 100% rename from examples/cordapp-sweepstake/cordapp/src/main/resources/worldcupteams.txt rename to examples/cordapp-sweepstake/web/src/main/resources/worldcupteams.txt diff --git a/examples/cordapp-sweepstake/flows/build.gradle b/examples/cordapp-sweepstake/workflows/build.gradle similarity index 77% rename from examples/cordapp-sweepstake/flows/build.gradle rename to examples/cordapp-sweepstake/workflows/build.gradle index eef87e5b..834b6427 100644 --- a/examples/cordapp-sweepstake/flows/build.gradle +++ b/examples/cordapp-sweepstake/workflows/build.gradle @@ -3,7 +3,6 @@ apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.cordformation' apply plugin: 'net.corda.plugins.quasar-utils' - cordapp { info { name "World Cup Sweepstake - Workflows" @@ -19,25 +18,25 @@ cordapp { } } - dependencies { - // Accounts. - cordapp project(":workflows") - cordapp project(":examples:cordapp-sweepstake:states") + // Kotlin. + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // Corda. cordaCompile "$corda_release_group:corda-core:$corda_release_version" + cordaCompile "$accounts_release_group:accounts-workflows:$accounts_release_version" + cordaCompile "$confidential_id_release_group:ci-workflows:$confidential_id_release_version" + cordaRuntime "$corda_release_group:corda:$corda_release_version" + + // CorDapp dependencies. + cordapp project(":contracts") // Tokens. cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version" cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version" cordapp "$tokens_release_group:tokens-money:$tokens_release_version" - // Kotlin. - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - // Testing. - testCompile project(":examples:cordapp-sweepstake:states") testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testCompile "$corda_release_group:corda-node-driver:$corda_release_version" testCompile "junit:junit:$junit_version" diff --git a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/AccountGroupingFlows.kt b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/AccountGroupingFlows.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/AccountGroupingFlows.kt rename to examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/AccountGroupingFlows.kt diff --git a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/DistributeWinningsFlow.kt b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/DistributeWinningsFlow.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/DistributeWinningsFlow.kt rename to examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/DistributeWinningsFlow.kt diff --git a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/IssueTeamFlow.kt b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/IssueTeamFlow.kt similarity index 88% rename from examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/IssueTeamFlow.kt rename to examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/IssueTeamFlow.kt index 4eefce91..43f0f8b4 100644 --- a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/IssueTeamFlow.kt +++ b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/IssueTeamFlow.kt @@ -21,11 +21,7 @@ class IssueTeamFlow( @Suspendable override fun call(): StateAndRef { - val keyToUse = if (accountInfo.state.data.host == ourIdentity) { - serviceHub.createKeyForAccount(accountInfo.state.data).owningKey - } else { - subFlow(RequestKeyForAccount(accountInfo.state.data)).owningKey - } + val keyToUse = subFlow(RequestKeyForAccount(accountInfo.state.data)).owningKey val txBuilder = TransactionBuilder(notary = serviceHub.networkMapCache.notaryIdentities.first()) txBuilder.addCommand(TournamentContract.ISSUE_TEAM, serviceHub.myInfo.legalIdentities.first().owningKey) txBuilder.addOutputState(TeamState(team, true, keyToUse)) diff --git a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/MatchDayFlow.kt b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/MatchDayFlow.kt similarity index 95% rename from examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/MatchDayFlow.kt rename to examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/MatchDayFlow.kt index 5e51c944..11df00f3 100644 --- a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/MatchDayFlow.kt +++ b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/MatchDayFlow.kt @@ -39,12 +39,7 @@ class MatchDayFlow( val winningAccount = accountService.accountInfo(winningTeam.state.data.owningKey!!) ?: throw FlowException("Could not find account with public key: ${winningTeam.state.data.owningKey!!.toStringShort()}") - val newOwner = if (winningAccount.state.data.host == ourIdentity) { - serviceHub.createKeyForAccount(winningAccount.state.data) - } else { - subFlow(RequestKeyForAccount(winningAccount.state.data)) - } - + val newOwner = subFlow(RequestKeyForAccount(winningAccount.state.data)) val signingAccounts = listOfNotNull(accountForTeamA, accountForTeamB) val requiredSigners = signingAccounts.map { it.state.data.host.owningKey } + listOfNotNull( diff --git a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/TournamentUtilities.kt b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/TournamentUtilities.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/TournamentUtilities.kt rename to examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/flows/TournamentUtilities.kt diff --git a/examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/service/TournamentService.kt b/examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/service/TournamentService.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/service/TournamentService.kt rename to examples/cordapp-sweepstake/workflows/src/main/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/service/TournamentService.kt diff --git a/examples/cordapp-sweepstake/flows/src/main/resources/participants.txt b/examples/cordapp-sweepstake/workflows/src/main/resources/participants.txt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/main/resources/participants.txt rename to examples/cordapp-sweepstake/workflows/src/main/resources/participants.txt diff --git a/examples/cordapp-sweepstake/flows/src/main/resources/worldcupteams.txt b/examples/cordapp-sweepstake/workflows/src/main/resources/worldcupteams.txt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/main/resources/worldcupteams.txt rename to examples/cordapp-sweepstake/workflows/src/main/resources/worldcupteams.txt diff --git a/examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/AccountGroupingFlowTests.kt b/examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/AccountGroupingFlowTests.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/AccountGroupingFlowTests.kt rename to examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/AccountGroupingFlowTests.kt diff --git a/examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/DistributeWinningsTest.kt b/examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/DistributeWinningsTest.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/DistributeWinningsTest.kt rename to examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/DistributeWinningsTest.kt diff --git a/examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/IssueTeamFlowTests.kt b/examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/IssueTeamFlowTests.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/IssueTeamFlowTests.kt rename to examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/IssueTeamFlowTests.kt diff --git a/examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/MatchDayFlowTests.kt b/examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/MatchDayFlowTests.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/MatchDayFlowTests.kt rename to examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/MatchDayFlowTests.kt diff --git a/examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/TestUtils.kt b/examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/TestUtils.kt similarity index 100% rename from examples/cordapp-sweepstake/flows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/TestUtils.kt rename to examples/cordapp-sweepstake/workflows/src/test/kotlin/com/r3/corda/lib/accounts/examples/sweepstake/workflows/test/TestUtils.kt diff --git a/examples/gold-trading/agent/build.gradle b/examples/gold-trading/agent/build.gradle index 878e20d9..71bf6e4b 100644 --- a/examples/gold-trading/agent/build.gradle +++ b/examples/gold-trading/agent/build.gradle @@ -1,13 +1,3 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE") - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'idea' @@ -18,13 +8,6 @@ bootJar { baseName = 'agent-spring-boot' } -repositories { - mavenCentral() -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - dependencies { compile("org.springframework.boot:spring-boot-starter-web"){ exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" @@ -33,18 +16,5 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "$corda_release_group:corda-rpc:$corda_release_version" - implementation project(":contracts") - implementation project(":workflows") - implementation project(":examples:gold-trading:cordapp") + implementation project(":cordapp") } - -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} \ No newline at end of file diff --git a/examples/gold-trading/build.gradle b/examples/gold-trading/build.gradle new file mode 100644 index 00000000..9baff6f7 --- /dev/null +++ b/examples/gold-trading/build.gradle @@ -0,0 +1,62 @@ +buildscript { + ext { + corda_release_group = 'net.corda' + corda_release_version = '4.3-RC02' + corda_gradle_plugins_version = '4.0.42' + accounts_release_group = 'com.r3.corda.lib.accounts' + accounts_release_version = '1.0-RC04' + confidential_id_release_group = "com.r3.corda.lib.ci" + confidential_id_release_version = "1.0-RC03" + tokens_release_group = 'com.r3.corda.lib.tokens' + tokens_release_version = '1.0' + quasar_version = '0.7.10' + kotlin_version = '1.2.71' + junit_version = '4.12' + } + + repositories { + mavenCentral() + jcenter() + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + } + + 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:2.0.5.RELEASE") + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + jcenter() + mavenCentral() + maven { url "https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev" } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + //This is needed until the accounts sdk is official + maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib-dev" } + maven { url 'http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib' } + //Corda testing node-driver requires gradle-tooling-api + maven { url 'https://repo.gradle.org/gradle/libs-releases-local/' } + //Crash Shell dependencies are not published correctly in R3 repo + maven { url 'https://jitpack.io' } + } + + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + languageVersion = "1.2" + apiVersion = "1.2" + jvmTarget = "1.8" + javaParameters = true // Useful for reflection. + } + } +} + +wrapper { + gradleVersion = "4.10.2" + distributionType = Wrapper.DistributionType.ALL +} + diff --git a/examples/gold-trading/cordapp/build.gradle b/examples/gold-trading/cordapp/build.gradle index 4a8b30c0..7935153c 100644 --- a/examples/gold-trading/cordapp/build.gradle +++ b/examples/gold-trading/cordapp/build.gradle @@ -12,19 +12,6 @@ cordapp { } } -sourceSets { - main { - resources { - srcDir "../config/dev" - } - } - test { - resources { - srcDir "../config/test" - } - } -} - dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" @@ -36,11 +23,11 @@ dependencies { cordaCompile "$corda_release_group:corda-rpc:$corda_release_version" cordaRuntime "$corda_release_group:corda:$corda_release_version" - cordapp project(":contracts") - cordapp project(":workflows") + cordapp "$accounts_release_group:accounts-contracts:$accounts_release_version" + cordapp "$accounts_release_group:accounts-workflows:$accounts_release_version" + cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version" testCompile "$corda_release_group:corda-node-driver:$corda_release_version" - } test{ @@ -51,11 +38,11 @@ test{ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { nodeDefaults { - cordapp project(":contracts") - cordapp project(":workflows") + cordapp("$accounts_release_group:accounts-contracts:$accounts_release_version") + cordapp("$accounts_release_group:accounts-workflows:$accounts_release_version") + rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] } - directory "./build/nodes" node { name "O=Notary,L=London,C=GB" notary = [validating: false] @@ -64,6 +51,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10001") adminAddress("localhost:10002") } + cordapps.clear() } node { name "O=Agent,L=London,C=GB" @@ -72,7 +60,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10005") adminAddress("localhost:10006") } - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] } node { name "O=FundManager1,L=New York,C=US" @@ -81,7 +68,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10009") adminAddress("localhost:10010") } - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] } node { name "O=FundManager2,L=Paris,C=FR" @@ -90,7 +76,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10013") adminAddress("localhost:10014") } - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] } node { name "O=Administrator1,L=Paris,C=FR" @@ -99,6 +84,5 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { address("localhost:10021") adminAddress("localhost:10022") } - rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]] } } diff --git a/examples/gold-trading/fund-admin/build.gradle b/examples/gold-trading/fund-admin/build.gradle index 264f82aa..79492131 100644 --- a/examples/gold-trading/fund-admin/build.gradle +++ b/examples/gold-trading/fund-admin/build.gradle @@ -1,13 +1,3 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE") - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'idea' @@ -18,10 +8,6 @@ bootJar { baseName = 'trustee-spring-boot' } -repositories { - mavenCentral() -} - dependencies { compile("org.springframework.boot:spring-boot-starter-web"){ exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" @@ -30,7 +16,5 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "$corda_release_group:corda-rpc:$corda_release_version" - implementation project(":contracts") - implementation project(":workflows") - implementation project(":examples:gold-trading:cordapp") -} \ No newline at end of file + implementation project(":cordapp") +} diff --git a/examples/gold-trading/fund-manager/build.gradle b/examples/gold-trading/fund-manager/build.gradle index cc12fdfc..9dc1f0df 100644 --- a/examples/gold-trading/fund-manager/build.gradle +++ b/examples/gold-trading/fund-manager/build.gradle @@ -1,13 +1,3 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE") - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'idea' @@ -18,10 +8,6 @@ bootJar { baseName = 'fundmanager-spring-boot' } -repositories { - mavenCentral() -} - dependencies { compile("org.springframework.boot:spring-boot-starter-web"){ exclude group: "org.springframework.boot", module: "spring-boot-starter-logging" @@ -30,7 +16,5 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "$corda_release_group:corda-rpc:$corda_release_version" - implementation project(":contracts") - implementation project(":workflows") - implementation project(":examples:gold-trading:cordapp") -} \ No newline at end of file + implementation project(":cordapp") +} diff --git a/examples/gold-trading/gradle.properties b/examples/gold-trading/gradle.properties new file mode 100644 index 00000000..d6cd7121 --- /dev/null +++ b/examples/gold-trading/gradle.properties @@ -0,0 +1,4 @@ +group=com.r3.corda.examples +name=gold-trading +version=0.1 +kotlin.incremental=false \ No newline at end of file diff --git a/examples/gold-trading/gradle/wrapper/gradle-wrapper.jar b/examples/gold-trading/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..94336fca Binary files /dev/null and b/examples/gold-trading/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/gold-trading/gradle/wrapper/gradle-wrapper.properties b/examples/gold-trading/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d76b502e --- /dev/null +++ b/examples/gold-trading/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/examples/gold-trading/gradlew b/examples/gold-trading/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/examples/gold-trading/gradlew @@ -0,0 +1,172 @@ +#!/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/examples/gold-trading/gradlew.bat b/examples/gold-trading/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/examples/gold-trading/gradlew.bat @@ -0,0 +1,84 @@ +@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/examples/gold-trading/settings.gradle b/examples/gold-trading/settings.gradle new file mode 100644 index 00000000..52d36ae9 --- /dev/null +++ b/examples/gold-trading/settings.gradle @@ -0,0 +1,4 @@ +include 'cordapp' +include 'agent' +include 'fund-admin' +include 'fund-manager' diff --git a/examples/tokens-integration-test/build.gradle b/examples/tokens-integration-test/build.gradle index 1a372653..a376411a 100644 --- a/examples/tokens-integration-test/build.gradle +++ b/examples/tokens-integration-test/build.gradle @@ -1,3 +1,52 @@ +buildscript { + ext { + corda_release_group = 'net.corda' + corda_release_version = '4.3-RC02' + corda_gradle_plugins_version = '4.0.42' + accounts_release_group = 'com.r3.corda.lib.accounts' + accounts_release_version = '1.0-RC04' + confidential_id_release_group = "com.r3.corda.lib.ci" + confidential_id_release_version = "1.0-RC03" + tokens_release_group = 'com.r3.corda.lib.tokens' + tokens_release_version = '1.0' + quasar_version = '0.7.10' + kotlin_version = '1.2.71' + junit_version = '4.12' + } + + repositories { + mavenCentral() + jcenter() + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + } + + 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" + } +} + +repositories { + jcenter() + mavenCentral() + maven { url "https://ci-artifactory.corda.r3cev.com/artifactory/corda-dev" } + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' } + //This is needed until the accounts sdk is official + maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib-dev" } + maven { url 'http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib' } + //Corda testing node-driver requires gradle-tooling-api + maven { url 'https://repo.gradle.org/gradle/libs-releases-local/' } + //Crash Shell dependencies are not published correctly in R3 repo + maven { url 'https://jitpack.io' } +} + +wrapper { + gradleVersion = "4.10.2" + distributionType = Wrapper.DistributionType.ALL +} + apply plugin: 'kotlin' apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.quasar-utils' @@ -29,13 +78,14 @@ dependencies { cordaCompile "$corda_release_group:corda-core:$corda_release_version" // Accounts dependencies. - cordaCompile project(":contracts") - cordaCompile project(":workflows") + cordapp "$accounts_release_group:accounts-contracts:$accounts_release_version" + cordapp "$accounts_release_group:accounts-workflows:$accounts_release_version" + cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version" // Token SDK dependencies. - cordaCompile "$tokens_release_group:tokens-contracts:$tokens_release_version" - cordaCompile "$tokens_release_group:tokens-money:$tokens_release_version" - cordaCompile "$tokens_release_group:tokens-workflows:$tokens_release_version" + cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version" + cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version" + cordapp "$tokens_release_group:tokens-money:$tokens_release_version" } sourceSets { diff --git a/examples/tokens-integration-test/gradle.properties b/examples/tokens-integration-test/gradle.properties new file mode 100644 index 00000000..17fd393d --- /dev/null +++ b/examples/tokens-integration-test/gradle.properties @@ -0,0 +1,4 @@ +group=com.r3.corda.examples +name=tokens-integration-test +version=0.1 +kotlin.incremental=false \ No newline at end of file diff --git a/examples/tokens-integration-test/gradle/wrapper/gradle-wrapper.jar b/examples/tokens-integration-test/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..94336fca Binary files /dev/null and b/examples/tokens-integration-test/gradle/wrapper/gradle-wrapper.jar differ diff --git a/examples/tokens-integration-test/gradle/wrapper/gradle-wrapper.properties b/examples/tokens-integration-test/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..d76b502e --- /dev/null +++ b/examples/tokens-integration-test/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/examples/tokens-integration-test/gradlew b/examples/tokens-integration-test/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/examples/tokens-integration-test/gradlew @@ -0,0 +1,172 @@ +#!/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/examples/tokens-integration-test/gradlew.bat b/examples/tokens-integration-test/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/examples/tokens-integration-test/gradlew.bat @@ -0,0 +1,84 @@ +@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/settings.gradle b/settings.gradle index d9ee7df9..c46db016 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,12 +1,2 @@ include 'contracts' include 'workflows' -include 'examples:cordapp-sweepstake:cordapp' -include 'examples:cordapp-sweepstake:states' -include 'examples:cordapp-sweepstake:flows' -include 'examples:gold-trading:cordapp' -include 'examples:gold-trading:agent' -include 'examples:gold-trading:fund-admin' -include 'examples:gold-trading:fund-manager' -include 'examples:tokens-integration-test' - -