Skip to content

Commit 74204fe

Browse files
committed
feat(environment): Add boostrap dedicated Gradle configuration
1 parent 5757ee6 commit 74204fe

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

components/environment/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
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+
* "datadog.trace." prefix is required to be excluded from Jacoco instrumentation.
11+
* See ConfigDefaults.DEFAULT_CIVISIBILITY_JACOCO_PLUGIN_EXCLUDES for more details.
12+
*/
13+
tasks.shadowJar {
14+
relocate("datadog.environment", "datadog.trace.bootstrap.environment")
15+
}
16+
17+
/*
18+
* Configure test coverage.
19+
*/
720
extra.set("minimumInstructionCoverage", 0.7)
821
val excludedClassesCoverage by extra {
922
listOf(

dd-java-agent/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ tasks.withType(GenerateMavenPom).configureEach { task ->
250250

251251
dependencies {
252252
implementation project(path: ':components:json')
253-
implementation project(path: ':components:environment')
253+
// Depend on the bootstrap-specific shadow configuration to avoid having the same component reused by both bootstrap and agent
254+
implementation project(path: ':components:environment', configuration: 'shadow')
254255
modules {
255256
module("com.squareup.okio:okio") {
256257
replacedBy("com.datadoghq.okio:okio") // embed our patched fork
@@ -270,6 +271,7 @@ dependencies {
270271
testImplementation group: 'io.opentracing', name: 'opentracing-util', version: '0.31.0'
271272

272273
// Includes for the top level shadow jar
274+
shadowInclude project(path: ':components:environment', configuration: 'shadow')
273275
shadowInclude project(path: ':dd-java-agent:agent-bootstrap')
274276
shadowInclude project(path: ':dd-java-agent:agent-debugger:debugger-bootstrap')
275277
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import static java.nio.charset.StandardCharsets.UTF_8;
44

5-
import datadog.environment.EnvironmentVariables;
6-
import datadog.environment.JavaVirtualMachine;
7-
import datadog.environment.SystemProperties;
5+
import datadog.trace.bootstrap.environment.EnvironmentVariables;
6+
import datadog.trace.bootstrap.environment.JavaVirtualMachine;
7+
import datadog.trace.bootstrap.environment.SystemProperties;
88
import de.thetaphi.forbiddenapis.SuppressForbidden;
99
import java.io.BufferedReader;
1010
import java.io.File;

0 commit comments

Comments
 (0)