Skip to content

Commit 838045f

Browse files
bric3devflow.devflow-routing-intake
andauthored
Small Gradle Style tweaks (#11306)
build: Fix some Gradle style around java compatibility build: Fix configuration creation order in log4j-1.2.4/build.gradle Accessing `testImplementation` configuration before applying `java.gradle` causes the configuration to be created prematurely. A plugin such jase the `java` plugin also creates this configuration. Gradle 9.x restricts this to avoid "anonymous" configuration creations. build: Additional correct configuration creation order Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
1 parent 8dda117 commit 838045f

6 files changed

Lines changed: 26 additions & 15 deletions

File tree

buildSrc/src/test/kotlin/datadog/gradle/plugin/csi/CallSiteInstrumentationPluginTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ class CallSiteInstrumentationPluginTest {
1818
id 'dd-trace-java.call-site-instrumentation'
1919
}
2020
21-
sourceCompatibility = JavaVersion.VERSION_1_8
22-
targetCompatibility = JavaVersion.VERSION_1_8
21+
java {
22+
sourceCompatibility = JavaVersion.VERSION_1_8
23+
targetCompatibility = JavaVersion.VERSION_1_8
24+
}
2325
2426
csi {
2527
suffix = 'CallSite'

buildSrc/src/test/kotlin/datadog/gradle/plugin/instrument/BuildTimeInstrumentationPluginTest.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ class BuildTimeInstrumentationPluginTest {
2121
id 'dd-trace-java.build-time-instrumentation'
2222
}
2323
24-
sourceCompatibility = JavaVersion.VERSION_1_8
25-
targetCompatibility = JavaVersion.VERSION_1_8
24+
java {
25+
sourceCompatibility = JavaVersion.VERSION_1_8
26+
targetCompatibility = JavaVersion.VERSION_1_8
27+
}
2628
2729
repositories {
2830
mavenCentral()
@@ -76,8 +78,10 @@ class BuildTimeInstrumentationPluginTest {
7678
id 'dd-trace-java.build-time-instrumentation'
7779
}
7880
79-
sourceCompatibility = JavaVersion.VERSION_1_8
80-
targetCompatibility = JavaVersion.VERSION_1_8
81+
java {
82+
sourceCompatibility = JavaVersion.VERSION_1_8
83+
targetCompatibility = JavaVersion.VERSION_1_8
84+
}
8185
8286
repositories {
8387
mavenCentral()
@@ -121,8 +125,10 @@ class BuildTimeInstrumentationPluginTest {
121125
id 'dd-trace-java.build-time-instrumentation'
122126
}
123127
124-
sourceCompatibility = JavaVersion.VERSION_1_8
125-
targetCompatibility = JavaVersion.VERSION_1_8
128+
java {
129+
sourceCompatibility = JavaVersion.VERSION_1_8
130+
targetCompatibility = JavaVersion.VERSION_1_8
131+
}
126132
127133
repositories {
128134
mavenCentral()

dd-java-agent/benchmark-integration/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ apply from: "$rootDir/gradle/java.gradle"
2525

2626
description = 'Integration Level Agent benchmarks.'
2727

28-
sourceCompatibility = JavaVersion.VERSION_1_8
29-
targetCompatibility = JavaVersion.VERSION_1_8
28+
java {
29+
sourceCompatibility = JavaVersion.VERSION_1_8
30+
targetCompatibility = JavaVersion.VERSION_1_8
31+
}
3032

3133
subprojects { sub ->
3234
sub.apply plugin: 'com.gradleup.shadow'

dd-java-agent/instrumentation/log4j/log4j-1.2.4/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ muzzle {
66
}
77
}
88

9+
apply from: "$rootDir/gradle/java.gradle"
10+
911
configurations {
1012
testImplementation.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
1113
testCompile.exclude group: 'org.slf4j', module: 'log4j-over-slf4j'
1214
}
1315

14-
apply from: "$rootDir/gradle/java.gradle"
15-
1616
testJvmConstraints {
1717
// Log4j 1.x reached EOL in 2015 and is not compatible with Java 25+: https://endoflife.date/log4j
1818
maxJavaVersion = JavaVersion.VERSION_24

dd-java-agent/instrumentation/owasp-esapi-2.1/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ muzzle {
77
}
88
}
99

10+
apply from: "$rootDir/gradle/java.gradle"
11+
1012
configurations.configureEach {
1113
// shut up about broken xml-api pom relocation
1214
resolutionStrategy {
1315
force 'xml-apis:xml-apis:1.4.01'
1416
}
1517
}
16-
17-
apply from: "$rootDir/gradle/java.gradle"
1818
apply plugin: 'dd-trace-java.call-site-instrumentation'
1919

2020
addTestSuiteForDir('latestDepTest', 'test')

dd-java-agent/instrumentation/spark/spark_2.12/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ muzzle {
1313
assertInverse = true
1414
}
1515
}
16+
apply from: "$rootDir/gradle/java.gradle"
17+
1618
configurations.configureEach {
1719
resolutionStrategy.deactivateDependencyLocking()
1820
}
19-
apply from: "$rootDir/gradle/java.gradle"
2021

2122
addTestSuiteForDir('latestDepTest', 'test')
2223
addTestSuite('test_spark24')

0 commit comments

Comments
 (0)