Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 45 additions & 5 deletions dd-java-agent/instrumentation/karate-1.0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ muzzle {
versions = '[1.4.0,)'
javaVersion = 11
}
// Karate 1.5.0+ is published under io.karatelabs and compiled with Java 17
pass {
group = 'io.karatelabs'
module = 'karate-core'
versions = '[1.5.0,2.0.0)'
javaVersion = 17
}
}

addTestSuiteForDir('latestDepTest', 'test')
// karate 1.3.1 is the last version supporting Java 8.
addTestSuiteForDir('karate131Test', 'test')
// karate 1.4.1 is the last release on the com.intuit.karate groupId (Java 11).
addTestSuiteForDir('karate141Test', 'test')

dependencies {
compileOnly group: 'com.intuit.karate', name: 'karate-core', version: '1.0.0'
Expand All @@ -48,16 +57,34 @@ dependencies {
exclude group: 'ch.qos.logback', module: 'logback-classic'
}

latestDepTestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '+') {
karate141TestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '1.4.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-junit5', version: '+') {
karate141TestImplementation (group: 'com.intuit.karate', name: 'karate-junit5', version: '1.4.1') {
// excluding logback to avoid conflicts with libs.bundles.test.logging
exclude group: 'ch.qos.logback', module: 'logback-classic'
}

// Karate 1.5.0+ is published under io.karatelabs. Bound below 2.0.0 because Karate 2.x
// is a ground-up rewrite and does not publish karate-junit5.
// TODO: implement support for karate 2.x
latestDepTestImplementation (group: 'io.karatelabs', name: 'karate-core', version: '[1.5.0,2.0.0)') {
// excluding logback to avoid conflicts with libs.bundles.test.logging
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
latestDepTestImplementation (group: 'io.karatelabs', name: 'karate-junit5', version: '[1.5.0,2.0.0)') {
// excluding logback to avoid conflicts with libs.bundles.test.logging
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
}

// latestDepTest extends test (see gradle/test-suites.gradle), which pulls in com.intuit.karate
// 1.0.0. Drop the legacy coordinate so it does not collide with io.karatelabs on the classpath.
configurations.latestDepTestImplementation {
exclude group: 'com.intuit.karate'
}

// Using recommended Karate project layout where Karate feature files sit in same /test/java folders as their java counterparts
sourceSets {
test {
Expand All @@ -72,6 +99,12 @@ sourceSets {
exclude '**/*.java'
}
}
karate141Test {
resources {
srcDir file('src/test/java')
exclude '**/*.java'
}
}
latestDepTest {
resources {
srcDir file('src/test/java')
Expand All @@ -80,11 +113,18 @@ sourceSets {
}
}

tasks.named("compileLatestDepTestJava", JavaCompile) {
// karate 1.4.0+ requires Java 11: https://github.com/karatelabs/karate/releases/tag/v1.4.0
tasks.named("compileKarate141TestJava", JavaCompile) {
configureCompiler(it, 11, JavaVersion.VERSION_1_8)
}
tasks.named("karate141Test", Test) {
onlyIf { javaVersion.isJava11Compatible() }
}

tasks.named("compileLatestDepTestJava", JavaCompile) {
configureCompiler(it, 17, JavaVersion.VERSION_1_8)
}

// karate 1.4.0+ requires Java 11: https://github.com/karatelabs/karate/releases/tag/v1.4.0
tasks.named("latestDepTest", Test) {
onlyIf { javaVersion.isJava11Compatible() }
onlyIf { javaVersion >= JavaVersion.VERSION_17 }
}
Loading
Loading