forked from corda/corda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deterministic.gradle
36 lines (29 loc) · 1.09 KB
/
deterministic.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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.
*/
apply plugin: 'kotlin'
evaluationDependsOn(':jdk8u-deterministic')
def jdk8uDeterministic = project(':jdk8u-deterministic')
ext {
jdkTask = jdk8uDeterministic.tasks.named('assemble')
deterministic_jdk_home = jdk8uDeterministic.jdk_home
deterministic_rt_jar = jdk8uDeterministic.rt_jar
}
tasks.withType(AbstractCompile).configureEach {
dependsOn jdkTask
// 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
jvmTarget = VERSION_1_8
}
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-bootclasspath' << deterministic_rt_jar
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8
}