Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class TestJvmSpec(val project: Project) {
project.providers.zip(testJvmSpec, normalizedTestJvm) { jvmSpec, testJvm ->
// Only change test JVM if it's not the one we are running the gradle build with
if ((jvmSpec as? SpecificInstallationToolchainSpec)?.javaHome == currentJavaHomePath.get()) {
project.providers.provider<JavaLauncher?> { null }
project.objects.property(JavaLauncher::class.java)
Copy link
Copy Markdown
Contributor

@bric3 bric3 May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: One of the changes in Gradle 9 is that properties do no allow null anymore. Maybe something better can be used there.

} else {
// The provider always says that a value is present so we need to wrap it for proper error messages
project.javaToolchains.launcherFor(jvmSpec).orElse(project.providers.provider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ class CallSiteInstrumentationPluginTest {
id 'dd-trace-java.call-site-instrumentation'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

csi {
suffix = 'CallSite'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class BuildTimeInstrumentationPluginTest {
id 'dd-trace-java.build-time-instrumentation'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
mavenCentral()
Expand Down Expand Up @@ -76,8 +78,10 @@ class BuildTimeInstrumentationPluginTest {
id 'dd-trace-java.build-time-instrumentation'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
mavenCentral()
Expand Down Expand Up @@ -121,8 +125,10 @@ class BuildTimeInstrumentationPluginTest {
id 'dd-trace-java.build-time-instrumentation'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions dd-java-agent/agent-iast/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import net.ltgt.gradle.errorprone.CheckSeverity
plugins {
id 'com.gradleup.shadow'
id 'me.champeau.jmh'
id 'com.google.protobuf' version '0.8.18'
id 'com.google.protobuf' version '0.9.5'
id 'net.ltgt.errorprone' version '3.1.0'
}

Expand Down Expand Up @@ -118,7 +118,7 @@ tasks.named("forbiddenApisJmh") {
sourceSets {
test {
java {
srcDirs += ["$buildDir/generated/source/proto/test/java"]
srcDir tasks.named("generateTestProto").map { "${it.outputBaseDir}/java" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This might be eager. So we might need to use a different approach.

}
}
}
Expand Down
4 changes: 2 additions & 2 deletions dd-java-agent/agent-jmxfetch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ tasks.register('copyMetricConfigs', CopyMetricConfigsTask) {
group = 'Build Setup'
description = 'Copy metrics.yaml files from integrations-core into resources'
inputDirectory = file("$projectDir/integrations-core")
outputDirectory = file("$buildDir/integrations-core-resources")
outputDirectory = layout.buildDirectory.dir("integrations-core-resources").get().asFile
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I see .get() here, I believe this could be improvement to rewrite the CopyMetricConfigsTask to use providers instead.

}

tasks.named("processResources", ProcessResources) {
dependsOn 'copyMetricConfigs'
from("$buildDir/integrations-core-resources")
from(layout.buildDirectory.dir("integrations-core-resources"))
}
6 changes: 4 additions & 2 deletions dd-java-agent/benchmark-integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ apply from: "$rootDir/gradle/java.gradle"

description = 'Integration Level Agent benchmarks.'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

subprojects { sub ->
sub.apply plugin: 'com.gradleup.shadow'
Expand Down
9 changes: 9 additions & 0 deletions dd-java-agent/instrumentation/aerospike-4.0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@ addTestSuiteForDir("latest7DepTest", "test")
addTestSuiteExtendingForDir("latestDepForkedTest", "latestDepTest", "test")
addTestSuiteExtendingForDir("latest7DepForkedTest", "latest7DepTest", "test")

tasks.named("test", Test) {
failOnNoDiscoveredTests = false
}

tasks.named("latestDepTest", Test) {
testJvmConstraints {
minJavaVersion = JavaVersion.VERSION_21
}
failOnNoDiscoveredTests = false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I've seen this as well albeit not when trying Gradle 9.3 on dd-trace-java, IIRC... I think a better solution is to add that flag within the logic of addTestSuiteExtendingForDir, addTestSuiteForDir, this could prevent adding this every time these test suite methods are used.

}

tasks.named("latest7DepTest", Test) {
failOnNoDiscoveredTests = false
}

tasks.named("latestDepForkedTest", Test) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.google.protobuf' version '0.8.18'
id 'com.google.protobuf' version '0.9.5'
}

muzzle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,9 @@ dependencies {
tasks.withType(Test).configureEach {
usesService(testcontainersLimit)
}

['test', 'latestDepTest', 'payloadTaggingTest', 'latestPayloadTaggingTest'].each { taskName ->
tasks.named(taskName, Test) {
failOnNoDiscoveredTests = false
}
}
4 changes: 4 additions & 0 deletions dd-java-agent/instrumentation/finatra-2.9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ apply from: "$rootDir/gradle/test-with-scala.gradle"
addTestSuiteForDir('latestPre207Test', 'test')
addTestSuite('latestDepTest')

tasks.named('latestPre207Test', Test) {
failOnNoDiscoveredTests = false
}

muzzle {
// There are some weird library issues below 2.9 so can't assert inverse
pass {
Expand Down
2 changes: 1 addition & 1 deletion dd-java-agent/instrumentation/grpc-1.5/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.google.protobuf' version '0.8.18'
id 'com.google.protobuf' version '0.9.5'
}

muzzle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ apply from: "$rootDir/gradle/java.gradle"

addTestSuiteForDir('latestDepTest', 'test')

tasks.named('test', Test) {
failOnNoDiscoveredTests = false
}

tasks.named('latestDepTest', Test) {
failOnNoDiscoveredTests = false
}

dependencies {
compileOnly group: 'com.hazelcast', name: 'hazelcast-all', version: '3.6'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ apply from: "$rootDir/gradle/java.gradle"

addTestSuiteForDir('latestDepTest', 'test')

tasks.named('test', Test) {
failOnNoDiscoveredTests = false
}

tasks.named('latestDepTest', Test) {
failOnNoDiscoveredTests = false
}

dependencies {
compileOnly group: 'com.hazelcast', name: 'hazelcast-all', version: '3.9'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ muzzle {
apply from: "$rootDir/gradle/java.gradle"

addTestSuiteForDir('latestDepTest', 'test')
tasks.named('latestDepTest', Test) {
failOnNoDiscoveredTests = false
}

dependencies {
compileOnly group: 'com.hazelcast', name: 'hazelcast-all', version: '4.0'
Expand Down
4 changes: 4 additions & 0 deletions dd-java-agent/instrumentation/ignite-2.0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ for (taskName in ['latestDepTest', 'latestDepForkedTest']) {
}
}
}

tasks.named('ignite216Test', Test) {
failOnNoDiscoveredTests = false
}
3 changes: 3 additions & 0 deletions dd-java-agent/instrumentation/jedis/jedis-4.0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ muzzle {
apply from: "$rootDir/gradle/java.gradle"

addTestSuiteForDir('latestDepTest', 'test')
tasks.named('latestDepTest', Test) {
failOnNoDiscoveredTests = false
}

dependencies {
compileOnly group: 'redis.clients', name: 'jedis', version: '4.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ dependencies {

configurations.named("testRuntimeOnly") {
exclude group: 'ch.qos.logback', module: 'logback-classic'
exclude group: 'org.codehaus.groovy', module: 'groovy-servlet'
}
configurations.named("webappRuntimeClasspath") {
exclude group: 'ch.qos.logback', module: 'logback-classic'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ muzzle {
}
}

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

configurations {
testImplementation.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
testCompile.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
}

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

testJvmConstraints {
// Log4j 1.x reached EOL in 2015 and is not compatible with Java 25+: https://endoflife.date/log4j
maxJavaVersion = JavaVersion.VERSION_24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ configurations {
// In order to test the real log4j library we need to remove the log4j transitive
// dependency 'log4j-over-slf4j' brought in by :dd-java-agent:testing which would shadow
// the log4j module under test using a proxy to slf4j instead.
testCompile.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
testImplementation.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
Copy link
Copy Markdown
Contributor

@bric3 bric3 May 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What was the problem with testCompile ?

}

muzzle {
Expand Down
31 changes: 17 additions & 14 deletions dd-java-agent/instrumentation/mule-4.5/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ configurations.configureEach {

sourceSets {
test {
output.dir("$buildDir/generated-resources/test", builtBy: 'generateAppResources')
output.dir(layout.buildDirectory.dir("generated-resources/test").get().asFile, builtBy: 'generateAppResources')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I. believe we can do that without .get().asFile

}
mule46ForkedTest {
output.dir("$buildDir/generated-resources/mule46ForkedTest", builtBy: 'generateAppResources46')
output.dir(layout.buildDirectory.dir("generated-resources/mule46ForkedTest").get().asFile, builtBy: 'generateAppResources46')
}
latestDepForkedTest {
output.dir("$buildDir/generated-resources/latestDepForkedTest", builtBy: 'generateAppResourcesLatest')
output.dir(layout.buildDirectory.dir("generated-resources/latestDepForkedTest").get().asFile, builtBy: 'generateAppResourcesLatest')
}
}

Expand Down Expand Up @@ -191,7 +191,7 @@ dependencies {
latestMuleServices group: 'org.mule.services', name: 'mule-service-weave', version: '2.8.1', classifier: 'mule-service'
}

def copyMuleArtifacts(String configName, String muleBaseDir, Sync sync) {
def copyMuleArtifacts(String configName, def muleBaseDir, Sync sync) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Looks odd to go back to untyped parameter.

configurations[configName].resolvedConfiguration.resolvedArtifacts.findAll {
it.classifier == "mule-service"
} collect { artifact ->
Expand All @@ -200,21 +200,21 @@ def copyMuleArtifacts(String configName, String muleBaseDir, Sync sync) {
into("${id.name}-${id.version}")
}
}
sync.into "$muleBaseDir/services"
sync.into muleBaseDir.map { it.dir("services").asFile }
}

// extract the enabled services into the mule base directory
tasks.register('extractMuleServices', Sync) {
dependsOn configurations.named('muleServices')
copyMuleArtifacts("muleServices", "$buildDir/mule/test", it)
copyMuleArtifacts("muleServices", layout.buildDirectory.dir("mule/test"), it)
}
tasks.register('extractMule46Services', Sync) {
dependsOn configurations.named('mule46Services')
copyMuleArtifacts("mule46Services", "$buildDir/mule/mule46ForkedTest", it)
copyMuleArtifacts("mule46Services", layout.buildDirectory.dir("mule/mule46ForkedTest"), it)
}
tasks.register('extractLatestMuleServices', Sync) {
dependsOn configurations.named('latestMuleServices')
copyMuleArtifacts("latestMuleServices", "$buildDir/mule/latestDepForkedTest", it)
copyMuleArtifacts("latestMuleServices", layout.buildDirectory.dir("mule/latestDepForkedTest"), it)
}

// build the mule application via maven
Expand All @@ -224,7 +224,7 @@ tasks.register('mvnPackage', Exec) {

List<String> mvnArgs = [
"$rootDir/mvnw",
"-Ddatadog.builddir=$buildDir",
"-Ddatadog.builddir=${layout.buildDirectory.get().asFile.absolutePath}",
"-Ddatadog.name=mule-test-application",
"-Ddatadog.version=$version",
"package"
Expand All @@ -237,7 +237,7 @@ tasks.register('mvnPackage', Exec) {

commandLine(mvnArgs)

outputs.dir("$buildDir/target")
outputs.dir(layout.buildDirectory.dir("target"))
inputs.dir("$appDir/src")
inputs.file("$appDir/pom.xml")
inputs.file("$appDir/mule-artifact.json")
Expand All @@ -255,12 +255,15 @@ tasks.register('generateAppResourcesLatest') {
}

def createAppResourceTask(Task task, String name) {
def generatedResourcesDir = "$buildDir/generated-resources/$name"
def buildDirectory = project.layout.buildDirectory
def muleBaseDir = buildDirectory.dir("mule/${name}")
def applicationJar = buildDirectory.file("target/mule-test-application-$version-mule-application.jar")
def generatedResourcesDir = buildDirectory.dir("generated-resources/${name}")
task.outputs.dir generatedResourcesDir
task.doLast {
def generated = new File(generatedResourcesDir, "test-build.properties")
generated.text = """|mule.base=$buildDir/mule/$name
|MuleTestApplicationConstants.jar=$buildDir/target/mule-test-application-$version-mule-application.jar
def generated = generatedResourcesDir.get().file("test-build.properties").asFile
generated.text = """|mule.base=${muleBaseDir.get().asFile.absolutePath}
|MuleTestApplicationConstants.jar=${applicationJar.get().asFile.absolutePath}
|MuleTestApplicationConstants.name=mule-test-application-$version-mule-application""".stripMargin()
}
}
Expand Down
10 changes: 1 addition & 9 deletions dd-java-agent/instrumentation/protobuf-3.0/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.google.protobuf' version '0.9.4'
id 'com.google.protobuf' version '0.9.5'
}

apply from: "$rootDir/gradle/java.gradle"
Expand Down Expand Up @@ -33,11 +33,3 @@ dependencies {
compileOnly group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0'
testImplementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0'
}

sourceSets {
test {
java {
srcDir "$buildDir/generated/source/proto/test/java"
}
}
}
8 changes: 6 additions & 2 deletions dd-java-agent/instrumentation/ratpack-1.5/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ dependencies {
compileOnly group: 'io.ratpack', name: 'ratpack-core', version: '1.5.0'

testImplementation project(':dd-java-agent:instrumentation:netty:netty-4.1')
testImplementation group: 'io.ratpack', name: 'ratpack-groovy-test', version: '1.5.0'
testImplementation(group: 'io.ratpack', name: 'ratpack-groovy-test', version: '1.5.0') {
exclude group: 'org.codehaus.groovy'
}
testImplementation 'com.sun.activation:jakarta.activation:1.2.2'
testImplementation project(':dd-java-agent:appsec:appsec-test-fixtures')
latestDepTestImplementation group: 'io.ratpack', name: 'ratpack-groovy-test', version: '1.+'
latestDepTestImplementation(group: 'io.ratpack', name: 'ratpack-groovy-test', version: '1.+') {
exclude group: 'org.codehaus.groovy'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ apply from: "$rootDir/gradle/java.gradle"

addTestSuiteForDir('latestDepTest', 'test')

tasks.named('test', Test) {
failOnNoDiscoveredTests = false
}

tasks.named('latestDepTest', Test) {
failOnNoDiscoveredTests = false
}

dependencies {
compileOnly group: 'com.sun.jersey', name: 'jersey-client', version: '1.1.4'

Expand Down
Loading