Skip to content

Commit 57564e3

Browse files
committed
feat(environment): Add boostrap dedicated Gradle configuration
1 parent 60d0cb5 commit 57564e3

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

components/environment/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
plugins {
22
`java-library`
3+
id("com.gradleup.shadow")
34
}
45

56
apply(from = "$rootDir/gradle/java.gradle")
67

8+
/*
9+
* Add an addition gradle configuration to be consumed by bootstrap only.
10+
*/
11+
tasks.shadowJar {
12+
relocate("datadog.environment", "bootstrap.environment")
13+
}
14+
15+
/*
16+
* Configure test coverage.
17+
*/
718
extra.set("minimumInstructionCoverage", 0.7)
819
val excludedClassesCoverage by extra {
920
listOf(

dd-java-agent/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ tasks.withType(GenerateMavenPom).configureEach { task ->
241241
dependencies {
242242
implementation project(path: ':components:json')
243243
implementation project(path: ':components:cli')
244-
implementation project(path: ':components:environment')
244+
// Depend on the bootstrap-specific shadow configuration to avoid having the same component reused by both bootstrap and agent
245+
implementation project(path: ':components:environment', configuration: 'shadow')
245246
modules {
246247
module("com.squareup.okio:okio") {
247248
replacedBy("com.datadoghq.okio:okio") // embed our patched fork
@@ -261,6 +262,7 @@ dependencies {
261262
testImplementation group: 'io.opentracing', name: 'opentracing-util', version: '0.31.0'
262263

263264
// Includes for the top level shadow jar
265+
shadowInclude project(path: ':components:environment', configuration: 'shadow')
264266
shadowInclude project(path: ':dd-java-agent:agent-bootstrap')
265267
shadowInclude project(path: ':dd-java-agent:agent-debugger:debugger-bootstrap')
266268
shadowInclude project(path: ':dd-java-agent:agent-otel:otel-bootstrap', configuration: 'shadow')

dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import static datadog.trace.bootstrap.SystemUtils.getPropertyOrEnvVar;
44
import static java.nio.charset.StandardCharsets.UTF_8;
55

6+
import bootstrap.environment.SystemProperties;
67
import datadog.cli.CLIHelper;
7-
import datadog.environment.SystemProperties;
88
import de.thetaphi.forbiddenapis.SuppressForbidden;
99
import java.io.BufferedReader;
1010
import java.io.File;

0 commit comments

Comments
 (0)