Skip to content

Commit

Permalink
Decouple test JDK and gradle JDK in karate latestDepTest (#8234)
Browse files Browse the repository at this point in the history
  • Loading branch information
smola authored Jan 17, 2025
1 parent f1d359b commit f05dac8
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions dd-java-agent/instrumentation/karate/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
ext {
// karate 1.4.0+ requires Java 11 or higher.
latestDepTestMinJavaVersionForTests = JavaVersion.VERSION_11
}

apply from: "$rootDir/gradle/java.gradle"

muzzle {
Expand All @@ -16,6 +21,8 @@ muzzle {
}

addTestSuiteForDir('latestDepTest', 'test')
// karate 1.3.1 is the last version supporting Java 8.
addTestSuiteForDir('karate131Test', 'test')

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

karate131TestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '1.3.1') {
// excluding logback to avoid conflicts with libs.bundles.test.logging
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
karate131TestImplementation (group: 'com.intuit.karate', name: 'karate-junit5', version: '1.3.1') {
// excluding logback to avoid conflicts with libs.bundles.test.logging
exclude group: 'ch.qos.logback', module: 'logback-classic'
}

latestDepTestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '+') {
// excluding logback to avoid conflicts with libs.bundles.test.logging
exclude group: 'ch.qos.logback', module: 'logback-classic'
Expand All @@ -51,18 +67,16 @@ sourceSets {
exclude '**/*.java'
}
}
karate131Test {
resources {
srcDir file('src/test/java')
exclude '**/*.java'
}
}
latestDepTest {
resources {
srcDir file('src/test/java')
exclude '**/*.java'
}
}
}

configurations.matching({ it.name.startsWith('latestDepTest') }).each({
it.resolutionStrategy {
// Karate 1.4.0+ is compiled with Java 11
force group: 'com.intuit.karate', name: 'karate-core', version: (JavaVersion.current().java11Compatible ? '+' : '1.3.1')
force group: 'com.intuit.karate', name: 'karate-junit5', version: (JavaVersion.current().java11Compatible ? '+' : '1.3.1')
}
})

0 comments on commit f05dac8

Please sign in to comment.