Merge pull request #346 from corda/rnicoll-capsule-web-server

Add webserver Capsule configuration
This commit is contained in:
Clinton 2017-03-14 15:22:41 +00:00 committed by GitHub
commit 81dcec579e
13 changed files with 105 additions and 57 deletions

View File

@ -120,7 +120,7 @@ dependencies {
compile project(':node')
compile "com.google.guava:guava:$guava_version"
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
@ -186,7 +186,7 @@ bintrayConfig {
projectUrl = 'https://github.com/corda/corda'
gpgSign = true
gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
publications = ['client', 'core', 'corda', 'corda-webserver', 'finance', 'node', 'node-schemas', 'test-utils', 'jackson']
publications = ['client', 'core', 'corda', 'corda-webserver', 'finance', 'node', 'node-schemas', 'test-utils', 'jackson', 'webserver']
license {
name = 'Apache-2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'

View File

@ -49,7 +49,7 @@ dependencies {
}
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
}
mainClassName = "net.corda.docs.ClientRpcTutorialKt"

View File

@ -8,9 +8,9 @@ import javax.annotation.Generated;
@Generated("io.requery.processor.EntityProcessor")
public class Models {
public static final EntityModel VAULT = new EntityModelBuilder("vault")
.addType(VaultStatesEntity.$TYPE)
.addType(VaultTxnNoteEntity.$TYPE)
.addType(VaultCashBalancesEntity.$TYPE)
.addType(VaultStatesEntity.$TYPE)
.build();
private Models() {

View File

@ -1,10 +1,9 @@
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'us.kirchmeier.capsule'
// TODO: Break dependency on node and move to another location such as a submodule of client.
description 'Corda webserver module'
description 'Corda node web server'
repositories {
mavenLocal()
@ -18,7 +17,6 @@ repositories {
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
runtimeArtifacts
}
sourceSets {
@ -75,46 +73,4 @@ dependencies {
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
publish {
name = 'corda-webserver'
publishWar = false // TODO: Use WAR instead of JAR
disableDefaultJar = true
}
task buildWebserverJar(type: FatCapsule) {
applicationClass 'net.corda.webserver.WebServer'
archiveName "corda-webserver-${corda_version}.jar"
applicationSource = files(project.tasks.findByName('jar'), '../build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml')
from 'NOTICE' // Copy CDDL notice
capsuleManifest {
applicationVersion = corda_version
javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"]
systemProperties['visualvm.display.name'] = 'Corda Webserver'
systemProperties['corda.version'] = corda_version
minJavaVersion = '1.8.0'
// This version is known to work and avoids earlier 8u versions that have bugs.
minUpdateVersion['1.8'] = '102'
caplets = ['CordaCaplet']
// JVM configuration:
// - Constrain to small heap sizes to ease development on low end devices.
// - Switch to the G1 GC which is going to be the default in Java 9 and gives low pause times/string dedup.
//
// If you change these flags, please also update Driver.kt
jvmArgs = ['-Xmx200m', '-XX:+UseG1GC']
}
manifest {
attributes('Corda-Version': corda_version)
}
}
artifacts {
runtimeArtifacts buildWebserverJar
publish buildWebserverJar {
classifier ""
}
}
}

View File

@ -0,0 +1,91 @@
/**
* 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'
description 'Corda node web server capsule'
repositories {
mavenLocal()
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/exposed'
}
}
configurations {
runtimeArtifacts
}
// 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:webserver')
}
task buildWebserverJar(type: FatCapsule) {
applicationClass 'net.corda.webserver.WebServer'
archiveName "corda-webserver-${corda_version}.jar"
applicationSource = files(project.tasks.findByName('jar'), '../build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml')
from 'NOTICE' // Copy CDDL notice
capsuleManifest {
applicationVersion = corda_version
javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"]
systemProperties['visualvm.display.name'] = 'Corda Webserver'
systemProperties['corda.version'] = corda_version
minJavaVersion = '1.8.0'
// This version is known to work and avoids earlier 8u versions that have bugs.
minUpdateVersion['1.8'] = '102'
caplets = ['CordaCaplet']
// JVM configuration:
// - Constrain to small heap sizes to ease development on low end devices.
// - Switch to the G1 GC which is going to be the default in Java 9 and gives low pause times/string dedup.
//
// If you change these flags, please also update Driver.kt
jvmArgs = ['-Xmx200m', '-XX:+UseG1GC']
}
manifest {
attributes('Corda-Version': corda_version)
}
}
artifacts {
runtimeArtifacts buildWebserverJar
publish buildWebserverJar {
classifier ""
}
}
publish {
name = 'corda-webserver'
publishWar = false // TODO: Use WAR instead of JAR
disableDefaultJar = true
}

View File

@ -46,7 +46,7 @@ dependencies {
// Corda integration dependencies
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':test-utils')

View File

@ -46,7 +46,7 @@ dependencies {
// Corda integration dependencies
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':client')
compile project(':node')

View File

@ -49,7 +49,7 @@ dependencies {
// Corda integration dependencies
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':finance')
compile project(':node:webserver')

View File

@ -22,7 +22,7 @@ dependencies {
// Corda integration dependencies
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':finance')
testCompile project(':test-utils')

View File

@ -46,7 +46,7 @@ dependencies {
// Corda integration dependencies
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':client')
compile project(':node')

View File

@ -54,7 +54,7 @@ dependencies {
// Corda integration dependencies
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':node')
compile project(':node:webserver')

View File

@ -46,7 +46,7 @@ dependencies {
// Corda integration dependencies
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver", configuration: 'runtimeArtifacts')
runtime project(path: ":node:webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':finance')
compile project(':test-utils')

View File

@ -8,6 +8,7 @@ include 'node-schemas'
include 'node'
include 'node:capsule'
include 'node:webserver'
include 'node:webserver:webcapsule'
include 'client'
include 'client:jackson'
include 'experimental'