forked from DataDog/dd-trace-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
101 lines (85 loc) · 3.56 KB
/
Copy pathbuild.gradle
File metadata and controls
101 lines (85 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'com.gradleup.shadow'
}
apply from: "$rootDir/gradle/java.gradle"
tasks.withType(JavaCompile).configureEach {
configureCompiler(it, 8, JavaVersion.VERSION_1_8, "Need access to sun.misc package")
}
minimumBranchCoverage = 0.5
minimumInstructionCoverage = 0.5
excludedClassesCoverage += [
'datadog.trace.agent.test.asserts.*Assert',
'datadog.trace.agent.test.asserts.*Assert.*',
'datadog.trace.agent.test.base.*',
'datadog.trace.agent.test.server.http.HttpProxy.AsyncPipe',
'datadog.trace.agent.test.server.http.TestHttpServer.*',
'datadog.trace.agent.test.utils.*',
// Avoid applying jacoco instrumentation to classes instrumented by tested agent
'context.FieldInjectionTestInstrumentation**',
'context.ExcludeFilterTestInstrumentation**',
// profiling
'datadog.trace.agent.test.TestProfilingContextIntegration',
'datadog.trace.agent.test.TestProfilingContextIntegration.TestQueueTiming'
]
configurations.named('api') {
exclude group: 'org.snakeyaml', module: 'snakeyaml-engine' // we vendor this in the agent jar
}
dependencies {
api libs.bytebuddy
api libs.bytebuddyagent
api libs.slf4j
api libs.bundles.test.logging
api libs.guava
// Do not expose jetty as a transitive dependency, as it conflicts
// with versions used to test instrumentions.
// Note: 9.4 last to support java 8
compileOnly group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.4.56.v20240826'
runtimeOnly group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.4.56.v20240826'
compileOnly group: 'org.eclipse.jetty.http2', name: 'http2-server', version: '9.4.56.v20240826'
runtimeOnly group: 'org.eclipse.jetty.http2', name: 'http2-server', version: '9.4.56.v20240826'
// Since jetty-server is shadowed, it is needed to exports the servlet api as well.
api group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
api group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: libs.versions.okhttp.legacy.get()
api project(':dd-java-agent:agent-tooling')
api project(':dd-java-agent:agent-installer')
api project(':dd-trace-core')
api project(':utils:test-utils')
api project(':utils:time-utils')
implementation "org.junit.platform:junit-platform-runner:${libs.versions.junit.platform.get()}"
implementation project(':dd-java-agent:appsec')
compileOnly(libs.bundles.groovy)
compileOnly(libs.bundles.spock)
}
tasks.named("shadowJar", ShadowJar) {
// Only bundle jetty dependencies into the jar (relocated)
// All other dependencies remain as transitive dependencies
dependencies {
include(dependency {
it.moduleGroup == 'org.eclipse.jetty' || it.moduleGroup == 'org.eclipse.jetty.http2'
})
}
// Relocate jetty classes to avoid conflicts with instrumented versions
relocate "org.eclipse.jetty", "datadog.eclipse.jetty"
// Make shadowJar replace the main jar in api configuration
archiveClassifier = ''
}
// Remove the regular jar from api elements and use shadow jar instead
// Also exclude jetty from being exposed as a transitive dependency (it's bundled in the shadow jar)
configurations {
named('apiElements') {
outgoing.artifacts.clear()
outgoing.artifact(tasks.named('shadowJar'))
exclude group: 'org.eclipse.jetty'
exclude group: 'org.eclipse.jetty.http2'
}
named('runtimeElements') {
outgoing.artifacts.clear()
outgoing.artifact(tasks.named('shadowJar'))
exclude group: 'org.eclipse.jetty'
exclude group: 'org.eclipse.jetty.http2'
}
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
}