Skip to content

Commit

Permalink
Add OSGi runtime metadata to error-prone's MANIFEST.MF files
Browse files Browse the repository at this point in the history
As suggested in #2967 (comment) this PR aims to add OSGi runtime metadata to the error-prone jars.
It achieves this by employing the [bnd-maven-plugin:bnd-process](https://github.com/bndtools/bnd/tree/master/maven-plugins/bnd-maven-plugin#bnd-process-goal) goal to generate the OSGi metadata, like the values of the Manifest headers `Bundle-SymbolicName`, `Import-Package` and `Export-Package`.

The schema used for `Bundle-SymbolicName` headers is based on the schema used for the `Automatic-Module-Name` in the error-prone-annotations artifact.
With this change additionally all other error-prone artifacts get a `Automatic-Module-Name` too.

@cushon can you please review this PR? If you have any question, I would be happy to answer them.

Fixes #2967

Fixes #3903

FUTURE_COPYBARA_INTEGRATE_REVIEW=#3903 from HannesWell:osgiMetadata f1ee0a4
PiperOrigin-RevId: 531653111
  • Loading branch information
HannesWell authored and Error Prone Team committed May 13, 2023
1 parent c2b71f9 commit 7f38e5c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
10 changes: 0 additions & 10 deletions annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@
<compilerArgs combine.self="override" />
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.google.errorprone.annotations</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
27 changes: 27 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,37 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>6.4.0</version>
<executions>
<execution>
<id>generate-OSGi-manifest</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Bundle-SymbolicName: com.google.$<replacestring;$<replacestring;${project.artifactId};^error_prone;errorprone>;_;.>
Automatic-Module-Name: $<Bundle-SymbolicName>
-exportcontents: com.google.errorprone*
-noextraheaders: true
-removeheaders: Private-Package
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit 7f38e5c

Please sign in to comment.