From 42abc0f5f8ef28afa5a329ad55b759270aa13058 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sat, 7 Dec 2024 11:35:22 +0100 Subject: [PATCH] [Build] Generate OSGi metadata into MANIFEST.MF Co-authored-by: Jannis Weis <31143295+weisJ@users.noreply.github.com> --- build.gradle.kts | 12 ++++++++++++ gradle.properties | 1 + settings.gradle.kts | 1 + 3 files changed, 14 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 31234f29..cdb868d5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import aQute.bnd.gradle.Bundle import com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep import com.github.vlsi.gradle.crlf.CrLfSpec import com.github.vlsi.gradle.crlf.LineEndings @@ -16,6 +17,7 @@ plugins { id("com.github.vlsi.gradle-extensions") id("com.github.vlsi.stage-vote-release") id("net.ltgt.errorprone") apply false + id("biz.aQute.bnd.builder") apply false } val skipJavadoc by props() @@ -261,6 +263,12 @@ allprojects { } } + apply(plugin = "biz.aQute.bnd.builder") + register("bundle") { + bundle { + } + } + withType().configureEach { manifest { attributes["Bundle-License"] = "MIT" @@ -271,6 +279,10 @@ allprojects { attributes["Specification-Title"] = "JSVG" attributes["Implementation-Vendor"] = "JSVG" attributes["Implementation-Vendor-Id"] = "com.github.weisj" + // bnd instructions to generate OSGi metadata + attributes["Bundle-SymbolicName"] = "com.github.weisj.jsvg" + attributes["-exportcontents"] = "!*.impl.*,*" + attributes["-removeheaders"] = "Private-Package,Tool" } CrLfSpec(LineEndings.LF).run { diff --git a/gradle.properties b/gradle.properties index 495b87b4..9db77020 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,6 +34,7 @@ errorprone.version = 2.25.0 errorprone.compiler.version = 9+181-r4173-1 guava.version = 1.0 autoservice.version = 1.0.1 +biz.aQute.bnd.lib.version = 7.0.0 #Sonarcloud systemProp.sonar.host.url = https://sonarcloud.io diff --git a/settings.gradle.kts b/settings.gradle.kts index 88909bf8..5a2ffd6f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,6 +18,7 @@ pluginManagement { idv("net.ltgt.errorprone") idv("me.champeau.jmh") idv("org.sonarqube") + idv("biz.aQute.bnd.builder", "biz.aQute.bnd.lib") } }