Skip to content

Commit

Permalink
[Build] Add OSGi metadata to JSVG MANIFEST.MF and generate module-info
Browse files Browse the repository at this point in the history
Generated OSGi metadata into JSVG's META-INF/MANIFEST.MF using the
bnd-lib gradle plugin.

Additionally use the bnd-gradle-plugin to also generated the JPMS
module-info.class for JSVG. This avoids manual maintenance and ensures
that OSGi and JPMS metadata are always in sync.

Co-authored-by: Jannis Weis <[email protected]>
  • Loading branch information
HannesWell and weisJ committed Jan 14, 2025
1 parent e81f884 commit 8dc15ff
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 42 deletions.
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0

#Sonarcloud
systemProp.sonar.host.url = https://sonarcloud.io
Expand Down
34 changes: 34 additions & 0 deletions jsvg/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
`module-info-compile`
id("me.champeau.jmh")
jacoco
id("biz.aQute.bnd.builder")
}

dependencies {
Expand Down Expand Up @@ -34,6 +35,39 @@ tasks {
targetCompatibility = JavaVersion.VERSION_21.toString()
}

jar {
bundle {
bnd("""
Bundle-SymbolicName: com.github.weisj.jsvg
-exportcontents: \
com.github.weisj.jsvg,\
com.github.weisj.jsvg.animation,\
com.github.weisj.jsvg.attributes,\
com.github.weisj.jsvg.attributes.font,\
com.github.weisj.jsvg.attributes.paint,\
com.github.weisj.jsvg.geometry.size,\
com.github.weisj.jsvg.nodes,\
com.github.weisj.jsvg.parser,\
com.github.weisj.jsvg.parser.css,\
com.github.weisj.jsvg.parser.resources,\
com.github.weisj.jsvg.renderer,\
com.github.weisj.jsvg.renderer.awt,\
com.github.weisj.jsvg.ui,\
Import-Package: !com.google.errorprone.annotations,\
*
-jpms-module-info
-jpms-module-info-options: \
com.google.errorprone.annotations;static="true";transitive="false",\
org.jetbrains.annotations;static="true";transitive="false",\
com.github.weisj.jsvg.annotations;static="true";transitive="false",
-removeheaders: Private-Package,Tool
""")
}
}

test {
dependsOn(jar)
doFirst {
Expand Down
42 changes: 0 additions & 42 deletions jsvg/src/main/module/module-info.java

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down

0 comments on commit 8dc15ff

Please sign in to comment.