Migrate instrumentation/build.gradle to kotlin
DELETE
instrumentation/build.gradle
-// this project will run in isolation under the agent's classloader
-plugins {
- id("otel.shadow-conventions")
- id("otel.java-conventions")
-}
-
-Project instr_project = project
-subprojects {
- afterEvaluate { Project subProj ->
- if (subProj.getPlugins().hasPlugin('java')) {
- // Make it so all instrumentation subproject tests can be run with a single command.
- instr_project.tasks.named('test').configure {
- dependsOn(subProj.tasks.test)
- }
-
- if (subProj.name == 'javaagent') {
- instr_project.dependencies {
- implementation(project(subProj.getPath()))
- }
- }
- }
- }
-}
-
-dependencies {
- compileOnly project(':instrumentation-api')
- compileOnly project(':javaagent-api')
- implementation project(':javaagent-tooling')
- implementation project(':javaagent-extension-api')
-}
-
-configurations {
- // exclude bootstrap dependencies from shadowJar
- implementation.exclude group: 'org.slf4j'
- implementation.exclude group: 'io.opentelemetry', module: 'opentelemetry-api'
- implementation.exclude group: 'io.opentelemetry', module: 'opentelemetry-api-metrics'
- implementation.exclude group: 'io.opentelemetry', module: 'opentelemetry-semconv'
-}
-
-shadowJar {
- duplicatesStrategy = DuplicatesStrategy.FAIL
-
- dependencies {
- //These classes are added to bootstrap classloader by javaagent module
- exclude(project(':javaagent-bootstrap'))
- exclude(project(':instrumentation-api'))
- exclude(project(':javaagent-api'))
- }
-}
-
-tasks.register("listInstrumentations") {
- group = "Help"
- description = "List all available instrumentation modules"
- doFirst {
- subprojects
- .findAll { it.plugins.hasPlugin("otel.muzzle-check") }
- .collect { it.path }
- .each { println it }
- }
-}

ADD
instrumentation/build.gradle.kts
+import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+
+// this project will run in isolation under the agent's classloader
+plugins {
+ id("otel.shadow-conventions")
+ id("otel.java-conventions")
+}
+
+val instrumentationProjectTest = tasks.named("test")
+val instrumentationProjectDependencies = dependencies
+
+subprojects {
+ val subProj = this
+ plugins.withId("java") {
+ instrumentationProjectTest.configure {
+ dependsOn(subProj.tasks.named("test"))
+ }
+ }
+
+ plugins.withId("otel.javaagent-instrumentation") {
+ instrumentationProjectDependencies.run {
+ implementation(project(subProj.path))
+ }
+ }
+}
+
+dependencies {
+ compileOnly(project(":instrumentation-api"))
+ compileOnly(project(":javaagent-api"))
+ implementation(project(":javaagent-tooling"))
+ implementation(project(":javaagent-extension-api"))
+}
+
+configurations {
+ // exclude bootstrap dependencies from shadowJar
+ implementation {
+ exclude("org.slf4j")
+ exclude("io.opentelemetry", "opentelemetry-api")
+ exclude("io.opentelemetry", "opentelemetry-api-metrics")
+ exclude("io.opentelemetry", "opentelemetry-semconv")
+ }
+}
+
+tasks {
+ named<ShadowJar>("shadowJar") {
+ duplicatesStrategy = DuplicatesStrategy.FAIL
+
+ dependencies {
+ //These classes are added to bootstrap classloader by javaagent module
+ exclude(project(":javaagent-bootstrap"))
+ exclude(project(":instrumentation-api"))
+ exclude(project(":javaagent-api"))
+ }
+ }
+
+ register("listInstrumentations") {
+ group = "Help"
+ description = "List all available instrumentation modules"
+ doFirst {
+ subprojects
+ .filter { it.plugins.hasPlugin("otel.muzzle-check") }
+ .map { it.path }
+ .forEach { println(it) }
+ }
+ }
+}

Migrate instrumentation/build.gradle to kotlin (#3444)