Skip to content

Commit a812edb

Browse files
authored
NOTICK: Ensure deterministic modules are compiled for Java 8. (#155)
1 parent 2fabc27 commit a812edb

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import static org.gradle.api.JavaVersion.VERSION_1_8
2+
13
buildscript {
24
ext {
35
corda_release_group = 'net.corda'
@@ -77,7 +79,7 @@ subprojects {
7779
kotlinOptions {
7880
languageVersion = "1.2"
7981
apiVersion = "1.2"
80-
jvmTarget = "1.8"
82+
jvmTarget = VERSION_1_8
8183
javaParameters = true // Useful for reflection.
8284
}
8385
}

deterministic.gradle

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import static org.gradle.api.JavaVersion.VERSION_1_8
2+
13
configurations {
24
compileClasspath { Configuration c -> deterministic(c) }
35
//runtimeClasspath { Configuration c -> deterministic(c) }
@@ -7,8 +9,25 @@ private final void deterministic(Configuration configuration) {
79
if (configuration.state == Configuration.State.UNRESOLVED) {
810
// Ensure that this module uses the deterministic Corda artifacts.
911
configuration.resolutionStrategy.dependencySubstitution {
10-
substitute module("$corda_release_group:corda-serialization:$corda_release_version") with module("$corda_release_group:corda-serialization-deterministic:$corda_release_version")
11-
substitute module("$corda_release_group:corda-core:$corda_release_version") with module("$corda_release_group:corda-core-deterministic:$corda_release_version")
12+
substitute module("$corda_release_group:corda-serialization") with module("$corda_release_group:corda-serialization-deterministic:$corda_release_version")
13+
substitute module("$corda_release_group:corda-core") with module("$corda_release_group:corda-core-deterministic:$corda_release_version")
14+
}
15+
}
16+
}
17+
18+
tasks.withType(JavaCompile) {
19+
// The DJVM only supports byte-code up to Java 8.
20+
sourceCompatibility = VERSION_1_8
21+
targetCompatibility = VERSION_1_8
22+
}
23+
24+
tasks.withType(AbstractCompile) {
25+
// This is a bit ugly, but Gradle isn't recognising the KotlinCompile task
26+
// as it does the built-in JavaCompile task.
27+
if (it.class.name.startsWith('org.jetbrains.kotlin.gradle.tasks.KotlinCompile')) {
28+
kotlinOptions {
29+
// The DJVM only supports byte-code up to Java 8.
30+
jvmTarget = VERSION_1_8
1231
}
1332
}
1433
}

0 commit comments

Comments
 (0)