Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ if (hasProperty('appBuildDir')) {

version = ""

// Target Java 8 bytecode as daemon can run on JDK 21
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// 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()
Expand All @@ -20,12 +24,16 @@ pluginManagement {

def isCI = providers.environmentVariable("CI").isPresent()

// Don't pollute the dependency cache with the build cache
// 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 {
// This needs to line up with the code in the outer project settings.gradle
directory = "$sharedRootDir/workspace/build-cache"
}
}
Expand Down
49 changes: 14 additions & 35 deletions dd-smoke-tests/spring-boot-2.7-webflux/build.gradle
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
apply from: "$rootDir/gradle/java.gradle"

description = 'Spring Boot 2.7 Webflux Smoke Tests.'

dependencies {
testImplementation project(':dd-smoke-tests')
plugins {
id 'dd-trace-java.smoke-test-app'
}

def appDir = "$projectDir/application"
def appBuildDir = "$buildDir/application"
def isWindows = System.getProperty("os.name").toLowerCase().contains("win")
def gradlewCommand = isWindows ? 'gradlew.bat' : 'gradlew'

// define the task that builds the project
tasks.register('webfluxBuild', Exec) {
workingDir "$appDir"
environment += [
"GRADLE_OPTS": "-Dorg.gradle.jvmargs='-Xmx512M'",
"JAVA_HOME": getLazyJavaHomeFor(8)
]
commandLine "$rootDir/${gradlewCommand}", "bootJar", "--no-daemon", "--max-workers=4", "-PappBuildDir=$appBuildDir", "-PapiJar=${project(':dd-trace-api').tasks.jar.archiveFile.get()}"

outputs.cacheIf { true }
apply from: "$rootDir/gradle/java.gradle"

outputs.dir(appBuildDir)
.withPropertyName("applicationJar")
description = 'Spring Boot 2.7 Webflux Smoke Tests.'

inputs.files(fileTree(appDir) {
include '**/*'
exclude '.gradle/**'
})
.withPropertyName("application")
.withPathSensitivity(PathSensitivity.RELATIVE)
smokeTestApp {
application {
taskName = 'webfluxBuild'
nestedTasks = ['bootJar']
artifactPath = 'libs/webflux-2.7-smoketest.jar'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other PR, I've already suggested to use calculated default and override only if it is really neeed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that in a follow-up

sysProperty = 'datadog.smoketest.webflux.uberJar.path'
}
projectJar('apiJar', project(':dd-trace-api'))
}

tasks.named("webfluxBuild", Exec) {
dependsOn project(':dd-trace-api').tasks.named("jar")
dependencies {
testImplementation project(':dd-smoke-tests')
}

tasks.named("compileTestGroovy", GroovyCompile) {
Expand All @@ -44,10 +27,6 @@ tasks.named("compileTestGroovy", GroovyCompile) {
}
}

tasks.withType(Test).configureEach {
jvmArgs "-Ddatadog.smoketest.webflux.uberJar.path=$appBuildDir/libs/webflux-2.7-smoketest.jar"
}

spotless {
java {
target "**/*.java"
Expand Down