-
Notifications
You must be signed in to change notification settings - Fork 336
Extract Spring Boot 2.x app source into nested-build subprojects #11408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
a5824d8
1562192
0139443
6b7e87c
f997aa7
5c3a181
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Spring Boot 2.7.x is the last line that still supports Java 8, which this smoke test | ||
| // exercises (see the `sourceCompatibility = '1.8'` below). Do not bump to 3.x without | ||
| // also moving the smoke test off Java 8. | ||
| plugins { | ||
| id 'java' | ||
| id 'org.springframework.boot' version '2.7.15' | ||
| id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
| } | ||
|
|
||
| def sharedRootDir = "$rootDir/../../../" | ||
| def sharedConfigDirectory = "$sharedRootDir/gradle" | ||
| rootProject.ext.sharedConfigDirectory = sharedConfigDirectory | ||
|
|
||
| apply from: "$sharedConfigDirectory/repositories.gradle" | ||
|
|
||
| if (hasProperty('appBuildDir')) { | ||
| buildDir = property('appBuildDir') | ||
| } | ||
|
|
||
| version = "" | ||
|
|
||
| java { | ||
| sourceCompatibility = '1.8' | ||
| } | ||
|
|
||
| if (hasProperty('apiJar')) { | ||
| dependencies { | ||
| implementation files(property('apiJar')) | ||
| } | ||
| } else { | ||
| dependencies { | ||
| implementation "com.datadoghq:dd-trace-api:+" | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| compileOnly 'com.github.spotbugs:spotbugs-annotations:4.9.8' | ||
| implementation 'org.springframework.boot:spring-boot-starter-web' | ||
| // OpenTracing 0.32.0 is the last release and is intentionally pinned: this smoke test | ||
| // exercises the legacy OpenTracing bridge in dd-trace-ot. Do not "upgrade" — there is | ||
| // no newer version. | ||
| implementation group: 'io.opentracing', name: 'opentracing-api', version: '0.32.0' | ||
| implementation group: 'io.opentracing', name: 'opentracing-util', version: '0.32.0' | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // 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() | ||
|
bric3 marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
| 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' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,32 @@ | ||
| import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
|
||
| plugins { | ||
| id 'java' | ||
| id 'org.springframework.boot' version '2.7.15' | ||
| id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
| id 'dd-trace-java.smoke-test-app' | ||
| id 'java-test-fixtures' | ||
| } | ||
|
|
||
| apply from: "$rootDir/gradle/java.gradle" | ||
| apply from: "$rootDir/gradle/spring-boot-plugin.gradle" | ||
|
|
||
| description = 'ASM Standalone Billing Tests.' | ||
|
|
||
| java { | ||
| sourceCompatibility = '1.8' | ||
| smokeTestApp { | ||
| application { | ||
| taskName = 'bootJar' | ||
| artifactPath = 'libs/apm-tracing-disabled-smoketest.jar' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just as idea: how about to calculate default name of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point, I'll take a look in a follow up pr |
||
| sysProperty = 'datadog.smoketest.springboot.shadowJar.path' | ||
| } | ||
| projectJar('apiJar', project(':dd-trace-api')) | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation 'org.springframework.boot:spring-boot-starter-web' | ||
| implementation group: 'io.opentracing', name: 'opentracing-api', version: '0.32.0' | ||
| implementation group: 'io.opentracing', name: 'opentracing-util', version: '0.32.0' | ||
| implementation project(':dd-trace-api') | ||
| testImplementation project(':dd-smoke-tests') | ||
| testImplementation(testFixtures(project(":dd-smoke-tests:iast-util"))) | ||
| } | ||
|
|
||
| tasks.withType(Test).configureEach { | ||
| def bootJarTask = tasks.named('bootJar', BootJar) | ||
| dependsOn bootJarTask | ||
| jvmArgumentProviders.add(new CommandLineArgumentProvider() { | ||
| @Override | ||
| Iterable<String> asArguments() { | ||
| return bootJarTask.map { ["-Ddatadog.smoketest.springboot.shadowJar.path=${it.archiveFile.get()}"] }.get() | ||
| } | ||
| }) | ||
| spotless { | ||
| java { | ||
| target "**/*.java" | ||
| } | ||
|
|
||
| groovyGradle { | ||
| target '*.gradle', "**/*.gradle" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Spring Boot 2.7.x is the last line that still supports Java 8, which this smoke test | ||
| // exercises (see the Java 8 `sourceCompatibility` below). Do not bump to 3.x without | ||
| // also moving the smoke test off Java 8. | ||
| plugins { | ||
| id 'java' | ||
| id 'org.springframework.boot' version '2.7.15' | ||
| id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
|
AlexeyKuznetsov-DD marked this conversation as resolved.
|
||
| } | ||
|
|
||
| def sharedRootDir = "$rootDir/../../../" | ||
| def sharedConfigDirectory = "$sharedRootDir/gradle" | ||
| rootProject.ext.sharedConfigDirectory = sharedConfigDirectory | ||
|
|
||
| apply from: "$sharedConfigDirectory/repositories.gradle" | ||
|
|
||
| if (hasProperty('appBuildDir')) { | ||
| buildDir = property('appBuildDir') | ||
| } | ||
|
|
||
| version = "" | ||
|
|
||
| // Pin bytecode target: the nested daemon now runs on JDK 21, but the smoke test launches | ||
| // the produced jar on Java 8. | ||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| } | ||
|
|
||
| // `iastUtilJar` is wired up by the outer `smokeTestApp { projectJar('iastUtilJar', ...) }` | ||
| // block in ../build.gradle: it passes the path of the built `:dd-smoke-tests:iast-util` | ||
| // jar into this nested build as a Gradle property. We add it as a flat-file dependency | ||
| // because the outer build's projects are not addressable from inside the nested build. | ||
| if (hasProperty('iastUtilJar')) { | ||
|
AlexeyKuznetsov-DD marked this conversation as resolved.
|
||
| dependencies { | ||
| implementation files(property('iastUtilJar')) | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation('org.springframework.boot:spring-boot-starter-web') | ||
| implementation('org.springframework.boot:spring-boot-starter-actuator') | ||
| implementation('org.springframework.kafka:spring-kafka') | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // 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) { | ||
|
AlexeyKuznetsov-DD marked this conversation as resolved.
|
||
| def sharedRootDir = "$rootDir/../../../" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, why in some places
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, the more I think about this, the more I think this build cache config is useless for nested smoke test projects. Given build cache is disabled by default and that the nested gradle jobs (existing or new via this PR) don't leverage the build-cache (there's neither |
||
| buildCache { | ||
| local { | ||
| directory = "$sharedRootDir/workspace/build-cache" | ||
| } | ||
| } | ||
|
Comment on lines
+34
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's comment the knowledge behind such
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note existing smoke tests already had this for quite some time, it just follows what's been there, it seems to have been introduced by b34ccbc, and has been applied to other smoke tests, prior my changes. The buildcache dir config referes to the root level cache that was introduced in f6ec1f5 #982 I'll add the comments in a follow-up pr. |
||
| } | ||
|
|
||
| rootProject.name = 'kafka-2-smoketest' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,36 @@ | ||
| import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
|
||
| plugins { | ||
| id 'org.springframework.boot' version '2.7.15' | ||
| id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||
| id 'dd-trace-java.smoke-test-app' | ||
| id 'java-test-fixtures' | ||
| } | ||
|
|
||
| apply from: "$rootDir/gradle/java.gradle" | ||
| apply from: "$rootDir/gradle/spring-boot-plugin.gradle" | ||
| description = 'Kafka 2.x Smoke Tests.' | ||
|
|
||
| dependencies { | ||
| implementation('org.springframework.boot:spring-boot-starter-web') | ||
| implementation('org.springframework.boot:spring-boot-starter-actuator') | ||
| implementation('org.springframework.kafka:spring-kafka') | ||
| description = 'Kafka 2.x Smoke Tests.' | ||
|
|
||
| testImplementation('org.springframework.kafka:spring-kafka-test') | ||
| smokeTestApp { | ||
| application { | ||
| taskName = 'bootJar' | ||
| artifactPath = 'libs/kafka-2-smoketest.jar' | ||
| sysProperty = 'datadog.smoketest.springboot.shadowJar.path' | ||
| } | ||
| projectJar('iastUtilJar', project(':dd-smoke-tests:iast-util')) | ||
| } | ||
|
|
||
| dependencies { | ||
| // Pinned: this version was previously resolved transitively from the Spring Boot BOM in | ||
| // the outer build. Now that the application is in a nested build, the BOM is no longer | ||
| // available here. | ||
| testImplementation('org.springframework.kafka:spring-kafka-test:2.8.11') | ||
| testImplementation project(':dd-smoke-tests') | ||
| implementation project(':dd-smoke-tests:iast-util') | ||
| testImplementation(testFixtures(project(":dd-smoke-tests:iast-util"))) | ||
| } | ||
|
|
||
| tasks.withType(Test).configureEach { | ||
| def bootJarTask = tasks.named('bootJar', BootJar) | ||
| dependsOn bootJarTask | ||
| jvmArgumentProviders.add(new CommandLineArgumentProvider() { | ||
| @Override | ||
| Iterable<String> asArguments() { | ||
| return bootJarTask.map { ["-Ddatadog.smoketest.springboot.shadowJar.path=${it.archiveFile.get()}"] }.get() | ||
| } | ||
| }) | ||
| spotless { | ||
| java { | ||
| target "**/*.java" | ||
| } | ||
|
|
||
| groovyGradle { | ||
| target '*.gradle', "**/*.gradle" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||
| plugins { | ||||||||||
| id 'java' | ||||||||||
| id 'org.springframework.boot' version '2.7.15' | ||||||||||
| id 'io.spring.dependency-management' version '1.0.15.RELEASE' | ||||||||||
| } | ||||||||||
|
|
||||||||||
| def sharedRootDir = "$rootDir/../../../" | ||||||||||
| def sharedConfigDirectory = "$sharedRootDir/gradle" | ||||||||||
| rootProject.ext.sharedConfigDirectory = sharedConfigDirectory | ||||||||||
|
|
||||||||||
| apply from: "$sharedConfigDirectory/repositories.gradle" | ||||||||||
|
|
||||||||||
| if (hasProperty('appBuildDir')) { | ||||||||||
| buildDir = property('appBuildDir') | ||||||||||
| } | ||||||||||
|
|
||||||||||
| version = "" | ||||||||||
|
|
||||||||||
| // Java 11 (not Java 8 like the other Spring Boot 2.x smoke tests): the OpenFeature SDK | ||||||||||
| // requires Java 11+. This matches what the outer (pre-nested) build was doing before | ||||||||||
| // the application was extracted into this nested build. | ||||||||||
| java { | ||||||||||
| sourceCompatibility = 11 | ||||||||||
| targetCompatibility = 11 | ||||||||||
| } | ||||||||||
|
Comment on lines
+22
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious why
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The app was compiled with Java 11 before dd-trace-java/dd-smoke-tests/openfeature/build.gradle Lines 17 to 20 in 5181a21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If app compiled with Java 11, maybe Gradle plugins can be bumped? |
||||||||||
|
|
||||||||||
| if (hasProperty('featureFlaggingApiJar')) { | ||||||||||
| dependencies { | ||||||||||
| implementation files(property('featureFlaggingApiJar')) | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| dependencies { | ||||||||||
| // OpenFeature SDK is an API dependency of feature-flagging-api but is not | ||||||||||
| // transitively resolved when the jar is passed as a files() dependency. | ||||||||||
| implementation 'dev.openfeature:sdk:1.20.1' | ||||||||||
| implementation 'org.springframework.boot:spring-boot-starter-web' | ||||||||||
| } | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // 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" | ||
|
Comment on lines
+33
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious why in some projects |
||
| } | ||
| } | ||
| } | ||
|
|
||
| rootProject.name = 'openfeature-smoketest' | ||
Uh oh!
There was an error while loading. Please reload this page.