Victor Turansky | 964cd92 | 2020-05-02 19:52:56 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
| 3 | */ |
| 4 | |
| 5 | plugins { |
| 6 | id("org.openjfx.javafxplugin") |
| 7 | } |
| 8 | |
| 9 | javafx { |
| 10 | version = version("javafx") |
| 11 | modules = listOf("javafx.controls") |
| 12 | configuration = "compile" |
| 13 | } |
| 14 | |
| 15 | val JDK_18: String? by lazy { |
| 16 | System.getenv("JDK_18") |
| 17 | } |
| 18 | |
| 19 | val checkJdk8 by tasks.registering { |
| 20 | // only fail w/o JDK_18 when actually trying to test, not during project setup phase |
| 21 | doLast { |
| 22 | if (JDK_18 == null) { |
| 23 | throw GradleException( |
| 24 | """ |
| 25 | JDK_18 environment variable is not defined. |
| 26 | Can't run JDK 8 compatibility tests. |
| 27 | Please ensure JDK 8 is installed and that JDK_18 points to it. |
| 28 | """.trimIndent() |
| 29 | ) |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | val jdk8Test by tasks.registering(Test::class) { |
| 35 | // Run these tests only during nightly stress test |
| 36 | onlyIf { project.properties["stressTest"] != null } |
| 37 | |
| 38 | val test = tasks.test.get() |
| 39 | |
| 40 | classpath = test.classpath |
| 41 | testClassesDirs = test.testClassesDirs |
| 42 | executable = "$JDK_18/bin/java" |
| 43 | |
| 44 | dependsOn("compileTestKotlin") |
| 45 | dependsOn(checkJdk8) |
| 46 | } |
| 47 | |
| 48 | tasks.build { |
| 49 | dependsOn(jdk8Test) |
| 50 | } |