diff --git a/build.gradle b/build.gradle index f984177d43..98f631836a 100644 --- a/build.gradle +++ b/build.gradle @@ -92,7 +92,7 @@ repositories { dependencies { compile project(':node') compile "com.google.guava:guava:19.0" - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') } task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) { diff --git a/docs/source/example-code/build.gradle b/docs/source/example-code/build.gradle index 470ef52172..9bc0aeb012 100644 --- a/docs/source/example-code/build.gradle +++ b/docs/source/example-code/build.gradle @@ -36,7 +36,7 @@ sourceSets { } } -compileTestJava.dependsOn tasks.getByPath(':node:buildCordaJAR') +compileTestJava.dependsOn tasks.getByPath(':node:capsule:buildCordaJAR') dependencies { compile project(':core') @@ -48,7 +48,7 @@ dependencies { exclude group: "bouncycastle" } - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') } mainClassName = "net.corda.docs.ClientRpcTutorialKt" diff --git a/node/build.gradle b/node/build.gradle index 03fdcf10b7..2d962ed1ab 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -2,7 +2,6 @@ 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' apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' @@ -26,18 +25,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 -// will get as far as the Capsule version checks, meaning that if your JVM is too old, you will at least get -// a sensible error message telling you what to do rather than a bytecode version exception that doesn't. -// If we introduce .java files into this module that need Java 8+ then we will have to push the caplet into -// its own module so its target can be controlled individually, but for now this suffices. -sourceCompatibility = 1.6 -targetCompatibility = 1.6 - sourceSets { integrationTest { kotlin { @@ -172,33 +161,6 @@ 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 -} - - bintray { user = System.getenv('CORDA_BINTRAY_USER') key = System.getenv('CORDA_BINTRAY_KEY') @@ -219,26 +181,6 @@ bintray { } } -bintray { - user = System.getenv('CORDA_BINTRAY_USER') - key = System.getenv('CORDA_BINTRAY_KEY') - publications = ['corda'] - dryRun = false - pkg { - repo = 'corda' - name = 'corda' - userOrg = 'r3' - licenses = ['Apache-2.0'] - - version { - gpg { - sign = true - passphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE') - } - } - } -} - publishing { publications { node(MavenPublication) { @@ -276,41 +218,5 @@ publishing { } } } - - corda(MavenPublication) { - artifactId 'corda' - - artifact buildCordaJAR { - classifier "" - } - - pom.withXml { - asNode().children().last() + { - resolveStrategy = Closure.DELEGATE_FIRST - name 'corda' - description 'Corda standalone node' - url 'https://github.com/corda/corda' - scm { - url 'https://github.com/corda/corda' - } - - licenses { - license { - name 'Apache-2.0' - url 'https://www.apache.org/licenses/LICENSE-2.0' - distribution 'repo' - } - } - - developers { - developer { - id 'R3' - name 'R3' - email 'dev@corda.net' - } - } - } - } - } } } \ No newline at end of file diff --git a/node/capsule/build.gradle b/node/capsule/build.gradle new file mode 100644 index 0000000000..063eeca767 --- /dev/null +++ b/node/capsule/build.gradle @@ -0,0 +1,127 @@ +/** + * This build.gradle exists to publish our capsule (executable fat jar) to maven. It cannot be placed in the + * node project because the bintray plugin cannot publish two modules from one project. + */ +apply plugin: 'net.corda.plugins.publish-utils' +apply plugin: 'us.kirchmeier.capsule' +apply plugin: 'maven-publish' +apply plugin: 'com.jfrog.bintray' + +repositories { + mavenCentral() +} + +configurations { + runtimeArtifacts.extendsFrom runtime +} + +// Force the Caplet to target Java 6. This ensures that running 'java -jar corda.jar' on any Java 6 VM upwards +// will get as far as the Capsule version checks, meaning that if your JVM is too old, you will at least get +// a sensible error message telling you what to do rather than a bytecode version exception that doesn't. +// If we introduce .java files into this module that need Java 8+ then we will have to push the caplet into +// its own module so its target can be controlled individually, but for now this suffices. +sourceCompatibility = 1.6 +targetCompatibility = 1.6 + +sourceSets { + test { + resources { + srcDir "../config/test" + } + } + main { + resources { + srcDir "../config/dev" + } + } +} + +dependencies { + compile project(':node') +} + +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 +} + +bintray { + user = System.getenv('CORDA_BINTRAY_USER') + key = System.getenv('CORDA_BINTRAY_KEY') + publications = ['corda'] + dryRun = false + pkg { + repo = 'corda' + name = 'corda' + userOrg = 'r3' + licenses = ['Apache-2.0'] + + version { + gpg { + sign = true + passphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE') + } + } + } +} + +publishing { + publications { + corda(MavenPublication) { + artifactId 'corda' + + artifact buildCordaJAR { + classifier "" + } + + pom.withXml { + asNode().children().last() + { + resolveStrategy = Closure.DELEGATE_FIRST + name 'corda' + description 'Corda standalone node' + url 'https://github.com/corda/corda' + scm { + url 'https://github.com/corda/corda' + } + + licenses { + license { + name 'Apache-2.0' + url 'https://www.apache.org/licenses/LICENSE-2.0' + distribution 'repo' + } + } + + developers { + developer { + id 'R3' + name 'R3' + email 'dev@corda.net' + } + } + } + } + } + } +} \ No newline at end of file diff --git a/samples/attachment-demo/build.gradle b/samples/attachment-demo/build.gradle index a0f09c3d9e..89991bc556 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 - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') diff --git a/samples/irs-demo/build.gradle b/samples/irs-demo/build.gradle index 27d3cd3ede..0400939e62 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 - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') diff --git a/samples/network-visualiser/build.gradle b/samples/network-visualiser/build.gradle index fcfbfbde06..5a0169a4ec 100644 --- a/samples/network-visualiser/build.gradle +++ b/samples/network-visualiser/build.gradle @@ -21,7 +21,7 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') diff --git a/samples/raft-notary-demo/build.gradle b/samples/raft-notary-demo/build.gradle index 9493636407..c0ed340679 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 - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') diff --git a/samples/simm-valuation-demo/build.gradle b/samples/simm-valuation-demo/build.gradle index 23c54c3359..d444858e82 100644 --- a/samples/simm-valuation-demo/build.gradle +++ b/samples/simm-valuation-demo/build.gradle @@ -41,7 +41,7 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' // Corda integration dependencies - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') diff --git a/samples/trader-demo/build.gradle b/samples/trader-demo/build.gradle index c1be618df3..403f5b879b 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 - runtime project(path: ":node", configuration: 'runtimeArtifacts') + runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts') compile project(':core') compile project(':client') compile project(':node') diff --git a/settings.gradle b/settings.gradle index 89b4247424..b63878100e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,6 +5,7 @@ include 'finance' include 'finance:isolated' include 'core' include 'node' +include 'node:capsule' include 'client' include 'experimental' include 'experimental:sandbox'