diff --git a/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/NestedGradleBuild.kt b/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/NestedGradleBuild.kt index 7500e8dfdf2..2e7f06c93ab 100644 --- a/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/NestedGradleBuild.kt +++ b/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/NestedGradleBuild.kt @@ -54,6 +54,8 @@ abstract class NestedGradleBuild @Inject constructor( gradleDistributionBaseUrl.convention( project.providers.environmentVariable(MASS_READ_URL_ENV), ) + initScripts.convention(emptyList()) + gradleProperties.convention(emptyMap()) javaLauncher.convention( javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(DEFAULT_NESTED_JAVA_VERSION)) @@ -84,6 +86,12 @@ abstract class NestedGradleBuild @Inject constructor( @get:Optional abstract val gradleDistributionBaseUrl: Property + @get:Input + abstract val initScripts: ListProperty + + @get:Input + abstract val gradleProperties: MapProperty + @get:Nested abstract val javaLauncher: Property @@ -143,10 +151,18 @@ abstract class NestedGradleBuild @Inject constructor( val appBuildDirFile = applicationBuildDir.get().asFile val daemonJavaHome = javaLauncher.get().metadata.installationPath.asFile val gradleUserHomeDir = createGradleUserHome() + val initScriptFiles = writeInitScripts() val args = buildList { + initScriptFiles.forEach { script -> + add("--init-script") + add(script.absolutePath) + } add(if (buildCacheEnabled.get()) "--build-cache" else "--no-build-cache") add("-PappBuildDir=${appBuildDirFile.absolutePath}") + gradleProperties.get().forEach { (name, value) -> + addGradleProperty(name, value) + } projectJars.get().forEach { entry -> add("-P${entry.propertyName.get()}=${entry.file.get().asFile.absolutePath}") } @@ -240,6 +256,13 @@ abstract class NestedGradleBuild @Inject constructor( } } + private fun writeInitScripts(): List = + initScripts.get().mapIndexed { index, script -> + temporaryDir.resolve("init-$index.init.gradle.kts").also { file -> + file.writeText(script) + } + } + private fun findGradleExecutable(gradleUserHomeDir: File): File? = gradleUserHomeDir.walkTopDown().firstOrNull { file -> file.isFile && @@ -275,3 +298,14 @@ abstract class NestedGradleBuild @Inject constructor( const val GRADLE_STOP_TIMEOUT_SECONDS = 30L } } + +private fun MutableList.addGradleProperty(name: String, value: String?) { + if (!value.isNullOrBlank()) { + add("-P$name=$value") + } +} + +internal val PROXY_REPOSITORIES_INIT_SCRIPT: String = + NestedGradleBuild::class.java.getResource("proxy-repositories.init.gradle.kts") + ?.readText() + ?: error("Missing proxy-repositories.init.gradle.kts resource") diff --git a/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppExtension.kt b/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppExtension.kt index e999d1020ad..231816c547a 100644 --- a/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppExtension.kt +++ b/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppExtension.kt @@ -65,6 +65,10 @@ abstract class SmokeTestAppExtension @Inject constructor( internal abstract val projectJars: ListProperty + internal abstract val initScripts: ListProperty + + internal abstract val gradleProperties: MapProperty + init { applicationDir.convention(project.layout.projectDirectory.dir("application")) applicationBuildDir.convention(project.layout.buildDirectory.dir("application")) @@ -77,6 +81,28 @@ abstract class SmokeTestAppExtension @Inject constructor( languageVersion.set(JavaLanguageVersion.of(DEFAULT_NESTED_JAVA_VERSION)) }, ) + + val isCi = project.providers.environmentVariable("CI") + .map { it.equals("true", ignoreCase = true) } + .orElse(false) + initScripts.convention( + isCi.map { + if (it) { + listOf(PROXY_REPOSITORIES_INIT_SCRIPT) + } else { + emptyList() + } + }, + ) + gradleProperties.convention( + isCi.map { + if (it) { + proxyGradleProperties() + } else { + emptyMap() + } + }, + ) } /** @@ -189,6 +215,20 @@ abstract class SmokeTestAppExtension @Inject constructor( }, ) } + + private fun proxyGradleProperties(): Map { + val properties = mutableMapOf() + addGradleProperty(properties, "gradlePluginProxy") + addGradleProperty(properties, "mavenRepositoryProxy") + return properties + } + + private fun addGradleProperty(properties: MutableMap, name: String) { + val value = project.providers.gradleProperty(name).orNull + if (!value.isNullOrBlank()) { + properties[name] = value + } + } } /** DSL describing the nested-build invocation for one smoke-test application. */ diff --git a/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPlugin.kt b/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPlugin.kt index b6d6fe6b7ba..06c97503202 100644 --- a/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPlugin.kt +++ b/build-logic/smoke-test/src/main/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPlugin.kt @@ -3,6 +3,7 @@ package datadog.buildlogic.smoketest import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.create +import org.gradle.kotlin.dsl.withType /** * Exposes the [NestedGradleBuild] task type plus a `smokeTestApp` extension that wires the @@ -16,6 +17,10 @@ import org.gradle.kotlin.dsl.create */ class SmokeTestAppPlugin : Plugin { override fun apply(project: Project) { - project.extensions.create("smokeTestApp") + val extension = project.extensions.create("smokeTestApp") + project.tasks.withType().configureEach { + initScripts.convention(extension.initScripts) + gradleProperties.convention(extension.gradleProperties) + } } } diff --git a/build-logic/smoke-test/src/main/resources/datadog/buildlogic/smoketest/proxy-repositories.init.gradle.kts b/build-logic/smoke-test/src/main/resources/datadog/buildlogic/smoketest/proxy-repositories.init.gradle.kts new file mode 100644 index 00000000000..70fe8054b90 --- /dev/null +++ b/build-logic/smoke-test/src/main/resources/datadog/buildlogic/smoketest/proxy-repositories.init.gradle.kts @@ -0,0 +1,41 @@ +import org.gradle.api.Action +import org.gradle.api.Project +import org.gradle.api.initialization.Settings + +gradle.beforeSettings(Action { + val gradlePluginProxy = providers.gradleProperty("gradlePluginProxy").orNull + val mavenRepositoryProxy = providers.gradleProperty("mavenRepositoryProxy").orNull + + pluginManagement { + repositories { + mavenLocal() + gradlePluginProxy?.takeIf { it.isNotBlank() }?.let { proxy -> + maven { + url = java.net.URI(proxy) + isAllowInsecureProtocol = true + } + } + mavenRepositoryProxy?.takeIf { it.isNotBlank() }?.let { proxy -> + maven { + url = java.net.URI(proxy) + isAllowInsecureProtocol = true + } + } + gradlePluginPortal() + mavenCentral() + } + } + + gradle.beforeProject(Action { + repositories { + mavenLocal() + mavenRepositoryProxy?.takeIf { it.isNotBlank() }?.let { proxy -> + maven { + url = java.net.URI(proxy) + isAllowInsecureProtocol = true + } + } + mavenCentral() + } + }) +}) diff --git a/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppEndToEndTest.kt b/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppEndToEndTest.kt index a0966107f44..b8e8cd757f1 100644 --- a/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppEndToEndTest.kt +++ b/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppEndToEndTest.kt @@ -30,61 +30,22 @@ class SmokeTestAppEndToEndTest { private val outerSettings get() = projectDir.resolve("settings.gradle.kts").toFile() private val outerBuild get() = projectDir.resolve("build.gradle.kts").toFile() private val applicationDir get() = projectDir.resolve("application").toFile() + private val applicationBuildDir get() = projectDir.resolve("build/application").toFile() @BeforeEach fun setUp() { applicationDir.mkdirs() } - @Test - fun `application block registers a NestedGradleBuild task with the configured name`() { - writeOuterSettings() - outerBuild.writeText( - """ - plugins { - java - id("dd-trace-java.smoke-test-app") - } - - smokeTestApp { - javaLauncher.set( - javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(${currentMajorJdk()})) } - ) - application { - taskName.set("packageApp") - artifactPath.set("libs/test.jar") - sysProperty.set("test.path") - } - } - """.trimIndent(), - ) - - val result = runner("tasks", "--all").build() - - assertThat(result.output).contains("packageApp") - } - @Test fun `nested build produces the configured artifact`() { writeOuterSettings() - outerBuild.writeText( - """ - plugins { - java - id("dd-trace-java.smoke-test-app") - } - - smokeTestApp { - javaLauncher.set( - javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(${currentMajorJdk()})) } - ) - application { - taskName.set("buildJar") - artifactPath.set("libs/sample.jar") - sysProperty.set("sample.path") - } - } - """.trimIndent(), + writeSmokeTestAppBuild( + smokeTestApplication( + taskName = "buildJar", + artifactPath = "libs/sample.jar", + sysProperty = "sample.path", + ), ) writeInnerSettings() writeInnerBuild( @@ -101,68 +62,7 @@ class SmokeTestAppEndToEndTest { val result = runner("buildJar").build() assertThat(result.task(":buildJar")?.outcome).isEqualTo(TaskOutcome.SUCCESS) - assertThat(File(projectDir.toFile(), "build/application/libs/sample.jar")).exists() - } - - @Test - fun `plugin is a no-op when the application block is never called`() { - writeOuterSettings() - outerBuild.writeText( - """ - plugins { - java - id("dd-trace-java.smoke-test-app") - } - - smokeTestApp { - // No application block, no javaLauncher — should not blow up. - } - """.trimIndent(), - ) - - val result = runner("help").build() - - assertThat(result.output).contains("BUILD SUCCESSFUL") - } - - @Test - fun `manual NestedGradleBuild task registration works without the application block`() { - writeOuterSettings() - outerBuild.writeText( - """ - import datadog.buildlogic.smoketest.NestedGradleBuild - - plugins { - java - id("dd-trace-java.smoke-test-app") - } - - tasks.register("customBuild") { - applicationDir.set(layout.projectDirectory.dir("application")) - applicationBuildDir.set(layout.buildDirectory.dir("application")) - gradleVersion.set(gradle.gradleVersion) - javaLauncher.set( - javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(${currentMajorJdk()})) } - ) - tasksToRun.set(listOf("buildJar")) - } - """.trimIndent(), - ) - writeInnerSettings() - writeInnerBuild( - """ - tasks.register("buildJar") { - archiveFileName.set("custom.jar") - from(file("src")) - } - """.trimIndent(), - ) - File(applicationDir, "src").mkdir() - File(applicationDir, "src/hello.txt").writeText("hi") - - val result = runner("customBuild").build() - - assertThat(result.task(":customBuild")?.outcome).isEqualTo(TaskOutcome.SUCCESS) + assertThat(applicationOutput("libs/sample.jar")).exists() } @Test @@ -170,24 +70,12 @@ class SmokeTestAppEndToEndTest { writeOuterSettings() val inheritedGradleUserHome = projectDir.resolve("inherited-gradle-user-home").toFile() inheritedGradleUserHome.mkdirs() - outerBuild.writeText( - """ - plugins { - java - id("dd-trace-java.smoke-test-app") - } - - smokeTestApp { - javaLauncher.set( - javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(${currentMajorJdk()})) } - ) - application { - taskName.set("recordGradleEnvironment") - artifactPath.set("gradle-env.txt") - sysProperty.set("gradle.env.path") - } - } - """.trimIndent(), + writeSmokeTestAppBuild( + smokeTestApplication( + taskName = "recordGradleEnvironment", + artifactPath = "gradle-env.txt", + sysProperty = "gradle.env.path", + ), ) writeInnerSettings() writeInnerBuild( @@ -219,7 +107,7 @@ class SmokeTestAppEndToEndTest { ).build() assertThat(result.task(":recordGradleEnvironment")?.outcome).isEqualTo(TaskOutcome.SUCCESS) - val envFile = File(projectDir.toFile(), "build/application/gradle-env.txt") + val envFile = applicationOutput("gradle-env.txt") assertThat(envFile).exists() val lines = envFile.readLines() assertThat(lines).contains( @@ -235,6 +123,149 @@ class SmokeTestAppEndToEndTest { assertThat(File(gradleUserHomeDir)).doesNotExist() } + @Test + fun `nested build receives native app environment and provider backed file inputs`() { + writeOuterSettings() + File(projectDir.toFile(), "agent.jar").writeText("agent") + writeSmokeTestAppBuild( + """ + ${smokeTestApplication( + taskName = "recordNativeInputs", + artifactPath = "native-inputs.txt", + sysProperty = "native.inputs.path", + additionalConfig = """ + buildArguments.add("-Dnative.enabled=true") + environment.put("GRAALVM_HOME", providers.provider { "test-graalvm" }) + """, + )} + projectJar("agentPath", providers.provider { layout.projectDirectory.file("agent.jar") }) + """, + ) + writeInnerSettings() + writeInnerBuild( + """ + tasks.register("recordNativeInputs") { + val out = layout.buildDirectory.file("native-inputs.txt") + outputs.file(out) + doLast { + out.get().asFile.writeText( + listOf( + "graalvm=" + System.getenv("GRAALVM_HOME"), + "agentPath=" + project.findProperty("agentPath"), + "nativeEnabled=" + System.getProperty("native.enabled"), + ).joinToString(System.lineSeparator()) + ) + } + } + """.trimIndent(), + ) + + val result = runner("recordNativeInputs").build() + + assertThat(result.task(":recordNativeInputs")?.outcome).isEqualTo(TaskOutcome.SUCCESS) + val inputsFile = applicationOutput("native-inputs.txt") + assertThat(inputsFile).exists() + assertThat(inputsFile.readLines()).contains( + "graalvm=test-graalvm", + "agentPath=${projectDir.resolve("agent.jar").toFile().canonicalPath}", + "nativeEnabled=true", + ) + } + + @Test + fun `init scripts are not added outside CI`() { + writeOuterSettings() + writeSmokeTestAppBuild( + smokeTestApplication( + taskName = "recordInitScripts", + artifactPath = "init-script-count.txt", + sysProperty = "init.script.count.path", + ), + ) + writeInnerSettings() + writeInnerBuild( + """ + tasks.register("recordInitScripts") { + val out = layout.buildDirectory.file("init-script-count.txt") + outputs.file(out) + val initScriptCount = gradle.startParameter.initScripts.size + doLast { + out.get().asFile.writeText(initScriptCount.toString()) + } + } + """.trimIndent(), + ) + + val result = runner( + "recordInitScripts", + environment = mapOf("CI" to "false"), + ).build() + + assertThat(result.task(":recordInitScripts")?.outcome).isEqualTo(TaskOutcome.SUCCESS) + val countFile = applicationOutput("init-script-count.txt") + assertThat(countFile).exists() + assertThat(countFile.readText()).isEqualTo("0") + } + + @Test + fun `init script prepends Maven proxy repositories without overriding project repositories`() { + writeOuterSettings() + val proxyRepository = projectDir.resolve("proxy-maven-repo").toFile() + val projectRepository = projectDir.resolve("project-maven-repo").toFile() + writeMavenArtifact(proxyRepository, "com.example", "shared", "1.0", "proxy") + writeMavenArtifact(projectRepository, "com.example", "shared", "1.0", "project") + writeMavenArtifact(projectRepository, "com.example", "project-only", "1.0", "project-only") + writeSmokeTestAppBuild( + smokeTestApplication( + taskName = "resolveRepositories", + artifactPath = "resolved-repositories.txt", + sysProperty = "resolved.repositories.path", + ), + ) + writeInnerSettings() + writeInnerBuild( + """ + repositories { + maven { + url = uri("${projectRepository.toURI()}") + } + } + + dependencies { + implementation("com.example:shared:1.0") + implementation("com.example:project-only:1.0") + } + + tasks.register("resolveRepositories") { + val resolved = layout.buildDirectory.file("resolved-repositories.txt") + inputs.files(configurations.compileClasspath) + outputs.file(resolved) + doLast { + resolved.get().asFile.writeText( + configurations.compileClasspath.get() + .sortedBy { it.name } + .joinToString(System.lineSeparator()) { it.name + "=" + it.readText() } + ) + } + } + """.trimIndent(), + ) + + val result = runner( + "resolveRepositories", + "-PmavenRepositoryProxy=${proxyRepository.toURI()}", + environment = mapOf("CI" to "true"), + ).build() + + assertThat(result.task(":resolveRepositories")?.outcome).isEqualTo(TaskOutcome.SUCCESS) + val resolvedFile = applicationOutput("resolved-repositories.txt") + assertThat(resolvedFile).exists() + assertThat(resolvedFile.readLines()).containsExactly( + "project-only-1.0.jar=project-only", + "shared-1.0.jar=proxy", + ) + } + /** * `buildCacheEnabled` defaults to `false` and is plumbed through to the nested daemon as * an explicit `--no-build-cache` / `--build-cache` argument. The inner build records @@ -249,25 +280,13 @@ class SmokeTestAppEndToEndTest { expectedFlag: String, ) { writeOuterSettings() - outerBuild.writeText( - """ - plugins { - java - id("dd-trace-java.smoke-test-app") - } - - smokeTestApp { - javaLauncher.set( - javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(${currentMajorJdk()})) } - ) - application { - taskName.set("recordCacheFlag") - artifactPath.set("cache-flag.txt") - sysProperty.set("cache.flag.path") - $dslLine - } - } - """.trimIndent(), + writeSmokeTestAppBuild( + smokeTestApplication( + taskName = "recordCacheFlag", + artifactPath = "cache-flag.txt", + sysProperty = "cache.flag.path", + additionalConfig = dslLine, + ), ) writeInnerSettings() writeInnerBuild( @@ -286,7 +305,7 @@ class SmokeTestAppEndToEndTest { val result = runner("recordCacheFlag").build() assertThat(result.task(":recordCacheFlag")?.outcome).isEqualTo(TaskOutcome.SUCCESS) - val flagFile = File(projectDir.toFile(), "build/application/cache-flag.txt") + val flagFile = applicationOutput("cache-flag.txt") assertThat(flagFile).exists() assertThat(flagFile.readText().trim()).isEqualTo(expectedFlag) } @@ -311,28 +330,15 @@ class SmokeTestAppEndToEndTest { expectedSecondOutcome: TaskOutcome, ) { writeOuterSettings(withLocalBuildCache = true) - outerBuild.writeText( - """ - $extraOuterImports - plugins { - java - id("dd-trace-java.smoke-test-app") - } - - $extraOuterPreamble - - smokeTestApp { - javaLauncher.set( - javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(${currentMajorJdk()})) } - ) - application { - taskName.set("buildJar") - artifactPath.set("libs/sample.jar") - sysProperty.set("sample.path") - $envDslLine - } - } - """.trimIndent(), + writeSmokeTestAppBuild( + smokeTestApplication( + taskName = "buildJar", + artifactPath = "libs/sample.jar", + sysProperty = "sample.path", + additionalConfig = envDslLine, + ), + extraImports = extraOuterImports, + extraPreamble = extraOuterPreamble, ) writeInnerSettings() writeInnerBuild( @@ -355,7 +361,7 @@ class SmokeTestAppEndToEndTest { assertThat(first.task(":buildJar")?.outcome).isEqualTo(TaskOutcome.SUCCESS) // Wipe the output dir so the cache must serve it on the next run. - File(projectDir.toFile(), "build/application").deleteRecursively() + applicationBuildDir.deleteRecursively() val secondArgs = listOfNotNull( "buildJar", @@ -386,6 +392,66 @@ class SmokeTestAppEndToEndTest { ) } + private fun writeOuterBuild(buildScript: String) { + outerBuild.writeText(buildScript.trimIndent()) + } + + private fun writeSmokeTestAppBuild( + smokeTestAppBody: String, + extraImports: String = "", + extraPreamble: String = "", + ) { + val imports = extraImports.trimIndent() + val preamble = extraPreamble.trimIndent() + val body = smokeTestAppBody.trimIndent() + writeOuterBuild( + buildString { + if (imports.isNotBlank()) { + appendLine(imports) + appendLine() + } + appendLine("plugins {") + appendLine(" java") + appendLine(" id(\"dd-trace-java.smoke-test-app\")") + appendLine("}") + appendLine() + if (preamble.isNotBlank()) { + appendLine(preamble) + appendLine() + } + appendLine("smokeTestApp {") + appendLine(" javaLauncher.set(") + appendLine(" javaToolchains.launcherFor {") + appendLine(" languageVersion.set(JavaLanguageVersion.of(${currentMajorJdk()}))") + appendLine(" }") + appendLine(" )") + if (body.isNotBlank()) { + appendLine(body.prependIndent(" ")) + } + appendLine("}") + }, + ) + } + + private fun smokeTestApplication( + taskName: String, + artifactPath: String, + sysProperty: String, + additionalConfig: String = "", + ): String { + val config = additionalConfig.trimIndent() + return buildString { + appendLine("application {") + appendLine(" taskName.set(\"$taskName\")") + appendLine(" artifactPath.set(\"$artifactPath\")") + appendLine(" sysProperty.set(\"$sysProperty\")") + if (config.isNotBlank()) { + appendLine(config.prependIndent(" ")) + } + appendLine("}") + } + } + private fun writeInnerSettings() { File(applicationDir, "settings.gradle.kts").writeText( """ @@ -408,6 +474,31 @@ class SmokeTestAppEndToEndTest { ) } + private fun applicationOutput(relativePath: String): File = + applicationBuildDir.resolve(relativePath) + + private fun writeMavenArtifact( + repository: File, + groupId: String, + artifactId: String, + version: String, + jarContent: String, + ) { + val artifactDir = File(repository, "${groupId.replace('.', '/')}/$artifactId/$version") + artifactDir.mkdirs() + File(artifactDir, "$artifactId-$version.pom").writeText( + """ + + 4.0.0 + $groupId + $artifactId + $version + + """.trimIndent(), + ) + File(artifactDir, "$artifactId-$version.jar").writeText(jarContent) + } + private fun runner( vararg args: String, environment: Map? = null, diff --git a/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPluginTest.kt b/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPluginTest.kt index 7fa9d7c09f9..9df643a976c 100644 --- a/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPluginTest.kt +++ b/build-logic/smoke-test/src/test/kotlin/datadog/buildlogic/smoketest/SmokeTestAppPluginTest.kt @@ -68,22 +68,59 @@ class SmokeTestAppPluginTest { } @Test - fun `application task receives configured Gradle distribution base URL`() { + fun `application block registers NestedGradleBuild task with configured inputs`() { val project = ProjectBuilder.builder().build() project.apply() project.plugins.apply("dd-trace-java.smoke-test-app") val extension = project.extensions.getByType() + extension.gradleVersion.set("8.14.5") extension.gradleDistributionBaseUrl.set("https://mass.example") extension.application { taskName.set("packageApp") artifactPath.set("libs/test.jar") sysProperty.set("test.path") + nestedTasks.set(listOf("assemble", "check")) + buildArguments.add("-Ddemo=true") + environment.put("DEMO_ENV", "true") + buildCacheEnabled.set(true) } val task = project.tasks.getByName("packageApp") as NestedGradleBuild + assertThat(task.applicationDir.get().asFile) + .isEqualTo(project.layout.projectDirectory.dir("application").asFile) + assertThat(task.applicationBuildDir.get().asFile) + .isEqualTo(project.layout.buildDirectory.dir("application").get().asFile) + assertThat(task.gradleVersion.get()).isEqualTo("8.14.5") assertThat(task.gradleDistributionBaseUrl.get()).isEqualTo("https://mass.example") + assertThat(task.tasksToRun.get()).containsExactly("assemble", "check") + assertThat(task.buildArguments.get()).containsExactly("-Ddemo=true") + assertThat(task.environment.get()).containsEntry("DEMO_ENV", "true") + assertThat(task.buildCacheEnabled.get()).isTrue() + } + + @Test + fun `manual NestedGradleBuild task receives smokeTestApp conventions`() { + val project = ProjectBuilder.builder().build() + project.apply() + project.plugins.apply("dd-trace-java.smoke-test-app") + + val extension = project.extensions.getByType() + extension.initScripts.set(listOf("init-script")) + extension.gradleProperties.set( + mapOf("mavenRepositoryProxy" to "https://repo.example"), + ) + + val task = project.tasks.register("customBuild", NestedGradleBuild::class.java) { + applicationDir.set(project.layout.projectDirectory.dir("application")) + applicationBuildDir.set(project.layout.buildDirectory.dir("application")) + tasksToRun.set(listOf("buildJar")) + }.get() + + assertThat(task.initScripts.get()).containsExactly("init-script") + assertThat(task.gradleProperties.get()) + .containsEntry("mavenRepositoryProxy", "https://repo.example") } @Test diff --git a/dd-smoke-tests/apm-tracing-disabled/application/settings.gradle b/dd-smoke-tests/apm-tracing-disabled/application/settings.gradle index 1cd03bc7775..bcaf7090afe 100644 --- a/dd-smoke-tests/apm-tracing-disabled/application/settings.gradle +++ b/dd-smoke-tests/apm-tracing-disabled/application/settings.gradle @@ -1,41 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'apm-tracing-disabled-smoketest' diff --git a/dd-smoke-tests/armeria-grpc/application/settings.gradle b/dd-smoke-tests/armeria-grpc/application/settings.gradle index 9ca0c8f80dd..d2e709db66c 100644 --- a/dd-smoke-tests/armeria-grpc/application/settings.gradle +++ b/dd-smoke-tests/armeria-grpc/application/settings.gradle @@ -1,42 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -// The directory must line up with the outer project's settings.gradle. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='armeria-smoketest' diff --git a/dd-smoke-tests/kafka-2/application/settings.gradle b/dd-smoke-tests/kafka-2/application/settings.gradle index 52cb42bea22..c5c3c0a333d 100644 --- a/dd-smoke-tests/kafka-2/application/settings.gradle +++ b/dd-smoke-tests/kafka-2/application/settings.gradle @@ -1,41 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'kafka-2-smoketest' diff --git a/dd-smoke-tests/kafka-3/application/settings.gradle b/dd-smoke-tests/kafka-3/application/settings.gradle index b0697997e79..e1725dbf1b1 100644 --- a/dd-smoke-tests/kafka-3/application/settings.gradle +++ b/dd-smoke-tests/kafka-3/application/settings.gradle @@ -1,42 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -// The directory must line up with the outer project's settings.gradle. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='kafka-3-smoketest' diff --git a/dd-smoke-tests/openfeature/application/settings.gradle b/dd-smoke-tests/openfeature/application/settings.gradle index 6e990889506..467bf8a6e1a 100644 --- a/dd-smoke-tests/openfeature/application/settings.gradle +++ b/dd-smoke-tests/openfeature/application/settings.gradle @@ -1,41 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'openfeature-smoketest' diff --git a/dd-smoke-tests/quarkus-native/application/settings.gradle b/dd-smoke-tests/quarkus-native/application/settings.gradle index 0354c75957a..b638bdb51d2 100644 --- a/dd-smoke-tests/quarkus-native/application/settings.gradle +++ b/dd-smoke-tests/quarkus-native/application/settings.gradle @@ -1,37 +1,7 @@ pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } plugins { id 'io.quarkus' version "${quarkusPluginVersion}" } } -def isCI = providers.environmentVariable("CI").isPresent() - -// Don't pollute the dependency cache with the build cache -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - // This needs to line up with the code in the outer project settings.gradle - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='quarkus-native-smoketest' diff --git a/dd-smoke-tests/quarkus/application/settings.gradle b/dd-smoke-tests/quarkus/application/settings.gradle index aaf3ed2bded..ba43aae92d5 100644 --- a/dd-smoke-tests/quarkus/application/settings.gradle +++ b/dd-smoke-tests/quarkus/application/settings.gradle @@ -1,47 +1,9 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. // The inner `plugins { id 'io.quarkus' ... }` block resolves the Quarkus version from a // `quarkusPluginVersion` Gradle property forwarded by the outer build. pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } plugins { id 'io.quarkus' version "${quarkusPluginVersion}" } } -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -// The directory must line up with the outer project's settings.gradle. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='quarkus-smoketest' diff --git a/dd-smoke-tests/rum/wildfly-15/rum-ear/settings.gradle b/dd-smoke-tests/rum/wildfly-15/rum-ear/settings.gradle index 3a73f18a9c6..6ed979cd530 100644 --- a/dd-smoke-tests/rum/wildfly-15/rum-ear/settings.gradle +++ b/dd-smoke-tests/rum/wildfly-15/rum-ear/settings.gradle @@ -1,36 +1,3 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// Don't pollute the dependency cache with the build cache -if (isCI) { - def sharedRootDir = "$rootDir/../../../../" - buildCache { - local { - // This needs to line up with the code in the outer project settings.gradle - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='wildfly-rum-ear-smoketest' include 'war' diff --git a/dd-smoke-tests/spring-boot-2.7-webflux/application/settings.gradle b/dd-smoke-tests/spring-boot-2.7-webflux/application/settings.gradle index 0a322538e21..9b9ee52f7cb 100644 --- a/dd-smoke-tests/spring-boot-2.7-webflux/application/settings.gradle +++ b/dd-smoke-tests/spring-boot-2.7-webflux/application/settings.gradle @@ -1,42 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -// The directory must line up with the outer project's settings.gradle. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='webflux-2.7-smoketest' diff --git a/dd-smoke-tests/spring-boot-3.0-native/application/settings.gradle b/dd-smoke-tests/spring-boot-3.0-native/application/settings.gradle index 7fcf0cee762..6a385f675d4 100644 --- a/dd-smoke-tests/spring-boot-3.0-native/application/settings.gradle +++ b/dd-smoke-tests/spring-boot-3.0-native/application/settings.gradle @@ -1,34 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// Don't pollute the dependency cache with the build cache -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - // This needs to line up with the code in the outer project settings.gradle - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='native-3.0-smoketest' diff --git a/dd-smoke-tests/spring-boot-3.0-webflux/application/settings.gradle b/dd-smoke-tests/spring-boot-3.0-webflux/application/settings.gradle index a172759b60a..eaaebc83945 100644 --- a/dd-smoke-tests/spring-boot-3.0-webflux/application/settings.gradle +++ b/dd-smoke-tests/spring-boot-3.0-webflux/application/settings.gradle @@ -1,42 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -// The directory must line up with the outer project's settings.gradle. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='webflux-3.0-smoketest' diff --git a/dd-smoke-tests/spring-boot-3.0-webmvc/application/settings.gradle b/dd-smoke-tests/spring-boot-3.0-webmvc/application/settings.gradle index 96c76ec6c8b..000c60beac4 100644 --- a/dd-smoke-tests/spring-boot-3.0-webmvc/application/settings.gradle +++ b/dd-smoke-tests/spring-boot-3.0-webmvc/application/settings.gradle @@ -1,42 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -// The directory must line up with the outer project's settings.gradle. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='webmvc-3.0-smoketest' diff --git a/dd-smoke-tests/spring-boot-3.3-webmvc/application/settings.gradle b/dd-smoke-tests/spring-boot-3.3-webmvc/application/settings.gradle index 4f591488834..865944fcf62 100644 --- a/dd-smoke-tests/spring-boot-3.3-webmvc/application/settings.gradle +++ b/dd-smoke-tests/spring-boot-3.3-webmvc/application/settings.gradle @@ -1,42 +1 @@ -// The `gradlePluginProxy` / `mavenRepositoryProxy` properties point to internal Maven -// mirrors used by CI when the public repos are unreachable; they are forwarded from the -// outer build via the smoke-test plugin. `allowInsecureProtocol` is required because the -// mirrors are reached over plain HTTP inside the CI network. -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// On CI, point the local Gradle build cache to the shared workspace directory under the -// repository root, so cache entries are reused across the many smoke-test nested builds -// (and across CI jobs that mount the same workspace). See f6ec1f5cc8 / #982 for the -// root-level cache, and b34ccbc048 for the `isCI` gating — locally we keep the default -// per-user cache to avoid leaking entries into the repo tree. -// The directory must line up with the outer project's settings.gradle. -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='webmvc-3.3-smoketest' diff --git a/dd-smoke-tests/springboot-freemarker/application/settings.gradle b/dd-smoke-tests/springboot-freemarker/application/settings.gradle index c35041e5d73..8754dec7bbe 100644 --- a/dd-smoke-tests/springboot-freemarker/application/settings.gradle +++ b/dd-smoke-tests/springboot-freemarker/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-freemarker-smoketest' diff --git a/dd-smoke-tests/springboot-java-11/application/settings.gradle b/dd-smoke-tests/springboot-java-11/application/settings.gradle index d2356e2b0b3..42e7096d2fb 100644 --- a/dd-smoke-tests/springboot-java-11/application/settings.gradle +++ b/dd-smoke-tests/springboot-java-11/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-java-11-smoketest' diff --git a/dd-smoke-tests/springboot-java-17/application/settings.gradle b/dd-smoke-tests/springboot-java-17/application/settings.gradle index 83e3c7f2135..6821d57be3a 100644 --- a/dd-smoke-tests/springboot-java-17/application/settings.gradle +++ b/dd-smoke-tests/springboot-java-17/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-java-17-smoketest' diff --git a/dd-smoke-tests/springboot-jetty-jsp/application/settings.gradle b/dd-smoke-tests/springboot-jetty-jsp/application/settings.gradle index dad60537f79..4f91064eb73 100644 --- a/dd-smoke-tests/springboot-jetty-jsp/application/settings.gradle +++ b/dd-smoke-tests/springboot-jetty-jsp/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-jetty-jsp-smoketest' diff --git a/dd-smoke-tests/springboot-jpa/application/settings.gradle b/dd-smoke-tests/springboot-jpa/application/settings.gradle index ff156736e67..f3bbc9915fc 100644 --- a/dd-smoke-tests/springboot-jpa/application/settings.gradle +++ b/dd-smoke-tests/springboot-jpa/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-jpa-smoketest' diff --git a/dd-smoke-tests/springboot-openliberty-20/build.gradle b/dd-smoke-tests/springboot-openliberty-20/build.gradle index b8a4f0c8c5f..0215eb17761 100644 --- a/dd-smoke-tests/springboot-openliberty-20/build.gradle +++ b/dd-smoke-tests/springboot-openliberty-20/build.gradle @@ -11,6 +11,9 @@ def jarPath = "$buildDir/application/target/${jarName}" def isWindows = System.getProperty("os.name").toLowerCase().contains("win") def mvnwCommand = isWindows ? 'mvnw.cmd' : 'mvnw' +// Keep the Maven wrapper here until more Maven smoke-test applications need nested builds. +// The smoke-test-app plugin is Gradle-focused, and a Maven sibling task is not worth the +// extra API surface for only the two OpenLiberty applications. // compile the Open liberty spring boot server tasks.register('mvnStage', Exec) { workingDir("$appDir") diff --git a/dd-smoke-tests/springboot-openliberty-23/build.gradle b/dd-smoke-tests/springboot-openliberty-23/build.gradle index 68dc1ec98c7..43c7f8a193a 100644 --- a/dd-smoke-tests/springboot-openliberty-23/build.gradle +++ b/dd-smoke-tests/springboot-openliberty-23/build.gradle @@ -11,6 +11,9 @@ def jarPath = "$buildDir/application/target/${jarName}" def isWindows = System.getProperty("os.name").toLowerCase().contains("win") def mvnwCommand = isWindows ? 'mvnw.cmd' : 'mvnw' +// Keep the Maven wrapper here until more Maven smoke-test applications need nested builds. +// The smoke-test-app plugin is Gradle-focused, and a Maven sibling task is not worth the +// extra API surface for only the two OpenLiberty applications. // compile the Open liberty spring boot server tasks.register('mvnStage', Exec) { workingDir("$appDir") diff --git a/dd-smoke-tests/springboot-thymeleaf/application/settings.gradle b/dd-smoke-tests/springboot-thymeleaf/application/settings.gradle index 0dbff5f340e..995da126473 100644 --- a/dd-smoke-tests/springboot-thymeleaf/application/settings.gradle +++ b/dd-smoke-tests/springboot-thymeleaf/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-thymeleaf-smoketest' diff --git a/dd-smoke-tests/springboot-tomcat-jsp/application/settings.gradle b/dd-smoke-tests/springboot-tomcat-jsp/application/settings.gradle index 1c31089a007..1861e72bcc6 100644 --- a/dd-smoke-tests/springboot-tomcat-jsp/application/settings.gradle +++ b/dd-smoke-tests/springboot-tomcat-jsp/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-tomcat-jsp-smoketest' diff --git a/dd-smoke-tests/springboot-tomcat/application/settings.gradle b/dd-smoke-tests/springboot-tomcat/application/settings.gradle index c526fe40384..20dc3c0222b 100644 --- a/dd-smoke-tests/springboot-tomcat/application/settings.gradle +++ b/dd-smoke-tests/springboot-tomcat/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-tomcat-smoketest' diff --git a/dd-smoke-tests/springboot-velocity/application/settings.gradle b/dd-smoke-tests/springboot-velocity/application/settings.gradle index 0d5e7d082bc..9a60bc37ec2 100644 --- a/dd-smoke-tests/springboot-velocity/application/settings.gradle +++ b/dd-smoke-tests/springboot-velocity/application/settings.gradle @@ -1,32 +1 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name = 'springboot-velocity-smoketest' diff --git a/dd-smoke-tests/wildfly/spring-ear/settings.gradle b/dd-smoke-tests/wildfly/spring-ear/settings.gradle index b829474a50b..23e16079c29 100644 --- a/dd-smoke-tests/wildfly/spring-ear/settings.gradle +++ b/dd-smoke-tests/wildfly/spring-ear/settings.gradle @@ -1,36 +1,3 @@ -pluginManagement { - repositories { - mavenLocal() - if (settings.hasProperty("gradlePluginProxy")) { - maven { - url settings["gradlePluginProxy"] - allowInsecureProtocol = true - } - } - if (settings.hasProperty("mavenRepositoryProxy")) { - maven { - url settings["mavenRepositoryProxy"] - allowInsecureProtocol = true - } - } - gradlePluginPortal() - mavenCentral() - } -} - -def isCI = providers.environmentVariable("CI").isPresent() - -// Don't pollute the dependency cache with the build cache -if (isCI) { - def sharedRootDir = "$rootDir/../../../" - buildCache { - local { - // This needs to line up with the code in the outer project settings.gradle - directory = "$sharedRootDir/workspace/build-cache" - } - } -} - rootProject.name='wildfly-spring-ear-smoketest' include 'war'