Skip to content

Commit cec36f0

Browse files
committed
Additionally test JavaFX integration with JDK8
1 parent 2d5c1a7 commit cec36f0

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

ui/kotlinx-coroutines-javafx/build.gradle

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
plugins {
@@ -11,3 +11,30 @@ javafx {
1111
modules = [ 'javafx.controls' ]
1212
configuration = 'compile'
1313
}
14+
15+
task checkJdk8() {
16+
// only fail w/o JDK_8 when actually trying to compile, not during project setup phase
17+
doLast {
18+
if (!System.env.JDK_8) {
19+
throw new GradleException("JDK_8 environment variable is not defined. " +
20+
"Can't build against JDK 8 runtime and run JDK 8 compatibility tests. " +
21+
"Please ensure JDK 8 is installed and that JDK_8 points to it.")
22+
}
23+
}
24+
}
25+
26+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
27+
kotlinOptions.jdkHome = System.env.JDK_8
28+
// only fail when actually trying to compile, not during project setup phase
29+
dependsOn(checkJdk8)
30+
}
31+
32+
task jdk8Test(type: Test, dependsOn: [compileTestKotlin, checkJdk8]) {
33+
classpath = files { test.classpath }
34+
testClassesDirs = files { test.testClassesDirs }
35+
executable = "$System.env.JDK_8/bin/java"
36+
}
37+
38+
// Run these tests only during nightly stress test
39+
jdk8Test.onlyIf { project.properties['stressTest'] != null }
40+
build.dependsOn jdk8Test

0 commit comments

Comments
 (0)