Skip to content

Commit 3ec072b

Browse files
committed
chore: More laziness on some Gradle configurations and jvmArgs
1 parent b281add commit 3ec072b

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

dd-smoke-tests/junit-console/build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import java.time.Duration
2-
import java.time.temporal.ChronoUnit
3-
41
apply from: "$rootDir/gradle/java.gradle"
52
description = 'JUnit Console Smoke Tests.'
63

@@ -11,7 +8,16 @@ dependencies {
118
}
129

1310
tasks.withType(Test).configureEach {
14-
jvmArgs "-Ddatadog.smoketest.junit.console.jar.path=${configurations.runtimeClasspath.find { it.name.contains('junit-platform-console-standalone') }}"
11+
jvmArgumentProviders.add(new CommandLineArgumentProvider() {
12+
@Override
13+
Iterable<String> asArguments() {
14+
def consoleJarFile = configurations.named("runtimeClasspath")
15+
.get()
16+
.find { it.name.contains("junit-platform-console-standalone") }
17+
18+
return ["-Ddatadog.smoketest.junit.console.jar.path=${consoleJarFile}"]
19+
}
20+
})
1521

1622
if (project.hasProperty("mavenRepositoryProxy")) {
1723
// propagate proxy URL to tests, to then propagate it to nested Gradle builds

dd-smoke-tests/springboot-tomcat/build.gradle

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,20 @@ dependencies {
4343

4444
tasks.register("unzip", Copy) {
4545
def zipFileNamePrefix = "tomcat"
46-
def zipPath = project.configurations.serverFile.find {
47-
it.name.startsWith(zipFileNamePrefix)
48-
}
49-
if (zipPath != null) {
50-
def zipFile = file(zipPath)
51-
def outputDir = file("${buildDir}")
52-
53-
from zipTree(zipFile)
54-
into outputDir
55-
} else {
56-
throw new GradleException("Can't find server zip file that starts with: " + zipFileNamePrefix)
46+
def serverZipTree = providers.provider {
47+
// eager access
48+
def zipPath = project.configurations.serverFile.find {
49+
it.name.startsWith(zipFileNamePrefix)
50+
}
51+
if (zipPath == null) {
52+
throw new GradleException("Can't find server zip file that starts with: " + zipFileNamePrefix)
53+
}
54+
zipTree(zipPath)
5755
}
5856

57+
from serverZipTree
58+
into layout.buildDirectory
59+
5960
// When tests are disabled this would still be run, so disable this manually
6061
onlyIf { !project.rootProject.hasProperty("skipTests") }
6162
}

0 commit comments

Comments
 (0)