diff --git a/djvm/build.gradle b/djvm/build.gradle index 04947e10e5..270bfc2375 100644 --- a/djvm/build.gradle +++ b/djvm/build.gradle @@ -1,20 +1,10 @@ -buildscript { - // Shaded version of ASM to avoid conflict with root project. - ext.asm_version = '6.1.1' - ext.deterministic_rt_version = '1.0-20180625.120901-7' - - repositories { - mavenCentral() - jcenter() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.3' - } +plugins { + id 'com.github.johnrengelman.shadow' version '2.0.4' } -plugins { - id 'com.github.johnrengelman.shadow' version '2.0.3' +ext { + // Shaded version of ASM to avoid conflict with root project. + asm_version = '6.1.1' } dependencies { @@ -32,47 +22,16 @@ dependencies { // Classpath scanner compile "io.github.lukehutch:fast-classpath-scanner:$fast_classpath_scanner_version" - // Deterministic runtime - used in whitelist generation - runtime "net.corda:deterministic-rt:$deterministic_rt_version:api" - // Test utilities testCompile "junit:junit:$junit_version" testCompile "org.assertj:assertj-core:$assertj_version" } -repositories { - mavenLocal() - mavenCentral() - maven { - url "$artifactory_contextUrl/corda-dev" - } -} - -task generateWhitelist(type: JavaExec) { - // This is an example of how a whitelist can be generated from a JAR. In most applications though, it is recommended - // thet the minimal set whitelist is used. - def jars = configurations.runtime.collect { - it.toString() - }.findAll { - it.toString().contains("deterministic-rt") - } - classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.djvm.tools.cli.Program' - args = ['whitelist', 'generate', '-o', 'src/main/resources/jdk8-deterministic.dat.gz'] + jars -} - -jar { - manifest { - attributes( - 'Automatic-Module-Name': 'net.corda.djvm' - ) - } -} +jar.enabled = false shadowJar { baseName = "djvm" classifier = "" - exclude 'deterministic-rt*.jar' dependencies { exclude(dependency('com.jcabi:.*:.*')) exclude(dependency('org.apache.*:.*:.*')) @@ -87,3 +46,4 @@ shadowJar { } } } +assemble.dependsOn shadowJar diff --git a/djvm/cli/build.gradle b/djvm/cli/build.gradle index 01a2324d5b..a3543bcc54 100644 --- a/djvm/cli/build.gradle +++ b/djvm/cli/build.gradle @@ -1,16 +1,15 @@ -buildscript { - repositories { - mavenCentral() - jcenter() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.3' +plugins { + id 'com.github.johnrengelman.shadow' +} + +repositories { + maven { + url "$artifactory_contextUrl/corda-dev" } } -plugins { - id 'com.github.johnrengelman.shadow' +configurations { + deterministicRt } dependencies { @@ -23,23 +22,29 @@ dependencies { compile "info.picocli:picocli:$picocli_version" compile "io.github.lukehutch:fast-classpath-scanner:$fast_classpath_scanner_version" compile project(path: ":djvm", configuration: "shadow") + + // Deterministic runtime - used in whitelist generation + deterministicRt project(path: ':jdk8u-deterministic', configuration: 'jdk') } -repositories { - mavenLocal() - mavenCentral() -} - -jar { - manifest { - attributes( - 'Main-Class': 'net.corda.djvm.tools.cli.Program', - 'Automatic-Module-Name': 'net.corda.djvm', - 'Build-Date': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ) - } -} +jar.enabled = false shadowJar { baseName = "corda-djvm" + classifier = 'cli' + manifest { + attributes( + 'Automatic-Module-Name': 'net.corda.djvm', + 'Main-Class': 'net.corda.djvm.tools.cli.Program', + 'Build-Date': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ) + } +} +assemble.dependsOn shadowJar + +task generateWhitelist(type: JavaExec, dependsOn: shadowJar) { + // This is an example of how a whitelist can be generated from a JAR. In most applications though, it is recommended + // that the minimal set whitelist is used. + main = '-jar' + args = [shadowJar.outputs.files.singleFile, 'whitelist', 'generate', '-o', "$buildDir/jdk8-deterministic.dat.gz", configurations.deterministicRt.files[0] ] } diff --git a/djvm/src/main/resources/jdk8-deterministic.dat.gz b/djvm/src/main/resources/jdk8-deterministic.dat.gz deleted file mode 100644 index d5b4cc27ec..0000000000 Binary files a/djvm/src/main/resources/jdk8-deterministic.dat.gz and /dev/null differ diff --git a/djvm/src/main/resources/kotlin-deterministic.dat.gz b/djvm/src/main/resources/kotlin-deterministic.dat.gz deleted file mode 100644 index 9145a13a18..0000000000 Binary files a/djvm/src/main/resources/kotlin-deterministic.dat.gz and /dev/null differ diff --git a/jdk8u-deterministic/build.gradle b/jdk8u-deterministic/build.gradle index 5bf793708f..ac17f952c7 100644 --- a/jdk8u-deterministic/build.gradle +++ b/jdk8u-deterministic/build.gradle @@ -45,3 +45,7 @@ task copyJdk(type: Copy) { assemble.dependsOn copyJdk jar.enabled = false + +artifacts { + jdk file: file(rt_jar), type: 'jar', builtBy: copyJdk +}