Skip to content

Commit 60a3521

Browse files
committed
disable tests on old java versions
1 parent 294f93c commit 60a3521

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

instrumentation/xxl-job/xxl-job-2.3.0/javaagent/build.gradle.kts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ val testLatestDeps = findProperty("testLatestDeps") as Boolean
3636

3737
testing {
3838
suites {
39-
val xxlJob33 by registering(JvmTestSuite::class) {
39+
val xxlJob33Test by registering(JvmTestSuite::class) {
4040
dependencies {
4141
val version = if (testLatestDeps) "latest.release" else "3.3.0"
4242
implementation("com.xuxueli:xxl-job-core:$version")
@@ -46,14 +46,26 @@ testing {
4646
}
4747
}
4848

49-
tasks.withType<Test>().configureEach {
50-
// required on jdk17
51-
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
52-
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
53-
jvmArgs("-Dotel.instrumentation.xxl-job.experimental-span-attributes=true")
54-
}
55-
5649
tasks {
50+
withType<Test>().configureEach {
51+
// required on jdk17
52+
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
53+
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")
54+
jvmArgs("-Dotel.instrumentation.xxl-job.experimental-span-attributes=true")
55+
}
56+
57+
named("compileXxlJob33TestJava", JavaCompile::class).configure {
58+
options.release.set(17)
59+
}
60+
val testJavaVersion =
61+
gradle.startParameter.projectProperties.get("testJavaVersion")?.let(JavaVersion::toVersion)
62+
?: JavaVersion.current()
63+
if (!testJavaVersion.isCompatibleWith(JavaVersion.VERSION_17)) {
64+
named("xxlJob33Test", Test::class).configure {
65+
enabled = false
66+
}
67+
}
68+
5769
check {
5870
dependsOn(testing.suites)
5971
}

0 commit comments

Comments
 (0)