From 95bc17acae7c0acb5e06eeae1433c36d297dbf4a Mon Sep 17 00:00:00 2001 From: Roy Teeuwen Date: Fri, 23 Aug 2024 16:00:22 +0200 Subject: [PATCH] solves #768: Add OSGi support by exporting all java packages except internal packages --- buildSrc/build.gradle.kts | 1 + buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d85c65767de..e2066365c5d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -50,6 +50,7 @@ repositories { } dependencies { + implementation("biz.aQute.bnd:biz.aQute.bnd.gradle:7.0.0") implementation(enforcedPlatform("com.squareup.wire:wire-bom:5.0.0")) implementation("com.google.auto.value:auto-value-annotations:1.11.0") // When updating, update above in plugins too diff --git a/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts index f651f5c3021..8db53d9e8f1 100644 --- a/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts @@ -8,6 +8,7 @@ plugins { eclipse idea + id("biz.aQute.bnd.builder") id("otel.errorprone-conventions") id("otel.jacoco-conventions") id("otel.spotless-conventions") @@ -155,10 +156,15 @@ tasks { "Built-JDK" to System.getProperty("java.version"), "Implementation-Title" to project.name, "Implementation-Version" to project.version, + // BND plugin to export the packages as OSGi bundle + "-exportcontents" to "!io.opentelemetry.**.internal,io.opentelemetry.*," ) } + } + + afterEvaluate { withType().configureEach { with(options as StandardJavadocDocletOptions) {