diff --git a/build.gradle b/build.gradle index 3c61c65f26..eb4ca9d14a 100644 --- a/build.gradle +++ b/build.gradle @@ -47,6 +47,7 @@ apply plugin: 'project-report' apply plugin: 'com.github.ben-manes.versions' apply plugin: 'maven-publish' apply plugin: 'net.corda.plugins.quasar-utils' +apply plugin: 'net.corda.plugins.cordformation' // We need the following three lines even though they're inside an allprojects {} block below because otherwise // IntelliJ gets confused when importing the project and ends up erasing and recreating the .idea directory, along @@ -92,6 +93,7 @@ repositories { dependencies { compile project(':node') compile "com.google.guava:guava:19.0" + runtime project(path: ":node", configuration: 'runtimeArtifacts') } task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) { @@ -119,74 +121,37 @@ tasks.withType(Test) { reports.html.destination = file("${reporting.baseDir}/${name}") } -// TODO: Move fat JAR building into node subproject. -task buildCordaJAR(type: FatCapsule, dependsOn: ['jar', 'buildCertSigningRequestUtilityJAR']) { - applicationClass 'net.corda.node.MainKt' - archiveName "corda-${corda_version}.jar" - applicationSource = files(project.tasks.findByName('jar'), 'node/build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml') - - capsuleManifest { - appClassPath = ["jolokia-agent-war-${project.ext.jolokia_version}.war"] - javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"] - minJavaVersion = '1.8.0' - caplets = ['CordaCaplet'] +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) { + directory "./build/nodes" + networkMap "Controller" + node { + name "Controller" + dirName "controller" + nearestCity "London" + advertisedServices = ["corda.notary.validating"] + artemisPort 10002 + webPort 10003 + cordapps = [] } -} - -task buildCertSigningRequestUtilityJAR(type: FatCapsule, dependsOn: project.jar) { - applicationClass 'net.corda.node.utilities.certsigning.CertificateSignerKt' - archiveName 'certSigningRequestUtility.jar' - capsuleManifest { - systemProperties['log4j.configuration'] = 'log4j2.xml' - minJavaVersion = '1.8.0' + node { + name "Bank A" + dirName "nodea" + nearestCity "London" + advertisedServices = [] + artemisPort 10004 + webPort 10005 + cordapps = [] } -} - -// TODO: Use the Cordformation plugin. -task deployNodes(dependsOn: 'buildCordaJAR') << { - copy { - from buildCordaJAR.outputs.getFiles() - from 'config/dev/nameservernode.conf' - into "${buildDir}/nodes/nameserver" - rename 'nameservernode.conf', 'node.conf' - } - - copy { - from buildCordaJAR.outputs.getFiles() - from 'config/dev/generalnodea.conf' - into "${buildDir}/nodes/nodea" - rename 'generalnodea.conf', 'node.conf' - } - - copy { - from buildCordaJAR.outputs.getFiles() - from 'config/dev/generalnodeb.conf' - into "${buildDir}/nodes/nodeb" - rename 'generalnodeb.conf', 'node.conf' - } - - delete("${buildDir}/nodes/runnodes") - def jarName = buildCordaJAR.outputs.getFiles().getSingleFile().getName() - copy { - from "buildSrc/scripts/runnodes" - filter { String line -> line.replace("JAR_NAME", jarName) } - filter(org.apache.tools.ant.filters.FixCrLfFilter.class, eol: org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance("lf")) - into "${buildDir}/nodes" + node { + name "Bank B" + dirName "nodeb" + nearestCity "New York" + advertisedServices = [] + artemisPort 10006 + webPort 10007 + cordapps = [] } } // Aliasing the publishToMavenLocal for simplicity. -// TODO: Verify this works for gradle plugins. -task(install, dependsOn: 'publishToMavenLocal') - -publishing { - publications { - corda(MavenPublication) { - artifactId 'corda' - - artifact buildCordaJAR { - classifier "" - } - } - } -} +task(install, dependsOn: 'publishToMavenLocal') \ No newline at end of file diff --git a/docs/source/example-code/build.gradle b/docs/source/example-code/build.gradle index 3836ba9fcf..470ef52172 100644 --- a/docs/source/example-code/build.gradle +++ b/docs/source/example-code/build.gradle @@ -36,17 +36,19 @@ sourceSets { } } +compileTestJava.dependsOn tasks.getByPath(':node:buildCordaJAR') + dependencies { compile project(':core') compile project(':client') - compile project(':test-utils') + testCompile project(':test-utils') compile "org.graphstream:gs-core:1.3" compile("org.graphstream:gs-ui:1.3") { exclude group: "bouncycastle" } - runtime "net.corda:corda:$corda_version" + runtime project(path: ":node", configuration: 'runtimeArtifacts') } mainClassName = "net.corda.docs.ClientRpcTutorialKt" @@ -70,7 +72,7 @@ task integrationTest(type: Test) { classpath = sourceSets.integrationTest.runtimeClasspath } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install', 'build']) { +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) { directory "./build/nodes" networkMap "Notary" node { diff --git a/docs/source/permissioning.rst b/docs/source/permissioning.rst index 5fea5c539e..548cd19278 100644 --- a/docs/source/permissioning.rst +++ b/docs/source/permissioning.rst @@ -34,18 +34,18 @@ This process only needs to be done once when the node connects to the network fo Building the utility -------------------- -The utility will be created as part of the main build ``buildCordaJAR``. +The utility will be created as part of the gradle ``:node`` module ``buildCordaJAR`` task. You can also build the utility JAR by run the following command from the Corda project root directory. **Windows**:: - gradlew.bat buildCertSigningRequestUtilityJAR + gradlew.bat :node:buildCertSigningRequestUtilityJAR **Other**:: - ./gradlew buildCertSigningRequestUtilityJAR + ./gradlew :node:buildCertSigningRequestUtilityJAR -The utility JAR will be created in ``/build/libs/certSigningRequestUtility.jar`` +The utility JAR will be created in ``/node/build/libs/certSigningRequestUtility.jar`` Running the utility diff --git a/experimental/build.gradle b/experimental/build.gradle index ebbbabaebf..e76a5c995c 100644 --- a/experimental/build.gradle +++ b/experimental/build.gradle @@ -29,5 +29,5 @@ dependencies { compile project(':finance') testCompile 'junit:junit:4.12' - compile project(':test-utils') + testCompile project(':test-utils') } diff --git a/node/build.gradle b/node/build.gradle index c5e504e113..c187d3c33c 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'net.corda.plugins.quasar-utils' apply plugin: 'net.corda.plugins.publish-utils' +apply plugin: 'us.kirchmeier.capsule' repositories { mavenLocal() @@ -23,6 +24,8 @@ configurations { integrationTestCompile.extendsFrom testCompile integrationTestRuntime.extendsFrom testRuntime + + runtimeArtifacts.extendsFrom runtime } // Force the Caplet to target Java 6. This ensures that running 'java -jar corda.jar' on any Java 6 VM upwards @@ -166,6 +169,32 @@ task integrationTest(type: Test) { classpath = sourceSets.integrationTest.runtimeClasspath } +task buildCordaJAR(type: FatCapsule, dependsOn: ['jar', 'buildCertSigningRequestUtilityJAR']) { + applicationClass 'net.corda.node.MainKt' + archiveName "corda-${corda_version}.jar" + applicationSource = files(project.tasks.findByName('jar'), 'build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml') + + capsuleManifest { + appClassPath = ["jolokia-agent-war-${project.rootProject.ext.jolokia_version}.war"] + javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"] + minJavaVersion = '1.8.0' + caplets = ['CordaCaplet'] + } +} + +task buildCertSigningRequestUtilityJAR(type: FatCapsule, dependsOn: project.jar) { + applicationClass 'net.corda.node.utilities.certsigning.CertificateSignerKt' + archiveName 'certSigningRequestUtility.jar' + capsuleManifest { + systemProperties['log4j.configuration'] = 'log4j2.xml' + minJavaVersion = '1.8.0' + } +} + +artifacts { + runtimeArtifacts buildCordaJAR +} + publishing { publications { node(MavenPublication) { @@ -175,5 +204,13 @@ publishing { artifact sourceJar artifact javadocJar } + corda(MavenPublication) { + artifactId 'corda' + + artifact buildCordaJAR { + classifier "" + } + } + } } \ No newline at end of file diff --git a/samples/attachment-demo/build.gradle b/samples/attachment-demo/build.gradle index e673ef9b60..a0f09c3d9e 100644 --- a/samples/attachment-demo/build.gradle +++ b/samples/attachment-demo/build.gradle @@ -45,7 +45,7 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - compile "net.corda:corda:$corda_version" // TODO + runtime project(path: ":node", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') @@ -61,7 +61,7 @@ dependencies { } } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install', 'build']) { +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) { directory "./build/nodes" networkMap "Controller" node { diff --git a/samples/irs-demo/build.gradle b/samples/irs-demo/build.gradle index 8ec1c824a4..27d3cd3ede 100644 --- a/samples/irs-demo/build.gradle +++ b/samples/irs-demo/build.gradle @@ -48,7 +48,7 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - compile "net.corda:corda:$corda_version" // TODO + runtime project(path: ":node", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') @@ -63,7 +63,7 @@ dependencies { compile 'com.squareup.okhttp3:okhttp:3.3.1' } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install', 'build']) { +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) { directory "./build/nodes" networkMap "Notary" node { diff --git a/samples/network-visualiser/build.gradle b/samples/network-visualiser/build.gradle index b910a94b59..fcfbfbde06 100644 --- a/samples/network-visualiser/build.gradle +++ b/samples/network-visualiser/build.gradle @@ -21,12 +21,12 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - compile "net.corda:corda:$corda_version" // TODO + runtime project(path: ":node", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') compile project(':finance') - compile project(':test-utils') + testCompile project(':test-utils') // Javax is required for webapis compile "org.glassfish.jersey.core:jersey-server:${jersey_version}" diff --git a/samples/raft-notary-demo/build.gradle b/samples/raft-notary-demo/build.gradle index b81edbc371..9493636407 100644 --- a/samples/raft-notary-demo/build.gradle +++ b/samples/raft-notary-demo/build.gradle @@ -45,7 +45,7 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - compile "net.corda:corda:$corda_version" // TODO + runtime project(path: ":node", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') @@ -81,7 +81,7 @@ task generateNotaryIdentity(type: JavaExec) { args = [nodeDirs, notaryType, notaryName] } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install', 'build', 'generateNotaryIdentity']) { +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build', 'generateNotaryIdentity']) { directory deployTo networkMap "Notary 1" node { diff --git a/samples/simm-valuation-demo/build.gradle b/samples/simm-valuation-demo/build.gradle index 84367c356c..23c54c3359 100644 --- a/samples/simm-valuation-demo/build.gradle +++ b/samples/simm-valuation-demo/build.gradle @@ -41,12 +41,12 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - compile "net.corda:corda:$corda_version" // TODO + runtime project(path: ":node", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') compile project(':finance') - compile project(':test-utils') + testCompile project(':test-utils') // Javax is required for webapis compile "org.glassfish.jersey.core:jersey-server:${jersey_version}" @@ -65,7 +65,7 @@ dependencies { compile "com.opengamma.strata:strata-math:${strata_version}" } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install', 'build']) { +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) { directory "./build/nodes" networkMap "Controller" node { diff --git a/samples/trader-demo/build.gradle b/samples/trader-demo/build.gradle index fab518ddc2..c1be618df3 100644 --- a/samples/trader-demo/build.gradle +++ b/samples/trader-demo/build.gradle @@ -45,7 +45,7 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - compile "net.corda:corda:$corda_version" // TODO + runtime project(path: ":node", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') @@ -65,7 +65,7 @@ dependencies { // Specify your cordapp's dependencies below, including dependent cordapps } -task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install', 'build']) { +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) { directory "./build/nodes" // This name "Notary" is hard-coded into TraderDemoClientApi so if you change it here, change it there too. // In this demo the node that runs a standalone notary also acts as the network map server.