CORDA-2876: Ensure that sandboxable byte-code is compiled for Java 8. (#5718)

CORDA-2876: Ensure that sandboxable byte-code is compiled for Java 8. (#5718)
This commit is contained in:
Jonathan Locke 2019-11-15 08:46:22 +00:00 committed by GitHub
commit f071445221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,5 @@
import static org.gradle.api.JavaVersion.VERSION_1_8
/*
* Gradle script plugin: Configure a module such that the Java and Kotlin
* compilers use the deterministic rt.jar instead of the full JDK rt.jar.
@ -19,11 +21,16 @@ tasks.withType(AbstractCompile) {
// This is a bit ugly, but Gradle isn't recognising the KotlinCompile task
// as it does the built-in JavaCompile task.
if (it.class.name.startsWith("org.jetbrains.kotlin.gradle.tasks.KotlinCompile")) {
kotlinOptions.jdkHome = deterministic_jdk_home
if (it.class.name.startsWith('org.jetbrains.kotlin.gradle.tasks.KotlinCompile')) {
kotlinOptions {
jdkHome = deterministic_jdk_home
jvmTarget = VERSION_1_8
}
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-bootclasspath' << deterministic_rt_jar
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8
}

View File

@ -1,3 +1,5 @@
import static org.gradle.api.JavaVersion.VERSION_1_8
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'net.corda.plugins.publish-utils'
@ -42,6 +44,18 @@ dependencies {
sandboxTesting "org.slf4j:slf4j-nop:$slf4j_version"
}
// The DJVM only supports Java 8 byte-code.
compileTestJava {
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8
}
compileTestKotlin {
kotlinOptions {
jvmTarget = VERSION_1_8
}
}
jar {
archiveBaseName = 'corda-serialization-djvm'
manifest {