Skip to content

Commit bf9b90e

Browse files
sarahchen6bric3
andauthored
Update gradle compile tasks written in list format (#9618)
* Change compile task lists to lazy API formatting * Add types to Groovy and Java compilation tasks --------- Co-authored-by: Brice Dutheil <[email protected]>
1 parent 363b50a commit bf9b90e

File tree

58 files changed

+210
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+210
-164
lines changed

dd-java-agent/agent-profiling/profiling-controller-jfr/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ excludedClassesCoverage += ['com.datadog.profiling.controller.jfr.JdkTypeIDs']
3232

3333
// Shared JFR implementation. The earliest Java version JFR is working on is Java 8
3434

35-
tasks.named("compileTestJava") {
35+
tasks.named("compileTestJava", JavaCompile) {
3636
setJavaVersion(it, 11)
3737
// tests should be compiled in Java 8 compatible way
3838
sourceCompatibility = JavaVersion.VERSION_1_8

dd-java-agent/instrumentation/akka/akka-actor-2.5/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ apply from: "$rootDir/gradle/test-with-scala.gradle"
1818
addTestSuite('akka23Test')
1919
addTestSuiteForDir('latestDepTest', 'test')
2020

21-
tasks.named("compileAkka23TestGroovy") {
21+
tasks.named("compileAkka23TestGroovy", GroovyCompile) {
2222
classpath += files(sourceSets.akka23Test.scala.classesDirectory)
2323
}
2424

@@ -41,7 +41,7 @@ sourceSets {
4141
}
4242
}
4343
}
44-
tasks.named("compileLatestDepTestGroovy") {
44+
tasks.named("compileLatestDepTestGroovy", GroovyCompile) {
4545
classpath += files(sourceSets.latestDepTest.scala.classesDirectory)
4646
}
4747

dd-java-agent/instrumentation/akka/akka-http/akka-http-10.6/build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,27 @@ repositories {
4343

4444
addTestSuiteForDir('latestDepTest', 'test')
4545

46-
[compileMain_java11Java, compileTestScala, compileLatestDepTestScala].each {
47-
it.configure {
46+
tasks.named("compileMain_java11Java", JavaCompile) {
47+
setJavaVersion(it, 11)
48+
sourceCompatibility = JavaVersion.VERSION_1_8
49+
targetCompatibility = JavaVersion.VERSION_1_8
50+
}
51+
52+
["compileTestScala", "compileLatestDepTestScala"].each { name ->
53+
tasks.named(name, ScalaCompile) {
4854
setJavaVersion(it, 11)
4955
sourceCompatibility = JavaVersion.VERSION_1_8
5056
targetCompatibility = JavaVersion.VERSION_1_8
5157
}
5258
}
5359

54-
compileTestGroovy {
60+
tasks.named("compileTestGroovy", GroovyCompile) {
5561
javaLauncher = getJavaLauncherFor(11)
5662
dependsOn compileTestScala
5763
classpath += files(compileTestScala.destinationDirectory)
5864
}
5965

60-
compileLatestDepTestGroovy {
66+
tasks.named("compileLatestDepTestGroovy", GroovyCompile) {
6167
javaLauncher = getJavaLauncherFor(11)
6268
dependsOn compileLatestDepTestScala
6369
classpath += files(compileLatestDepTestScala.destinationDirectory)

dd-java-agent/instrumentation/armeria/armeria-jetty-1.24/build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ addTestSuiteForDir("jetty11Test", "test/jetty11")
2525
addTestSuiteExtendingForDir("jetty9LatestDepTest", "latestDepTest", "test/jetty9")
2626
addTestSuiteExtendingForDir("jetty11LatestDepTest", "latestDepTest", "test/jetty11")
2727

28-
[compileJetty11TestGroovy, jetty11Test, compileJetty11LatestDepTestGroovy, jetty11LatestDepTest].each {
29-
it.configure {
28+
["compileJetty11TestGroovy", "compileJetty11LatestDepTestGroovy"].each { name ->
29+
tasks.named(name, GroovyCompile) {
30+
javaLauncher = getJavaLauncherFor(11)
31+
}
32+
}
33+
34+
["jetty11Test", "jetty11LatestDepTest"].each { name ->
35+
tasks.named(name, Test) {
3036
javaLauncher = getJavaLauncherFor(11)
3137
}
3238
}

dd-java-agent/instrumentation/axis2-1.3/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ configurations.configureEach {
2323
}
2424
}
2525

26-
[compileLatestDepForkedTestGroovy, compileLatestDepTestGroovy].each {
27-
it.configure {
26+
["compileLatestDepForkedTestGroovy", "compileLatestDepTestGroovy"].each { name ->
27+
tasks.named(name, GroovyCompile) {
2828
javaLauncher = getJavaLauncherFor(11)
2929
}
3030
}
3131

32-
[compileLatestDepForkedTestJava, compileLatestDepTestJava].each {
33-
it.configure {
32+
["compileLatestDepForkedTestJava", "compileLatestDepTestJava"].each { name ->
33+
tasks.named(name, JavaCompile) {
3434
setJavaVersion(it, 11)
3535
}
3636
}

dd-java-agent/instrumentation/cxf-2.1/build.gradle

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@ apply from: "${rootDir}/gradle/java.gradle"
2323
addTestSuite('latestDepTest')
2424
addTestSuiteForDir('cxf3LatestDepTest', 'test')
2525

26-
[compileCxf3LatestDepTestJava].each {
27-
it.configure {
28-
setJavaVersion(it, 11)
29-
sourceCompatibility = JavaVersion.VERSION_1_8
30-
targetCompatibility = JavaVersion.VERSION_1_8
31-
}
26+
tasks.named("compileCxf3LatestDepTestJava", JavaCompile) {
27+
setJavaVersion(it, 11)
28+
sourceCompatibility = JavaVersion.VERSION_1_8
29+
targetCompatibility = JavaVersion.VERSION_1_8
3230
}
3331

34-
[compileLatestDepTestJava].each {
35-
it.configure {
36-
setJavaVersion(it, 17)
37-
sourceCompatibility = JavaVersion.VERSION_1_8
38-
targetCompatibility = JavaVersion.VERSION_1_8
39-
}
32+
tasks.named("compileLatestDepTestJava", JavaCompile) {
33+
setJavaVersion(it, 17)
34+
sourceCompatibility = JavaVersion.VERSION_1_8
35+
targetCompatibility = JavaVersion.VERSION_1_8
4036
}
4137

42-
[compileLatestDepTestGroovy, latestDepTest].each {
43-
it.configure {
44-
javaLauncher = getJavaLauncherFor(17)
45-
}
38+
tasks.named("compileLatestDepTestGroovy", GroovyCompile) {
39+
javaLauncher = getJavaLauncherFor(17)
4640
}
4741

48-
[compileCxf3LatestDepTestGroovy, cxf3LatestDepTest].each {
49-
it.configure {
50-
javaLauncher = getJavaLauncherFor(11)
51-
}
42+
tasks.named("latestDepTest", Test) {
43+
javaLauncher = getJavaLauncherFor(17)
44+
}
45+
46+
tasks.named("compileCxf3LatestDepTestGroovy", GroovyCompile) {
47+
javaLauncher = getJavaLauncherFor(11)
48+
}
49+
50+
tasks.named("cxf3LatestDepTest", Test) {
51+
javaLauncher = getJavaLauncherFor(11)
5252
}
5353

5454
dependencies {

dd-java-agent/instrumentation/exception-profiling/build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ dependencies {
1919
}
2020

2121
// Must use Java 11 to build JFR enabled code - there is no JFR in OpenJDK 8 (revisit once JFR in Java 8 is available)
22-
[compileMain_java11Java, compileTestJava].each {
23-
setJavaVersion(it, 11)
24-
it.sourceCompatibility = JavaVersion.VERSION_1_8
25-
it.targetCompatibility = JavaVersion.VERSION_1_8
26-
it.options.compilerArgs.addAll(['-Xlint:all,-processing,-options,-path'])
22+
["compileMain_java11Java", "compileTestJava"].each { name ->
23+
tasks.named(name, JavaCompile) {
24+
setJavaVersion(it, 11)
25+
it.sourceCompatibility = JavaVersion.VERSION_1_8
26+
it.targetCompatibility = JavaVersion.VERSION_1_8
27+
it.options.compilerArgs.addAll(['-Xlint:all,-processing,-options,-path'])
28+
}
2729
}
2830

2931
forbiddenApisMain_java11 {

dd-java-agent/instrumentation/finatra-2.9/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ dependencies {
3535
latestDepTestImplementation group: 'com.twitter', name: 'finatra-http_2.11', version: '+'
3636
}
3737

38-
tasks.named("compileLatestDepTestGroovy") {
38+
tasks.named("compileLatestDepTestGroovy", GroovyCompile) {
3939
classpath = classpath.plus(files(compileLatestDepTestScala.destinationDirectory))
4040
dependsOn "compileLatestDepTestScala"
4141
}
4242

43-
tasks.named("compileLatestPre207TestGroovy") {
43+
tasks.named("compileLatestPre207TestGroovy", GroovyCompile) {
4444
classpath = classpath.plus(files(compileLatestPre207TestScala.destinationDirectory))
4545
dependsOn "compileLatestPre207TestScala"
4646
}

dd-java-agent/instrumentation/graal/native-image/build.gradle

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ muzzle {
1313
apply from: "$rootDir/gradle/java.gradle"
1414
apply plugin: "idea"
1515

16-
[compileMain_java11Java, compileTestJava].each {
17-
it.sourceCompatibility = JavaVersion.VERSION_11
18-
it.targetCompatibility = JavaVersion.VERSION_11
19-
setJavaVersion(it, 11)
20-
it.options.compilerArgs.addAll([
21-
'-Xlint:all,-processing,-options,-path',
22-
'--add-modules',
23-
'jdk.internal.vm.ci',
24-
'--add-exports',
25-
'jdk.internal.vm.ci/jdk.vm.ci.meta=ALL-UNNAMED'
26-
])
16+
["compileMain_java11Java", "compileTestJava"].each { name ->
17+
tasks.named(name, JavaCompile) {
18+
it.sourceCompatibility = JavaVersion.VERSION_11
19+
it.targetCompatibility = JavaVersion.VERSION_11
20+
setJavaVersion(it, 11)
21+
it.options.compilerArgs.addAll([
22+
'-Xlint:all,-processing,-options,-path',
23+
'--add-modules',
24+
'jdk.internal.vm.ci',
25+
'--add-exports',
26+
'jdk.internal.vm.ci/jdk.vm.ci.meta=ALL-UNNAMED'
27+
])
28+
}
2729
}
2830

2931
dependencies {

dd-java-agent/instrumentation/jakarta-rs-annotations-3/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ apply from: "$rootDir/gradle/java.gradle"
1212
addTestSuiteForDir('latestDepTest', 'test')
1313
addTestSuiteExtendingForDir('latestDepJava11Test', 'latestDepTest', 'test')
1414

15-
tasks.named("compileLatestDepJava11TestJava") {
15+
tasks.named("compileLatestDepJava11TestJava", JavaCompile) {
1616
setJavaVersion(it, 11)
1717
}
18-
tasks.named("compileLatestDepJava11TestGroovy") {
18+
tasks.named("compileLatestDepJava11TestGroovy", GroovyCompile) {
1919
javaLauncher = getJavaLauncherFor(11)
2020
}
2121
tasks.named("latestDepJava11Test") {

0 commit comments

Comments
 (0)