-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
119 lines (101 loc) · 2.79 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
119 lines (101 loc) · 2.79 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
plugins {
id("otel.java-conventions")
id("otel.publish-conventions")
id("otel.jmh-conventions")
id("otel.animalsniffer-conventions")
}
description = "OpenTelemetry Context (Incubator)"
otelJava.moduleName.set("io.opentelemetry.context")
java {
sourceSets {
create("java25") {
java {
srcDir("src/main/java25")
}
// Make java25 source set depend on main source set
// since VarHandleStringEncoder implements StringEncoder from the main source set
compileClasspath += sourceSets.main.get().output + sourceSets.main.get().compileClasspath
}
}
}
// Configure java25 compilation to see main source classes
sourceSets.named("java25") {
compileClasspath += sourceSets.main.get().output
}
tasks.named<JavaCompile>("compileJava25Java") {
options.release.set(25)
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(25))
})
}
tasks.named<Jar>("jar") {
manifest {
attributes["Multi-Release"] = "true"
}
from(sourceSets.named("java25").get().output) {
into("META-INF/versions/25")
}
}
// Configure test to include java25 classes when running on Java 9+
// so that StringEncoderHolder.createUnsafeEncoder() can instantiate the Java 9 version
val testJavaVersion = gradle.startParameter.projectProperties.get("testJavaVersion")?.let(JavaVersion::toVersion)
val effectiveJavaVersion = testJavaVersion ?: JavaVersion.current()
if (effectiveJavaVersion >= JavaVersion.VERSION_25) {
sourceSets.named("test") {
runtimeClasspath += sourceSets.named("java25").get().output
}
}
dependencies {
api(project(":common"))
// MustBeClosed
compileOnly("com.google.errorprone:error_prone_annotations")
testImplementation("com.google.guava:guava")
}
testing {
suites {
register<JvmTestSuite>("grpcInOtelTest") {
dependencies {
implementation("io.grpc:grpc-api")
}
}
register<JvmTestSuite>("otelInGrpcTest") {
dependencies {
implementation("io.grpc:grpc-api")
}
}
register<JvmTestSuite>("braveInOtelTest") {
dependencies {
implementation("io.zipkin.brave:brave")
}
}
register<JvmTestSuite>("otelInBraveTest") {
dependencies {
implementation("io.zipkin.brave:brave")
}
}
register<JvmTestSuite>("otelAsBraveTest") {
dependencies {
implementation("io.zipkin.brave:brave")
}
}
register<JvmTestSuite>("storageWrappersTest") {
}
register<JvmTestSuite>("strictContextEnabledTest") {
dependencies {
implementation(project(":api:all"))
}
targets {
all {
testTask.configure {
jvmArgs("-Dio.opentelemetry.context.enableStrictContext=true")
}
}
}
}
}
}
tasks {
check {
dependsOn(testing.suites)
}
}