|
| 1 | +buildscript { //properties that you need to build the project |
| 2 | + Properties constants = new Properties() |
| 3 | + file("$projectDir/./constants.properties").withInputStream { constants.load(it) } |
| 4 | + |
| 5 | + ext { |
| 6 | + corda_release_group = constants.getProperty("cordaReleaseGroup") |
| 7 | + corda_core_release_group = constants.getProperty("cordaCoreReleaseGroup") |
| 8 | + corda_release_version = constants.getProperty("cordaVersion") |
| 9 | + corda_core_release_version = constants.getProperty("cordaCoreVersion") |
| 10 | + corda_gradle_plugins_version = constants.getProperty("gradlePluginsVersion") |
| 11 | + kotlin_version = constants.getProperty("kotlinVersion") |
| 12 | + junit_version = constants.getProperty("junitVersion") |
| 13 | + quasar_version = constants.getProperty("quasarVersion") |
| 14 | + log4j_version = constants.getProperty("log4jVersion") |
| 15 | + slf4j_version = constants.getProperty("slf4jVersion") |
| 16 | + corda_platform_version = constants.getProperty("platformVersion").toInteger() |
| 17 | + |
| 18 | + // springboot |
| 19 | + spring_boot_version = '2.0.2.RELEASE' |
| 20 | + spring_boot_gradle_plugin_version = '2.0.2.RELEASE' |
| 21 | + |
| 22 | + accounts_release_version = '1.0' |
| 23 | + accounts_release_group = 'com.r3.corda.lib.accounts' |
| 24 | + confidential_id_release_group = "com.r3.corda.lib.ci" |
| 25 | + confidential_id_release_version = "1.0" |
| 26 | + } |
| 27 | + |
| 28 | + repositories { |
| 29 | + mavenLocal() |
| 30 | + mavenCentral() |
| 31 | + jcenter() |
| 32 | + maven { url 'https://jitpack.io' } |
| 33 | + maven { url 'https://repo.gradle.org/gradle/libs-releases' } |
| 34 | + maven { url 'http://software.r3.com/artifactory/corda-lib' } |
| 35 | + maven { url 'https://software.r3.com/artifactory/corda-releases' } |
| 36 | + } |
| 37 | + |
| 38 | + dependencies { |
| 39 | + classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" |
| 40 | + classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version" |
| 41 | + classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version" |
| 42 | + classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version" |
| 43 | + classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version" |
| 44 | + |
| 45 | + classpath "com.sendgrid:sendgrid-java:4.7.0" |
| 46 | + classpath "com.sendgrid:java-http-client:4.3.6" |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +allprojects {//Properties that you need to compile your project (The application) |
| 51 | + apply from: "${rootProject.projectDir}/repositories.gradle" |
| 52 | + apply plugin: 'java' |
| 53 | + |
| 54 | + repositories { |
| 55 | + mavenLocal() |
| 56 | + jcenter() |
| 57 | + mavenCentral() |
| 58 | + maven { url 'https://jitpack.io' } |
| 59 | + maven { url 'https://software.r3.com/artifactory/corda' } |
| 60 | + } |
| 61 | + |
| 62 | + tasks.withType(JavaCompile) { |
| 63 | + options.compilerArgs << "-parameters" // Required by Corda's serialisation framework. |
| 64 | + } |
| 65 | + |
| 66 | +// tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { |
| 67 | +// kotlinOptions { |
| 68 | +// languageVersion = "1.2" |
| 69 | +// apiVersion = "1.2" |
| 70 | +// jvmTarget = "1.8" |
| 71 | +// javaParameters = true // Useful for reflection. |
| 72 | +// } |
| 73 | +// } |
| 74 | + |
| 75 | + jar { |
| 76 | + // This makes the JAR's SHA-256 hash repeatable. |
| 77 | + preserveFileTimestamps = false |
| 78 | + reproducibleFileOrder = true |
| 79 | + duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +apply plugin: 'net.corda.plugins.cordapp' |
| 84 | +apply plugin: 'net.corda.plugins.cordformation' |
| 85 | +apply plugin: 'net.corda.plugins.quasar-utils' |
| 86 | + |
| 87 | +sourceSets { |
| 88 | + main { |
| 89 | + resources { |
| 90 | + srcDir rootProject.file("config/dev") |
| 91 | + } |
| 92 | + } |
| 93 | +} |
| 94 | + |
| 95 | +//Module dependencis |
| 96 | +dependencies { |
| 97 | + // Corda dependencies. |
| 98 | + cordaCompile "$corda_core_release_group:corda-core:$corda_core_release_version" |
| 99 | + cordaCompile "$corda_release_group:corda-node-api:$corda_release_version" |
| 100 | + cordaRuntime "$corda_release_group:corda:$corda_release_version" |
| 101 | + |
| 102 | + // CorDapp dependencies. |
| 103 | + cordapp project(":workflows") |
| 104 | + cordapp project(":contracts") |
| 105 | + |
| 106 | + cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version" |
| 107 | + cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}" |
| 108 | + cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_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 | + |
| 135 | + //Java version check |
| 136 | + if (JavaVersion.current() != JavaVersion.VERSION_1_8){ |
| 137 | + throw new GradleException("This build must be run with java 8") |
| 138 | + } |
| 139 | + |
| 140 | + nodeDefaults { |
| 141 | + projectCordapp { deploy = true } |
| 142 | + cordapp project(':contracts') |
| 143 | + cordapp project(':workflows') |
| 144 | + } |
| 145 | + |
| 146 | + node { |
| 147 | + name "O=Notary,L=London,C=GB" |
| 148 | + notary = [validating : false] |
| 149 | + p2pPort 10002 |
| 150 | + rpcSettings { |
| 151 | + address("localhost:10003") |
| 152 | + adminAddress("localhost:10043") |
| 153 | + } |
| 154 | + } |
| 155 | + node { |
| 156 | + name "O=Santa,L=London,C=GB" |
| 157 | + p2pPort 10006 |
| 158 | + rpcSettings { |
| 159 | + address("localhost:10016") |
| 160 | + adminAddress("localhost:10046") |
| 161 | + } |
| 162 | + rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] |
| 163 | + } |
| 164 | + |
| 165 | + node { |
| 166 | + name "O=Elf,L=London,C=GB" |
| 167 | + p2pPort 10007 |
| 168 | + rpcSettings { |
| 169 | + address("localhost:10017") |
| 170 | + adminAddress("localhost:10027") |
| 171 | + } |
| 172 | + |
| 173 | + rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]] |
| 174 | + } |
| 175 | + |
| 176 | +} |
0 commit comments