Skip to content

Commit

Permalink
Automate OSGi metadata creation and fix broken metadata for slf4j-api
Browse files Browse the repository at this point in the history
Only use the maven-bundle-plugin to generate all OSGi metadata into
slf4j-api's Manifest.MF file. This unifies the resulting MANIFEST.MFs
that are currently partly generated and partly statically defined and
fixes the following aspects:

- Restore the Bundle-SymbolicName from SLF4J-2.0.5 and before
- Removes Export-Package: META-INF.versions.9
- Replace the deprecated 'Bundle-RequiredExecutionEnvironment' by a
corresponding required 'osgi.ee' capability

Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
  • Loading branch information
HannesWell committed Jan 12, 2023
1 parent a5540ad commit 317b6db
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
32 changes: 20 additions & 12 deletions pom.xml
Expand Up @@ -60,7 +60,7 @@
<maven-jxr-plugin.version>3.1.1</maven-jxr-plugin.version>
<maven-bundle-plugin.version>5.1.8</maven-bundle-plugin.version>
<build-helper-maven-plugin.version>3.2.0</build-helper-maven-plugin.version>
<bnd.version>6.4.0</bnd.version>
</properties>

<developers>
Expand Down Expand Up @@ -241,24 +241,32 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<configuration>
<supportIncrementalBuild>true</supportIncrementalBuild>
<!-- populated by the plugin itself -->
<instructions>
<Bundle-SymbolicName>${replacestring;${project.artifactId};-;.}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Vendor>SLF4J.ORG</Bundle-Vendor>
<_snapshot/>
<_exportcontents>!META-INF.versions.9,*;-noimport:=true</_exportcontents>
<Bundle-Description>${project.description}</Bundle-Description>
<Bundle-DocURL>${project.url}</Bundle-DocURL>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Multi-Release>true</Multi-Release>
<_removeheaders>Private-Package,Bundle-SCM, Bundle-Developers, Include-Resource</_removeheaders>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<!-- populated by the plugin itself -->
<Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
<Bundle-Description>${project.description}</Bundle-Description>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
<Implementation-Version>${project.version}</Implementation-Version>
<Multi-Release>true</Multi-Release>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
14 changes: 14 additions & 0 deletions slf4j-api/pom.xml
Expand Up @@ -53,6 +53,20 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Import-Package>org.slf4j.spi;version="${range;[===,+);${version;===;${maven_version;${project.version}}}}"</Import-Package>
<Require-Capability><![CDATA[
osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.processor)(version>=1.0.0)(!(version>=2.0.0)))",
osgi.serviceloader;filter:="(osgi.serviceloader=org.slf4j.spi.SLF4JServiceProvider)";osgi.serviceloader="org.slf4j.spi.SLF4JServiceProvider"
]]></Require-Capability>
</instructions>
</configuration>
</plugin>

</plugins>

</build>
Expand Down
15 changes: 0 additions & 15 deletions slf4j-api/src/main/resources/META-INF/MANIFEST.MF

This file was deleted.

0 comments on commit 317b6db

Please sign in to comment.