Skip to content

Commit e89d9e7

Browse files
authored
Split play-2.6 module (#10284)
* chore: Split play-2.6 into play-2.6, play-appsec-2.6, and play-appsec-2.7 modules * wip * chore: Rename play-appsec-2.7 test packages * chore: Use test-fixtures in play-appsec-2.6 * fix: Muzzle artifact was incorrect * chore: Remove needless gitignore * chore: Modernize build play-appsec-2.5 and play-appsec-2.7 configuration * chore: Re-run some tests on play 2.6 and play 2.7 * chore: Inline versions * fix: Proper inheritance of tests, disable appsec / Instrumentation Gateway tests in simple play-2.6 module * fix: play-appsec-2.7 has now two tests suite 2.7.+ and 2.+ (latest dep) * fix: Deduplicate config in play-appsec-2.5 (similar to play-appsec-2.7)
1 parent 9b5cd18 commit e89d9e7

File tree

62 files changed

+550
-362
lines changed

Some content is hidden

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

62 files changed

+550
-362
lines changed

buildSrc/src/main/kotlin/datadog/gradle/plugin/testJvmConstraints/TestJvmConstraintsUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ private fun TestJvmConstraintsExtension.withinAllowedRange(currentJvmVersion: Ja
3333
val definedMax = maxJavaVersion.isPresent
3434

3535
if (definedMin && (minJavaVersion.get()) > currentJvmVersion) {
36-
logger.info("isWithinAllowedRange returns false b/o minProp=${minJavaVersion.get()} is defined and greater than version=$currentJvmVersion")
36+
logger.info("'isWithinAllowedRange' returns false b/o testJvmConstraints.minJavaVersion=${minJavaVersion.get()} is defined and greater than test JVM version=$currentJvmVersion")
3737
return false
3838
}
3939

4040
if (definedMax && (maxJavaVersion.get()) < currentJvmVersion) {
41-
logger.info("isWithinAllowedRange returns false b/o maxProp=${maxJavaVersion.get()} is defined and lower than version=$currentJvmVersion")
41+
logger.info("'isWithinAllowedRange' returns false because testJvmConstraints.maxJavaVersion=${maxJavaVersion.get()} is defined and lower than test JVM version=$currentJvmVersion")
4242
return false
4343
}
4444

dd-java-agent/instrumentation/play/play-2.3/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

dd-java-agent/instrumentation/play/play-2.3/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ dependencies {
6060
}
6161

6262
tasks.named("compileLatestDepTestGroovy", GroovyCompile) {
63-
classpath += files(tasks.named('compileLatestDepTestScala').map { it.destinationDirectory })
63+
classpath += files(tasks.named('compileLatestDepTestScala'))
6464
}

dd-java-agent/instrumentation/play/play-2.4/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

dd-java-agent/instrumentation/play/play-2.6/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 18 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,43 @@
1-
def scalaVersion = '2.11'
2-
def playVersion = '2.6.0'
3-
41
muzzle {
52
extraRepository("typesafe", "https://repo.typesafe.com/typesafe/maven-releases/")
63

74
pass {
85
name = 'play26Plus'
96
group = 'com.typesafe.play'
10-
module = "play_$scalaVersion"
11-
versions = "[$playVersion,)"
7+
module = "play_2.11"
8+
versions = "[2.6.0,)"
129
assertInverse = true
1310
javaVersion = 11
1411
}
1512
pass {
1613
name = 'play26Plus'
1714
group = 'com.typesafe.play'
1815
module = 'play_2.12'
19-
versions = "[$playVersion,)"
16+
versions = "[2.6.0,)"
2017
assertInverse = true
2118
javaVersion = 11
2219
}
2320
pass {
2421
name = 'play26Plus'
2522
group = 'com.typesafe.play'
2623
module = 'play_2.13'
27-
versions = "[$playVersion,)"
24+
versions = "[2.6.0,)"
2825
assertInverse = true
2926
javaVersion = 11
3027
}
31-
3228
pass {
3329
name = 'play26Only'
3430
group = 'com.typesafe.play'
3531
module = 'play-java_2.11'
3632
versions = "[2.6.0,2.7.0)"
3733
assertInverse = true
3834
}
39-
40-
pass {
41-
name = 'play27'
42-
group = 'com.typesafe.play'
43-
module = 'play-java_2.13'
44-
versions = "[2.7.0,)"
45-
assertInverse = true
46-
javaVersion = 11
47-
}
4835
}
4936

5037
apply from: "$rootDir/gradle/java.gradle"
5138
apply plugin: 'scala'
39+
apply plugin: 'groovy'
40+
apply plugin: 'java-test-fixtures'
5241

5342
testJvmConstraints {
5443
// Play doesn't work with Java 9+ until 2.6.12
@@ -64,49 +53,22 @@ repositories {
6453
}
6554
}
6655

67-
addTestSuite('baseTest')
68-
addTestSuite('latestDepTest')
69-
70-
sourceSets {
71-
main_play27 {
72-
java.srcDirs "${project.projectDir}/src/main/java_play27"
73-
}
74-
}
75-
76-
tasks.named("jar", Jar) {
77-
from sourceSets.main_play27.output
78-
}
79-
80-
tasks.named("compileMain_play27Java", JavaCompile) {
81-
dependsOn(compileJava)
82-
}
83-
84-
project.afterEvaluate {
85-
tasks.named('instrumentJava') { dependsOn 'compileMain_play27Java' }
86-
tasks.named('forbiddenApisMain_play27') { dependsOn 'instrumentMain_play27Java' }
87-
}
88-
89-
instrument {
90-
additionalClasspath = [
91-
instrumentJava: compileMain_play27Java.destinationDirectory
92-
]
93-
}
94-
9556
dependencies {
96-
compileOnly group: 'com.typesafe.play', name: "play_$scalaVersion", version: playVersion
97-
compileOnly group: 'com.typesafe.play', name: "play-java_$scalaVersion", version: playVersion
57+
compileOnly group: 'com.typesafe.play', name: "play_2.11", version: '2.6.0'
58+
compileOnly group: 'com.typesafe.play', name: "play-java_2.11", version: '2.6.0'
9859

99-
main_play27CompileOnly group: 'com.typesafe.play', name: "play-java_$scalaVersion", version: '2.7.0'
100-
main_play27CompileOnly project(':internal-api')
101-
main_play27CompileOnly project(':dd-java-agent:agent-tooling')
102-
main_play27CompileOnly project(':dd-java-agent:agent-bootstrap')
103-
main_play27CompileOnly files("${project.buildDir}/classes/java/raw") {
104-
builtBy = ['compileJava']
60+
testFixturesCompileOnly group: 'com.typesafe.play', name: "play-java_2.11", version: '2.6.0'
61+
// TODO: Play WS is a separately versioned library starting with 2.6 and needs separate instrumentation.
62+
testFixturesCompileOnly(group: 'com.typesafe.play', name: "play-test_2.11", version: '2.6.0') {
63+
exclude group: 'org.eclipse.jetty.websocket', module: 'websocket-client'
10564
}
65+
testFixturesApi project(':dd-java-agent:instrumentation-testing')
66+
testFixturesApi libs.spock.core
10667

107-
baseTestImplementation group: 'com.typesafe.play', name: "play-java_$scalaVersion", version: playVersion
108-
// TODO: Play WS is a separately versioned library starting with 2.6 and needs separate instrumentation.
109-
baseTestImplementation(group: 'com.typesafe.play', name: "play-test_$scalaVersion", version: playVersion) {
68+
testImplementation group: 'com.typesafe.play', name: "play-java_2.11", version: '2.6.0'
69+
testImplementation testFixtures(project(':dd-java-agent:instrumentation:play:play-2.6'))
70+
testImplementation group: 'com.typesafe.play', name: "play-java_2.11", version: '2.6.0'
71+
testImplementation(group: 'com.typesafe.play', name: "play-test_2.11", version: '2.6.0') {
11072
exclude group: 'org.eclipse.jetty.websocket', module: 'websocket-client'
11173
}
11274

@@ -117,96 +79,5 @@ dependencies {
11779
testRuntimeOnly project(':dd-java-agent:instrumentation:scala:scala-concurrent-2.8')
11880
testRuntimeOnly project(':dd-java-agent:instrumentation:scala:scala-promise:scala-promise-2.10')
11981
testRuntimeOnly project(':dd-java-agent:instrumentation:scala:scala-promise:scala-promise-2.13')
120-
121-
latestDepTestRuntimeOnly sourceSets.baseTest.output
122-
latestDepTestImplementation libs.scala213
123-
latestDepTestImplementation group: 'com.typesafe.play', name: "play-java_2.13", version: '2.+'
124-
latestDepTestImplementation(group: 'com.typesafe.play', name: "play-test_2.13", version: '2.+') {
125-
exclude group: 'org.eclipse.jetty.websocket', module: 'websocket-client'
126-
}
127-
latestDepTestImplementation group: 'com.typesafe.play', name: 'play-akka-http-server_2.13', version: '2.+'
12882
}
12983

130-
configurations.matching({ it.name.startsWith('latestDepTest') }).configureEach({
131-
it.resolutionStrategy {
132-
// logback-classic 1.4.11 doesn't like being loaded in the bootstrap classloader (NPE)
133-
force group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.5'
134-
}
135-
})
136-
137-
tasks.named("compileLatestDepTestJava", JavaCompile) {
138-
configureCompiler(it, 11)
139-
}
140-
141-
tasks.named("compileLatestDepTestScala", ScalaCompile) {
142-
configureCompiler(it, 11)
143-
classpath = classpath + files(tasks.named('compileBaseTestJava').map { it.destinationDirectory })
144-
}
145-
146-
tasks.named("latestDepTest", Test) {
147-
javaLauncher = getJavaLauncherFor(11)
148-
testClassesDirs = testClassesDirs + sourceSets.baseTest.output.classesDirs
149-
}
150-
151-
final generatedRoutes = layout.buildDirectory.dir('generated/sources/latestDepTestRoutes/scala')
152-
sourceSets {
153-
routeGenerator {
154-
scala {
155-
srcDir "${project.projectDir}/src/routeGenerator/scala"
156-
}
157-
}
158-
latestDepTestGenerated {
159-
scala {
160-
srcDir generatedRoutes
161-
}
162-
}
163-
}
164-
165-
dependencies {
166-
routeGeneratorImplementation libs.scala213
167-
routeGeneratorImplementation group: 'com.typesafe.play', name: "routes-compiler_2.13", version: '2.+'
168-
}
169-
170-
configurations {
171-
latestDepTestGeneratedCompileClasspath.extendsFrom(latestDepTestCompileClasspath)
172-
}
173-
174-
tasks.register('buildLatestDepTestRoutes', JavaExec) {
175-
String routesFile = "${project.projectDir}/src/latestDepTest/routes/conf/routes"
176-
def outputDir = generatedRoutes
177-
178-
it.inputs.file routesFile
179-
it.outputs.dir outputDir
180-
181-
it.mainClass = 'generator.CompileRoutes'
182-
it.args routesFile, outputDir.get().asFile.absolutePath
183-
184-
it.classpath configurations.named('routeGeneratorRuntimeClasspath')
185-
it.classpath tasks.named('compileRouteGeneratorScala').map { it.destinationDirectory }
186-
it.classpath tasks.named('compileLatestDepTestScala').map { it.destinationDirectory }
187-
188-
it.javaLauncher = getJavaLauncherFor(11)
189-
}
190-
191-
tasks.named("compileLatestDepTestGeneratedScala", ScalaCompile) {
192-
configureCompiler(it, 11)
193-
classpath = classpath + files(tasks.named('compileLatestDepTestScala').map { it.destinationDirectory })
194-
dependsOn 'buildLatestDepTestRoutes'
195-
}
196-
197-
tasks.named("forbiddenApisLatestDepTestGenerated") {
198-
enabled = false
199-
}
200-
201-
tasks.named("compileLatestDepTestGroovy", GroovyCompile) {
202-
configureCompiler(it, 11)
203-
classpath = classpath +
204-
files(tasks.named('compileLatestDepTestScala').map { it.destinationDirectory }) +
205-
files(tasks.named('compileBaseTestGroovy').map { it.destinationDirectory }) +
206-
files(tasks.named('compileBaseTestJava').map { it.destinationDirectory }) +
207-
files(tasks.named('compileLatestDepTestGeneratedScala').map { it.destinationDirectory })
208-
}
209-
210-
dependencies {
211-
latestDepTestRuntimeOnly sourceSets.latestDepTestGenerated.output
212-
}

dd-java-agent/instrumentation/play/play-2.6/src/baseTest/groovy/datadog/trace/instrumentation/play26/server/PlayAsyncServerTest.groovy renamed to dd-java-agent/instrumentation/play/play-2.6/src/test/groovy/datadog/trace/instrumentation/play26/server/PlayAsyncServerTest.groovy

File renamed without changes.

dd-java-agent/instrumentation/play/play-2.6/src/baseTest/groovy/datadog/trace/instrumentation/play26/server/PlayAsyncServerWithErrorHandlerTest.groovy renamed to dd-java-agent/instrumentation/play/play-2.6/src/test/groovy/datadog/trace/instrumentation/play26/server/PlayAsyncServerWithErrorHandlerTest.groovy

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package datadog.trace.instrumentation.play26.server
2+
3+
class PlayServerTest extends AbstractPlayServerTest {
4+
// Disabling involving Appsec / Instrumentation Gateway, they are tested in play-appsec-2.x modules
5+
6+
@Override
7+
boolean testBlocking() {
8+
false
9+
}
10+
11+
@Override
12+
boolean testBlockingOnResponse() {
13+
false
14+
}
15+
16+
@Override
17+
boolean testRequestBody() {
18+
false
19+
}
20+
21+
@Override
22+
boolean testBodyJson() {
23+
false
24+
}
25+
26+
@Override
27+
boolean testBodyUrlencoded() {
28+
false
29+
}
30+
31+
@Override
32+
boolean testBodyMultipart() {
33+
false
34+
}
35+
36+
@Override
37+
boolean testResponseBodyJson() {
38+
false
39+
}
40+
41+
@Override
42+
Map<String, ?> expectedIGPathParams() {
43+
null
44+
}
45+
46+
@Override
47+
boolean testBodyXml() {
48+
false
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package datadog.trace.instrumentation.play26.server
2+
3+
class PlayServerWithErrorHandlerTest extends AbstractPlayServerWithErrorHandlerTest {
4+
// Disabling involving Appsec / Instrumentation Gateway, they are tested in play-appsec-2.x modules
5+
6+
@Override
7+
boolean testBlocking() {
8+
false
9+
}
10+
11+
@Override
12+
boolean testBlockingOnResponse() {
13+
false
14+
}
15+
16+
@Override
17+
boolean testRequestBody() {
18+
false
19+
}
20+
21+
@Override
22+
boolean testBodyJson() {
23+
false
24+
}
25+
26+
@Override
27+
boolean testBodyUrlencoded() {
28+
false
29+
}
30+
31+
@Override
32+
boolean testBodyMultipart() {
33+
false
34+
}
35+
36+
@Override
37+
boolean testResponseBodyJson() {
38+
false
39+
}
40+
41+
@Override
42+
Map<String, ?> expectedIGPathParams() {
43+
null
44+
}
45+
46+
@Override
47+
boolean testBodyXml() {
48+
false
49+
}
50+
}

0 commit comments

Comments
 (0)