Skip to content

Commit c15f82e

Browse files
committed
Convert examples/distro Gradle build to Kotlin
Migrate examples/distro/build.gradle from Groovy to Kotlin DSL for improved consistency with the rest of the repository. Most of the instrumentation repository (608 files) already uses Kotlin for Gradle build files. This migration converts one of the remaining Groovy files to match the established pattern. Fixes #15794 Signed-off-by: Sibasis Padhi <sibasis.padhi@gmail.com>
1 parent be30e0c commit c15f82e

2 files changed

Lines changed: 88 additions & 87 deletions

File tree

examples/distro/build.gradle

Lines changed: 0 additions & 87 deletions
This file was deleted.

examples/distro/build.gradle.kts

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
group = "io.opentelemetry.example"
2+
version = "1.0-SNAPSHOT"
3+
4+
buildscript {
5+
repositories {
6+
maven {
7+
url = uri("https://plugins.gradle.org/m2/")
8+
}
9+
maven {
10+
name = "sonatype"
11+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
12+
}
13+
}
14+
dependencies {
15+
classpath("com.diffplug.spotless:spotless-plugin-gradle:8.1.0")
16+
classpath("com.gradleup.shadow:shadow-gradle-plugin:9.3.1")
17+
classpath("io.opentelemetry.instrumentation:gradle-plugins:2.24.0-alpha-SNAPSHOT")
18+
}
19+
}
20+
21+
subprojects {
22+
version = rootProject.version
23+
24+
apply(plugin = "java")
25+
apply(plugin = "com.diffplug.spotless")
26+
27+
val versions = mapOf(
28+
// this line is managed by .github/scripts/update-sdk-version.sh
29+
"opentelemetrySdk" to "1.57.0",
30+
31+
// these lines are managed by .github/scripts/update-version.sh
32+
"opentelemetryJavaagent" to "2.24.0-SNAPSHOT",
33+
"opentelemetryJavaagentAlpha" to "2.24.0-alpha-SNAPSHOT",
34+
35+
"autoservice" to "1.1.1"
36+
)
37+
38+
val deps = mapOf(
39+
"autoservice" to listOf(
40+
"com.google.auto.service:auto-service:${versions["autoservice"]}",
41+
"com.google.auto.service:auto-service-annotations:${versions["autoservice"]}"
42+
)
43+
)
44+
45+
extra["versions"] = versions
46+
extra["deps"] = deps
47+
48+
repositories {
49+
mavenCentral()
50+
maven {
51+
name = "sonatype"
52+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
53+
}
54+
}
55+
56+
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
57+
java {
58+
googleJavaFormat()
59+
licenseHeaderFile(rootProject.file("../../buildscripts/spotless.license.java"), "(package|import|public)")
60+
target("src/**/*.java")
61+
}
62+
}
63+
64+
afterEvaluate {
65+
dependencies {
66+
add("implementation", platform("io.opentelemetry:opentelemetry-bom:${versions["opentelemetrySdk"]}"))
67+
68+
// these serve as a test of the instrumentation boms
69+
add("implementation", platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:${versions["opentelemetryJavaagent"]}"))
70+
add("implementation", platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:${versions["opentelemetryJavaagentAlpha"]}"))
71+
72+
add("testImplementation", "org.mockito:mockito-core:5.21.0")
73+
74+
add("testImplementation", enforcedPlatform("org.junit:junit-bom:5.14.2"))
75+
add("testImplementation", "org.junit.jupiter:junit-jupiter-api")
76+
add("testRuntimeOnly", "org.junit.jupiter:junit-jupiter-engine")
77+
add("testRuntimeOnly", "org.junit.platform:junit-platform-launcher")
78+
}
79+
}
80+
81+
tasks.named<Test>("test") {
82+
useJUnitPlatform()
83+
}
84+
85+
tasks.named<JavaCompile>("compileJava") {
86+
options.release.set(8)
87+
}
88+
}

0 commit comments

Comments
 (0)