Merge pull request #9 from corda/mnesbit-gradle-no-install-builds

Change gradle to not need an install step before build
This commit is contained in:
Matthew Nesbit 2016-11-30 17:12:19 +00:00 committed by GitHub
commit a976045675
11 changed files with 90 additions and 86 deletions

View File

@ -47,6 +47,7 @@ apply plugin: 'project-report'
apply plugin: 'com.github.ben-manes.versions' apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'net.corda.plugins.quasar-utils' 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 // 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 // IntelliJ gets confused when importing the project and ends up erasing and recreating the .idea directory, along
@ -92,6 +93,7 @@ repositories {
dependencies { dependencies {
compile project(':node') compile project(':node')
compile "com.google.guava:guava:19.0" compile "com.google.guava:guava:19.0"
runtime project(path: ":node", configuration: 'runtimeArtifacts')
} }
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) { task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
@ -119,74 +121,37 @@ tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}") reports.html.destination = file("${reporting.baseDir}/${name}")
} }
// TODO: Move fat JAR building into node subproject. task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) {
task buildCordaJAR(type: FatCapsule, dependsOn: ['jar', 'buildCertSigningRequestUtilityJAR']) { directory "./build/nodes"
applicationClass 'net.corda.node.MainKt' networkMap "Controller"
archiveName "corda-${corda_version}.jar" node {
applicationSource = files(project.tasks.findByName('jar'), 'node/build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml') name "Controller"
dirName "controller"
capsuleManifest { nearestCity "London"
appClassPath = ["jolokia-agent-war-${project.ext.jolokia_version}.war"] advertisedServices = ["corda.notary.validating"]
javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"] artemisPort 10002
minJavaVersion = '1.8.0' webPort 10003
caplets = ['CordaCaplet'] cordapps = []
} }
} node {
name "Bank A"
task buildCertSigningRequestUtilityJAR(type: FatCapsule, dependsOn: project.jar) { dirName "nodea"
applicationClass 'net.corda.node.utilities.certsigning.CertificateSignerKt' nearestCity "London"
archiveName 'certSigningRequestUtility.jar' advertisedServices = []
capsuleManifest { artemisPort 10004
systemProperties['log4j.configuration'] = 'log4j2.xml' webPort 10005
minJavaVersion = '1.8.0' cordapps = []
} }
} node {
name "Bank B"
// TODO: Use the Cordformation plugin. dirName "nodeb"
task deployNodes(dependsOn: 'buildCordaJAR') << { nearestCity "New York"
copy { advertisedServices = []
from buildCordaJAR.outputs.getFiles() artemisPort 10006
from 'config/dev/nameservernode.conf' webPort 10007
into "${buildDir}/nodes/nameserver" cordapps = []
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"
} }
} }
// Aliasing the publishToMavenLocal for simplicity. // Aliasing the publishToMavenLocal for simplicity.
// TODO: Verify this works for gradle plugins.
task(install, dependsOn: 'publishToMavenLocal') task(install, dependsOn: 'publishToMavenLocal')
publishing {
publications {
corda(MavenPublication) {
artifactId 'corda'
artifact buildCordaJAR {
classifier ""
}
}
}
}

View File

@ -36,17 +36,19 @@ sourceSets {
} }
} }
compileTestJava.dependsOn tasks.getByPath(':node:buildCordaJAR')
dependencies { dependencies {
compile project(':core') compile project(':core')
compile project(':client') compile project(':client')
compile project(':test-utils') testCompile project(':test-utils')
compile "org.graphstream:gs-core:1.3" compile "org.graphstream:gs-core:1.3"
compile("org.graphstream:gs-ui:1.3") { compile("org.graphstream:gs-ui:1.3") {
exclude group: "bouncycastle" exclude group: "bouncycastle"
} }
runtime "net.corda:corda:$corda_version" runtime project(path: ":node", configuration: 'runtimeArtifacts')
} }
mainClassName = "net.corda.docs.ClientRpcTutorialKt" mainClassName = "net.corda.docs.ClientRpcTutorialKt"
@ -70,7 +72,7 @@ task integrationTest(type: Test) {
classpath = sourceSets.integrationTest.runtimeClasspath 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" directory "./build/nodes"
networkMap "Notary" networkMap "Notary"
node { node {

View File

@ -34,18 +34,18 @@ This process only needs to be done once when the node connects to the network fo
Building the utility 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. You can also build the utility JAR by run the following command from the Corda project root directory.
**Windows**:: **Windows**::
gradlew.bat buildCertSigningRequestUtilityJAR gradlew.bat :node:buildCertSigningRequestUtilityJAR
**Other**:: **Other**::
./gradlew buildCertSigningRequestUtilityJAR ./gradlew :node:buildCertSigningRequestUtilityJAR
The utility JAR will be created in ``<Project Root Dir>/build/libs/certSigningRequestUtility.jar`` The utility JAR will be created in ``<Project Root Dir>/node/build/libs/certSigningRequestUtility.jar``
Running the utility Running the utility

View File

@ -29,5 +29,5 @@ dependencies {
compile project(':finance') compile project(':finance')
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
compile project(':test-utils') testCompile project(':test-utils')
} }

View File

@ -2,6 +2,7 @@ apply plugin: 'kotlin'
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'net.corda.plugins.quasar-utils' apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils' apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'us.kirchmeier.capsule'
repositories { repositories {
mavenLocal() mavenLocal()
@ -23,6 +24,8 @@ configurations {
integrationTestCompile.extendsFrom testCompile integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime 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 // 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 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 { publishing {
publications { publications {
node(MavenPublication) { node(MavenPublication) {
@ -175,5 +204,13 @@ publishing {
artifact sourceJar artifact sourceJar
artifact javadocJar artifact javadocJar
} }
corda(MavenPublication) {
artifactId 'corda'
artifact buildCordaJAR {
classifier ""
}
}
} }
} }

View File

@ -45,7 +45,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies // Corda integration dependencies
compile "net.corda:corda:$corda_version" // TODO runtime project(path: ":node", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client') compile project(':client')
compile project(':node') 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" directory "./build/nodes"
networkMap "Controller" networkMap "Controller"
node { node {

View File

@ -48,7 +48,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies // Corda integration dependencies
compile "net.corda:corda:$corda_version" // TODO runtime project(path: ":node", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client') compile project(':client')
compile project(':node') compile project(':node')
@ -63,7 +63,7 @@ dependencies {
compile 'com.squareup.okhttp3:okhttp:3.3.1' 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" directory "./build/nodes"
networkMap "Notary" networkMap "Notary"
node { node {

View File

@ -21,12 +21,12 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies // Corda integration dependencies
compile "net.corda:corda:$corda_version" // TODO runtime project(path: ":node", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client') compile project(':client')
compile project(':node') compile project(':node')
compile project(':finance') compile project(':finance')
compile project(':test-utils') testCompile project(':test-utils')
// Javax is required for webapis // Javax is required for webapis
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}" compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"

View File

@ -45,7 +45,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies // Corda integration dependencies
compile "net.corda:corda:$corda_version" // TODO runtime project(path: ":node", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client') compile project(':client')
compile project(':node') compile project(':node')
@ -81,7 +81,7 @@ task generateNotaryIdentity(type: JavaExec) {
args = [nodeDirs, notaryType, notaryName] 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 directory deployTo
networkMap "Notary 1" networkMap "Notary 1"
node { node {

View File

@ -41,12 +41,12 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies // Corda integration dependencies
compile "net.corda:corda:$corda_version" // TODO runtime project(path: ":node", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client') compile project(':client')
compile project(':node') compile project(':node')
compile project(':finance') compile project(':finance')
compile project(':test-utils') testCompile project(':test-utils')
// Javax is required for webapis // Javax is required for webapis
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}" compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
@ -65,7 +65,7 @@ dependencies {
compile "com.opengamma.strata:strata-math:${strata_version}" 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" directory "./build/nodes"
networkMap "Controller" networkMap "Controller"
node { node {

View File

@ -45,7 +45,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11' testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies // Corda integration dependencies
compile "net.corda:corda:$corda_version" // TODO runtime project(path: ":node", configuration: 'runtimeArtifacts')
compile project(':core') compile project(':core')
compile project(':client') compile project(':client')
compile project(':node') compile project(':node')
@ -65,7 +65,7 @@ dependencies {
// Specify your cordapp's dependencies below, including dependent cordapps // 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" directory "./build/nodes"
// This name "Notary" is hard-coded into TraderDemoClientApi so if you change it here, change it there too. // 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. // In this demo the node that runs a standalone notary also acts as the network map server.