aboutsummaryrefslogtreecommitdiff
path: root/ui/kotlinx-coroutines-javafx/build.gradle.kts
blob: 9e30590cead0b07ea37381822d9833b71f8153e3 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

plugins {
    id("org.openjfx.javafxplugin") version "0.0.9"
}

javafx {
    version = version("javafx")
    modules = listOf("javafx.controls")
    configuration = "compileOnly"
}

sourceSets {
    test.configure {
        compileClasspath += configurations.compileOnly
        runtimeClasspath += configurations.compileOnly
    }
}

val JDK_18: String? by lazy {
    System.getenv("JDK_18")
}

val checkJdk8 by tasks.registering {
    // only fail w/o JDK_18 when actually trying to test, not during project setup phase
    doLast {
        if (JDK_18 == null) {
            throw GradleException(
                """
                JDK_18 environment variable is not defined.
                Can't run JDK 8 compatibility tests.
                Please ensure JDK 8 is installed and that JDK_18 points to it.
                """.trimIndent()
            )
        }
    }
}

val jdk8Test by tasks.registering(Test::class) {
    // Run these tests only during nightly stress test
    onlyIf { project.properties["stressTest"] != null }

    val test = tasks.test.get()

    classpath = test.classpath
    testClassesDirs = test.testClassesDirs
    executable = "$JDK_18/bin/java"

    dependsOn("compileTestKotlin")
    dependsOn(checkJdk8)
}

tasks.build {
    dependsOn(jdk8Test)
}