Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errorprone not an OSGi bundle #2967

Closed
Lana11s opened this issue Feb 8, 2022 · 5 comments
Closed

Errorprone not an OSGi bundle #2967

Lana11s opened this issue Feb 8, 2022 · 5 comments

Comments

@Lana11s
Copy link

Lana11s commented Feb 8, 2022

Currently, com.google.errorprone.annotations (version 2.10.0) is not an OSGi bundle. Some entries are missing in MANIFEST.MF:

Manifest-Version: 1.0
Automatic-Module-Name: com.google.errorprone.annotations
Archiver-Version: Plexus Archiver
Built-By: cushon
Created-By: Apache Maven 3.6.3
Build-Jdk: 1.8.0_202

Would be great if you can change this. Would allow us to upgrate to google/guice 5.1.0

@cushon
Copy link
Collaborator

cushon commented Feb 10, 2022

I don't know very much about OSGi. Is this a regression from earlier versions of Error Prone? Do you know what changed in guice 5.1.0 that worked previously?

@Lana11s
Copy link
Author

Lana11s commented Feb 11, 2022

Hello @cushon,
I looked into previous releases of error-prone (incl. 2.0) and manifest file had the same structure.
Guice worked in the OSGi environment because the dependency to error-prone was introduced with 5.1.0.
I am not familiar with Maven Jar Plugin, but it seems that it needs some configuration so that entries (like import-package, export-package) are added: https://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html

@cdietrich
Copy link

cdietrich commented May 2, 2023

i also just stumbled on this issue when testing the new guice 6.0.0 rc

@HannesWell
Copy link
Contributor

@cushon if you are interested I can provide a PR to implement this (probably next week).

I am not familiar with Maven Jar Plugin, but it seems that it needs some configuration so that entries (like import-package, export-package) are added: https://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html

It is simpler to use the maven-bundle-plugin or bnd-maven-plugin, because they can generate high quality OSGi metadata out of the box and can be fine tuned as necessary.
The latter plugin is used by the former one under the hood, which is why I recommend to use the latter one.

HannesWell added a commit to HannesWell/google.error-prone that referenced this issue May 10, 2023
HannesWell added a commit to HannesWell/google.error-prone that referenced this issue May 10, 2023
@HannesWell
Copy link
Contributor

Just created #3903. Everybody interested, please join the discussion there.

copybara-service bot pushed a commit that referenced this issue May 13, 2023
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
copybara-service bot pushed a commit that referenced this issue May 13, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants