CORDA-1800: Shrink the Simm Valuation Demo's contract states using ProGuard. (#3586)

* Shrink the Simm Valuation Demo's contract states CorDapp using ProGuard.
* Remove CordFormation from CorDapp modules, which unbundles Jolokia from the CorDapps.
* Preserve directory structure for CorDapp's own classes.
* Remove unwanted transitive dependencies from Simm Valuation CorDapps.
* Use allprojects {} to set Strata version property.
This commit is contained in:
Chris Rankin 2018-07-17 12:31:44 +01:00 committed by GitHub
parent 829be5dfb6
commit e879de70f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 44 deletions

View File

@ -216,6 +216,9 @@ allprojects {
force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
force "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
// Force dependencies to use the same version of Guava as Corda.
force "com.google.guava:guava:$guava_version"
// Demand that everything uses our given version of Netty.
eachDependency { details ->
if (details.requested.group == 'io.netty' && details.requested.name.startsWith('netty-')) {

View File

@ -1,4 +1,4 @@
gradlePluginsVersion=4.0.25
gradlePluginsVersion=4.0.26
kotlinVersion=1.2.51
platformVersion=4
guavaVersion=25.1-jre

View File

@ -1,5 +1,7 @@
buildscript {
ext.strata_version = '1.1.2'
allprojects {
ext {
strata_version = '1.1.2'
}
}
apply plugin: 'java'
@ -29,7 +31,7 @@ dependencies {
// The SIMM demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':samples:simm-valuation-demo:contracts-states')
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
cordapp project(':samples:simm-valuation-demo:flows')
// Corda integration dependencies
@ -39,25 +41,25 @@ dependencies {
cordaCompile project(':webserver')
// Javax is required for webapis
compile "org.glassfish.jersey.core:jersey-server:${jersey_version}"
compile "org.glassfish.jersey.core:jersey-server:$jersey_version"
// Cordapp dependencies
// Specify your cordapp's dependencies below, including dependent cordapps
compile "com.opengamma.strata:strata-basics:${strata_version}"
compile "com.opengamma.strata:strata-product:${strata_version}"
compile "com.opengamma.strata:strata-data:${strata_version}"
compile "com.opengamma.strata:strata-calc:${strata_version}"
compile "com.opengamma.strata:strata-pricer:${strata_version}"
compile "com.opengamma.strata:strata-report:${strata_version}"
compile "com.opengamma.strata:strata-market:${strata_version}"
compile "com.opengamma.strata:strata-collect:${strata_version}"
compile "com.opengamma.strata:strata-loader:${strata_version}"
compile "com.opengamma.strata:strata-math:${strata_version}"
compile "com.opengamma.strata:strata-basics:$strata_version"
compile "com.opengamma.strata:strata-product:$strata_version"
compile "com.opengamma.strata:strata-data:$strata_version"
compile "com.opengamma.strata:strata-calc:$strata_version"
compile "com.opengamma.strata:strata-pricer:$strata_version"
compile "com.opengamma.strata:strata-report:$strata_version"
compile "com.opengamma.strata:strata-market:$strata_version"
compile "com.opengamma.strata:strata-collect:$strata_version"
compile "com.opengamma.strata:strata-loader:$strata_version"
compile "com.opengamma.strata:strata-math:$strata_version"
// Test dependencies
testCompile project(':node-driver')
testCompile "junit:junit:$junit_version"
testCompile "org.assertj:assertj-core:${assertj_version}"
testCompile "org.assertj:assertj-core:$assertj_version"
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {

View File

@ -1,24 +1,76 @@
buildscript {
ext.strata_version = '1.1.2'
apply plugin: 'net.corda.plugins.cordapp'
def javaHome = System.getProperty('java.home')
def shrinkJar = file("$buildDir/libs/${project.name}-${project.version}-tiny.jar")
cordapp {
info {
vendor = 'R3'
}
}
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
configurations {
shrinkArtifacts
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The SIMM demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
// Corda integration dependencies
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
// Cordapp dependencies
// Specify your cordapp's dependencies below, including dependent cordapps
compile "com.opengamma.strata:strata-product:${strata_version}"
compile "com.opengamma.strata:strata-market:${strata_version}"
compile "com.opengamma.strata:strata-product:$strata_version"
compile "com.opengamma.strata:strata-market:$strata_version"
}
}
jar {
classifier = 'fat'
}
import proguard.gradle.ProGuardTask
task shrink(type: ProGuardTask) {
injars jar
outjars shrinkJar
libraryjars "$javaHome/lib/rt.jar"
libraryjars "$javaHome/lib/jce.jar"
configurations.runtime.forEach {
libraryjars it.path, filter: '!META-INF/versions/**'
}
dontwarn 'afu.org.checkerframework.**'
dontwarn 'co.paralleluniverse.**'
dontwarn 'org.checkerframework.**'
dontwarn 'org.joda.**'
dontnote
// We need to preserve our CorDapp's own directory structure so that Corda
// can find the contract classes.
keepdirectories 'net/corda/**'
keepattributes '*'
dontobfuscate
dontoptimize
verbose
// These are our CorDapp classes, so don't change these.
keep 'class net.corda.vega.** { *; }', includedescriptorclasses:true
// Until CorDapps are isolated from each other, we need to ensure that the
// versions of the classes that this CorDapp needs are still usable by other
// CorDapps. Unfortunately, this means that we cannot shrink them as much as
// we'd like to.
keepclassmembers 'class com.opengamma.strata.** { *; }', includedescriptorclasses:true
keepclassmembers 'class com.google.** { *; }', includedescriptorclasses:true
keepclassmembers 'class org.joda.** { *; }', includedescriptorclasses:true
}
jar.finalizedBy shrink
artifacts {
shrinkArtifacts file: shrinkJar, name: project.name, type: 'jar', extension: 'jar', classifier: 'tiny', builtBy: shrink
}

View File

@ -1,33 +1,32 @@
buildscript {
ext.strata_version = '1.1.2'
}
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
cordapp {
info {
vendor = 'R3'
}
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The SIMM demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':samples:simm-valuation-demo:contracts-states')
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
// Corda integration dependencies
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
// Cordapp dependencies
// Specify your cordapp's dependencies below, including dependent cordapps
compile "com.opengamma.strata:strata-basics:${strata_version}"
compile "com.opengamma.strata:strata-product:${strata_version}"
compile "com.opengamma.strata:strata-data:${strata_version}"
compile "com.opengamma.strata:strata-calc:${strata_version}"
compile "com.opengamma.strata:strata-pricer:${strata_version}"
compile "com.opengamma.strata:strata-report:${strata_version}"
compile "com.opengamma.strata:strata-market:${strata_version}"
compile "com.opengamma.strata:strata-collect:${strata_version}"
compile "com.opengamma.strata:strata-loader:${strata_version}"
compile "com.opengamma.strata:strata-math:${strata_version}"
compile "com.opengamma.strata:strata-basics:$strata_version"
compile "com.opengamma.strata:strata-product:$strata_version"
compile "com.opengamma.strata:strata-data:$strata_version"
compile "com.opengamma.strata:strata-calc:$strata_version"
compile "com.opengamma.strata:strata-pricer:$strata_version"
compile "com.opengamma.strata:strata-report:$strata_version"
compile "com.opengamma.strata:strata-market:$strata_version"
compile "com.opengamma.strata:strata-collect:$strata_version"
compile "com.opengamma.strata:strata-loader:$strata_version"
compile "com.opengamma.strata:strata-math:$strata_version"
}