Skip to content

Commit f05dac8

Browse files
authored
Decouple test JDK and gradle JDK in karate latestDepTest (#8234)
1 parent f1d359b commit f05dac8

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

dd-java-agent/instrumentation/karate/build.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
ext {
2+
// karate 1.4.0+ requires Java 11 or higher.
3+
latestDepTestMinJavaVersionForTests = JavaVersion.VERSION_11
4+
}
5+
16
apply from: "$rootDir/gradle/java.gradle"
27

38
muzzle {
@@ -16,6 +21,8 @@ muzzle {
1621
}
1722

1823
addTestSuiteForDir('latestDepTest', 'test')
24+
// karate 1.3.1 is the last version supporting Java 8.
25+
addTestSuiteForDir('karate131Test', 'test')
1926

2027
dependencies {
2128
compileOnly group: 'com.intuit.karate', name: 'karate-core', version: '1.0.0'
@@ -33,6 +40,15 @@ dependencies {
3340
exclude group: 'ch.qos.logback', module: 'logback-classic'
3441
}
3542

43+
karate131TestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '1.3.1') {
44+
// excluding logback to avoid conflicts with libs.bundles.test.logging
45+
exclude group: 'ch.qos.logback', module: 'logback-classic'
46+
}
47+
karate131TestImplementation (group: 'com.intuit.karate', name: 'karate-junit5', version: '1.3.1') {
48+
// excluding logback to avoid conflicts with libs.bundles.test.logging
49+
exclude group: 'ch.qos.logback', module: 'logback-classic'
50+
}
51+
3652
latestDepTestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '+') {
3753
// excluding logback to avoid conflicts with libs.bundles.test.logging
3854
exclude group: 'ch.qos.logback', module: 'logback-classic'
@@ -51,18 +67,16 @@ sourceSets {
5167
exclude '**/*.java'
5268
}
5369
}
70+
karate131Test {
71+
resources {
72+
srcDir file('src/test/java')
73+
exclude '**/*.java'
74+
}
75+
}
5476
latestDepTest {
5577
resources {
5678
srcDir file('src/test/java')
5779
exclude '**/*.java'
5880
}
5981
}
6082
}
61-
62-
configurations.matching({ it.name.startsWith('latestDepTest') }).each({
63-
it.resolutionStrategy {
64-
// Karate 1.4.0+ is compiled with Java 11
65-
force group: 'com.intuit.karate', name: 'karate-core', version: (JavaVersion.current().java11Compatible ? '+' : '1.3.1')
66-
force group: 'com.intuit.karate', name: 'karate-junit5', version: (JavaVersion.current().java11Compatible ? '+' : '1.3.1')
67-
}
68-
})

0 commit comments

Comments
 (0)