From 5c719488185e602fae11549652299863c0ac46d7 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Fri, 9 Sep 2022 00:06:32 +0200 Subject: [PATCH] Add gradle plugin for SDK extensions (#6558) --- .../src/main/kotlin/otel.sdk-extension.gradle.kts | 14 ++++++++++++++ .../spring-boot-resources/library/build.gradle.kts | 2 +- javaagent/build.gradle.kts | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 conventions/src/main/kotlin/otel.sdk-extension.gradle.kts diff --git a/conventions/src/main/kotlin/otel.sdk-extension.gradle.kts b/conventions/src/main/kotlin/otel.sdk-extension.gradle.kts new file mode 100644 index 000000000000..c1390adcf9ea --- /dev/null +++ b/conventions/src/main/kotlin/otel.sdk-extension.gradle.kts @@ -0,0 +1,14 @@ +// SDK extensions are very similar to library instrumentations, they can be used without the javaagent +// but since they depend on the SDK they must be loaded by the agent CL in the javaagent + +plugins { + id("io.opentelemetry.instrumentation.library-instrumentation") + + id("otel.jacoco-conventions") + id("otel.java-conventions") + id("otel.publish-conventions") +} + +extra["mavenGroupId"] = "io.opentelemetry.instrumentation" + +base.archivesName.set(projectDir.parentFile.name) diff --git a/instrumentation/spring/spring-boot-resources/library/build.gradle.kts b/instrumentation/spring/spring-boot-resources/library/build.gradle.kts index 5e3dbc6a77eb..d254619d8c49 100644 --- a/instrumentation/spring/spring-boot-resources/library/build.gradle.kts +++ b/instrumentation/spring/spring-boot-resources/library/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("otel.library-instrumentation") + id("otel.sdk-extension") } dependencies { diff --git a/javaagent/build.gradle.kts b/javaagent/build.gradle.kts index 193f3fb2e991..bb02f09f8551 100644 --- a/javaagent/build.gradle.kts +++ b/javaagent/build.gradle.kts @@ -108,6 +108,12 @@ project(":instrumentation").subprojects { add(javaagentLibs.name, project(subProj.path)) } } + + plugins.withId("otel.sdk-extension") { + javaagentDependencies.run { + add(javaagentLibs.name, project(subProj.path)) + } + } } tasks {