|
| 1 | +buildscript { //properties that you need to build the project |
| 2 | + |
| 3 | + Properties constants = new Properties() |
| 4 | + file("$projectDir/../constants.properties").withInputStream { constants.load(it) } |
| 5 | + |
| 6 | + ext { |
| 7 | + corda_release_group = constants.getProperty("cordaReleaseGroup") |
| 8 | + corda_core_release_group = constants.getProperty("cordaCoreReleaseGroup") |
| 9 | + corda_release_version = constants.getProperty("cordaVersion") |
| 10 | + corda_core_release_version = constants.getProperty("cordaCoreVersion") |
| 11 | + corda_gradle_plugins_version = constants.getProperty("gradlePluginsVersion") |
| 12 | + kotlin_version = constants.getProperty("kotlinVersion") |
| 13 | + junit_version = constants.getProperty("junitVersion") |
| 14 | + quasar_version = constants.getProperty("quasarVersion") |
| 15 | + log4j_version = constants.getProperty("log4jVersion") |
| 16 | + slf4j_version = constants.getProperty("slf4jVersion") |
| 17 | + corda_platform_version = constants.getProperty("platformVersion").toInteger() |
| 18 | + //springboot |
| 19 | + spring_boot_version = '2.0.2.RELEASE' |
| 20 | + spring_boot_gradle_plugin_version = '2.0.2.RELEASE' |
| 21 | + //Token |
| 22 | + tokens_release_group = 'com.r3.corda.lib.tokens' |
| 23 | + tokens_release_version = '1.2' |
| 24 | + //CI |
| 25 | + confidential_id_release_group = "com.r3.corda.lib.ci" |
| 26 | + confidential_id_release_version = "1.0" |
| 27 | + } |
| 28 | + |
| 29 | + repositories { |
| 30 | + mavenLocal() |
| 31 | + mavenCentral() |
| 32 | + jcenter() |
| 33 | + maven { url 'https://software.r3.com/artifactory/corda-releases' } |
| 34 | + } |
| 35 | + |
| 36 | + dependencies { |
| 37 | + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| 38 | + classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" |
| 39 | + classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version" |
| 40 | + classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version" |
| 41 | + classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version" |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +allprojects { //Properties that you need to compile your project (The application) |
| 46 | + apply from: "${rootProject.projectDir}/repositories.gradle" |
| 47 | + apply plugin: 'kotlin' |
| 48 | + |
| 49 | + repositories { |
| 50 | + mavenLocal() |
| 51 | + jcenter() |
| 52 | + mavenCentral() |
| 53 | + maven { url 'https://software.r3.com/artifactory/corda' } |
| 54 | + maven { url 'https://jitpack.io' } |
| 55 | + //corda lib |
| 56 | + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-lib' } |
| 57 | + maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-tokens-dev' } |
| 58 | + |
| 59 | + } |
| 60 | + |
| 61 | + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { |
| 62 | + kotlinOptions { |
| 63 | + languageVersion = "1.2" |
| 64 | + apiVersion = "1.2" |
| 65 | + jvmTarget = "1.8" |
| 66 | + javaParameters = true // Useful for reflection. |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + jar { |
| 71 | + // This makes the JAR's SHA-256 hash repeatable. |
| 72 | + preserveFileTimestamps = false |
| 73 | + reproducibleFileOrder = true |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +apply plugin: 'net.corda.plugins.cordapp' |
| 78 | +apply plugin: 'net.corda.plugins.cordformation' |
| 79 | +apply plugin: 'net.corda.plugins.quasar-utils' |
| 80 | + |
| 81 | +sourceSets { |
| 82 | + main { |
| 83 | + resources { |
| 84 | + srcDir rootProject.file("config/dev") |
| 85 | + } |
| 86 | + } |
| 87 | +} |
| 88 | + |
| 89 | +//Module dependencis |
| 90 | +dependencies { |
| 91 | + // Corda dependencies. |
| 92 | + cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" |
| 93 | + cordaRuntime "$corda_release_group:corda-node-api:$corda_release_version" |
| 94 | + cordaRuntime "$corda_release_group:corda:$corda_release_version" |
| 95 | + |
| 96 | + // CorDapp dependencies. |
| 97 | + cordapp project(":workflows") |
| 98 | + cordapp project(":contracts") |
| 99 | + |
| 100 | + cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" |
| 101 | + cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}" |
| 102 | + cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version" |
| 103 | + |
| 104 | + // Token SDK dependencies. |
| 105 | + cordapp "$tokens_release_group:tokens-contracts:$tokens_release_version" |
| 106 | + cordapp "$tokens_release_group:tokens-workflows:$tokens_release_version" |
| 107 | + // CI dependencies |
| 108 | + cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version" |
| 109 | +} |
| 110 | + |
| 111 | +//Task to build the jar for ganache. |
| 112 | +task ganache { |
| 113 | + subprojects { |
| 114 | + if (it.project.name != "clients") { |
| 115 | + dependsOn jar |
| 116 | + doLast { |
| 117 | + copy { |
| 118 | + from "${buildDir}/libs" |
| 119 | + into "${rootDir}/build/libs" |
| 120 | + } |
| 121 | + } |
| 122 | + } |
| 123 | + } |
| 124 | +} |
| 125 | + |
| 126 | +//Task to deploy the nodes in order to bootstrap a network |
| 127 | +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { |
| 128 | + |
| 129 | + /* This property will load the CorDapps to each of the node by default, including the Notary. You can find them |
| 130 | + * in the cordapps folder of the node at build/nodes/Notary/cordapps. However, the notary doesn't really understand |
| 131 | + * the notion of cordapps. In production, Notary does not need cordapps as well. This is just a short cut to load |
| 132 | + * the Corda network bootstrapper. |
| 133 | + */ |
| 134 | + nodeDefaults { |
| 135 | + projectCordapp { |
| 136 | + deploy = false |
| 137 | + } |
| 138 | + cordapp project(':contracts') |
| 139 | + cordapp project(':workflows') |
| 140 | + cordapp("$tokens_release_group:tokens-contracts:$tokens_release_version") |
| 141 | + cordapp("$tokens_release_group:tokens-workflows:$tokens_release_version") |
| 142 | + cordapp "$confidential_id_release_group:ci-workflows:$confidential_id_release_version" |
| 143 | + runSchemaMigration = true //This configuration is for any CorDapps with custom schema, We will leave this as true to avoid |
| 144 | + //problems for developers who are not familiar with Corda. If you are not using custom schemas, you can change |
| 145 | + //it to false for quicker project compiling time. |
| 146 | + } |
| 147 | + node { |
| 148 | + name "O=Notary,L=London,C=GB" |
| 149 | + notary = [validating : false] |
| 150 | + p2pPort 10002 |
| 151 | + rpcSettings { |
| 152 | + address("localhost:10003") |
| 153 | + adminAddress("localhost:10043") |
| 154 | + } |
| 155 | + } |
| 156 | + node { |
| 157 | + name "O=Operator,L=London,C=GB" |
| 158 | + p2pPort 10005 |
| 159 | + rpcSettings { |
| 160 | + address("localhost:10006") |
| 161 | + adminAddress("localhost:10046") |
| 162 | + } |
| 163 | + rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] |
| 164 | + } |
| 165 | + node { |
| 166 | + name "O=USEast3,L=New York,C=US" |
| 167 | + p2pPort 10008 |
| 168 | + rpcSettings { |
| 169 | + address("localhost:10009") |
| 170 | + adminAddress("localhost:10049") |
| 171 | + } |
| 172 | + rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] |
| 173 | + } |
| 174 | + node { |
| 175 | + name "O=AsiaEast,L=Beijing,C=CN" |
| 176 | + p2pPort 10011 |
| 177 | + rpcSettings { |
| 178 | + address("localhost:10012") |
| 179 | + adminAddress("localhost:10052") |
| 180 | + } |
| 181 | + rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] |
| 182 | + } |
| 183 | + node { |
| 184 | + name "O=USWest1,L=San Diego,C=US" |
| 185 | + p2pPort 10014 |
| 186 | + rpcSettings { |
| 187 | + address("localhost:10015") |
| 188 | + adminAddress("localhost:10055") |
| 189 | + } |
| 190 | + rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] |
| 191 | + } |
| 192 | + |
| 193 | +} |
0 commit comments