-
Notifications
You must be signed in to change notification settings - Fork 879
/
Copy pathbuild.gradle.kts
90 lines (78 loc) · 2.36 KB
/
build.gradle.kts
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
plugins {
id("otel.sdk-extension")
}
val mrJarVersions = listOf(9, 11)
dependencies {
implementation("io.opentelemetry:opentelemetry-sdk-common")
implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
implementation("io.opentelemetry.semconv:opentelemetry-semconv")
annotationProcessor("com.google.auto.service:auto-service")
compileOnly("com.google.auto.service:auto-service-annotations")
testCompileOnly("com.google.auto.service:auto-service-annotations")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-incubator")
testImplementation("org.junit.jupiter:junit-jupiter-api")
}
for (version in mrJarVersions) {
sourceSets {
create("java$version") {
java {
setSrcDirs(listOf("src/main/java$version"))
}
}
}
tasks {
named<JavaCompile>("compileJava${version}Java") {
sourceCompatibility = "$version"
targetCompatibility = "$version"
options.release.set(version)
}
}
configurations {
named("java${version}Implementation") {
extendsFrom(configurations["implementation"])
}
named("java${version}CompileOnly") {
extendsFrom(configurations["compileOnly"])
}
}
dependencies {
// Common to reference classes in main sourceset from Java 9 one (e.g., to return a common interface)
add("java${version}Implementation", files(sourceSets.main.get().output.classesDirs))
}
}
tasks {
withType(Jar::class) {
val sourcePathProvider = if (name == "jar") {
{ ss: SourceSet? -> ss?.output }
} else if (name == "sourcesJar") {
{ ss: SourceSet? -> ss?.java }
} else {
{ project.objects.fileCollection() }
}
for (version in mrJarVersions) {
into("META-INF/versions/$version") {
from(sourcePathProvider(sourceSets["java$version"]))
}
}
manifest.attributes(
"Multi-Release" to "true",
)
}
}
testing {
suites {
// Security Manager tests involve setup that can poison the environment for other tests
val testSecurityManager by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:resources:library"))
implementation("io.opentelemetry:opentelemetry-sdk-common")
implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
}
}
}
}
tasks {
check {
dependsOn(testing.suites)
}
}