-
Notifications
You must be signed in to change notification settings - Fork 925
/
Copy pathbuild.gradle.kts
159 lines (133 loc) · 4.56 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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import java.time.Duration
plugins {
`kotlin-dsl`
`maven-publish`
signing
id("com.gradle.plugin-publish")
id("io.github.gradle-nexus.publish-plugin")
}
group = "io.opentelemetry.instrumentation"
apply(from = "../version.gradle.kts")
repositories {
mavenCentral()
gradlePluginPortal()
}
val bbGradlePlugin by configurations.creating
configurations.named("compileOnly") {
extendsFrom(bbGradlePlugin)
}
val byteBuddyVersion = "1.15.11"
val aetherVersion = "1.1.0"
dependencies {
implementation("com.google.guava:guava:33.4.0-jre")
// we need to use byte buddy variant that does not shade asm
implementation("net.bytebuddy:byte-buddy-gradle-plugin:${byteBuddyVersion}") {
exclude(group = "net.bytebuddy", module = "byte-buddy")
}
implementation("net.bytebuddy:byte-buddy-dep:${byteBuddyVersion}")
implementation("org.eclipse.aether:aether-connector-basic:${aetherVersion}")
implementation("org.eclipse.aether:aether-transport-http:${aetherVersion}")
implementation("org.apache.maven:maven-aether-provider:3.3.9")
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.5")
testImplementation("org.assertj:assertj-core:3.27.3")
testImplementation(enforcedPlatform("org.junit:junit-bom:5.11.4"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}
tasks {
withType<Test>().configureEach {
useJUnitPlatform()
}
withType<JavaCompile>().configureEach {
with(options) {
release.set(11)
}
}
withType(KotlinJvmCompile::class).configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
}
}
}
gradlePlugin {
website.set("https://opentelemetry.io")
vcsUrl.set("https://github.com/open-telemetry/opentelemetry-java-instrumentation")
plugins {
get("io.opentelemetry.instrumentation.muzzle-generation").apply {
displayName = "Muzzle safety net generation"
description = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/muzzle.md"
tags.set(listOf("opentelemetry", "instrumentation", "java"))
}
get("io.opentelemetry.instrumentation.muzzle-check").apply {
displayName = "Checks instrumented libraries against muzzle safety net"
description = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/muzzle.md"
tags.set(listOf("opentelemetry", "instrumentation", "java"))
}
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
withJavadocJar()
withSourcesJar()
}
nexusPublishing {
packageGroup.set("io.opentelemetry")
repositories {
sonatype {
username.set(System.getenv("SONATYPE_USER"))
password.set(System.getenv("SONATYPE_KEY"))
}
}
connectTimeout.set(Duration.ofMinutes(5))
clientTimeout.set(Duration.ofMinutes(5))
}
tasks {
publishPlugins {
enabled = !version.toString().contains("SNAPSHOT")
}
}
afterEvaluate {
publishing {
publications {
named<MavenPublication>("pluginMaven") {
pom {
name.set("OpenTelemetry Instrumentation Gradle Plugins")
description.set("Gradle plugins to assist developing OpenTelemetry instrumentation")
url.set("https://github.com/open-telemetry/opentelemetry-java-instrumentation")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("opentelemetry")
name.set("OpenTelemetry")
url.set("https://github.com/open-telemetry/opentelemetry-java-instrumentation/discussions")
}
}
scm {
connection.set("scm:git:[email protected]:open-telemetry/opentelemetry-java-instrumentation.git")
developerConnection.set("scm:git:[email protected]:open-telemetry/opentelemetry-java-instrumentation.git")
url.set("[email protected]:open-telemetry/opentelemetry-java-instrumentation.git")
}
}
}
}
}
}
// Sign only if we have a key to do so
val signingKey: String? = System.getenv("GPG_PRIVATE_KEY")
signing {
setRequired({
// only require signing on CI and when a signing key is present
System.getenv("CI") != null && signingKey != null
})
useInMemoryPgpKeys(signingKey, System.getenv("GPG_PASSWORD"))
}