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

Add OSGi runtime metadata to error-prone's MANIFEST.MF files #3903

Closed
wants to merge 1 commit into from

Conversation

HannesWell
Copy link
Contributor

@HannesWell HannesWell commented May 10, 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 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

copybara-service bot pushed a commit to google/guice that referenced this pull request May 12, 2023
Annotations with retention policy are ignored if they cannot be loaded at runtime (at least according to [Stack-Overvflow](https://stackoverflow.com/questions/3567413/why-doesnt-a-missing-annotation-cause-a-classnotfoundexception-at-runtime)). Make the dependency optional to not enforce the presence of error_prone_annotations in a java runtime even if those annotations are not used at all.

This is especially useful for OSGi-runtimes where you cannot exclude error_prone_annotations because the corresponding package is specified as mandatory requirement in the MANIFEST.MF. Marking the Maven dependency as optional will also result in the error-prone package requirement being marked as optional.

At the moment error_prone_annotations does not come with a OSGi compliant Manifest, which makes it harder to include it in OSGi applications like Eclipse.
I already created a PR at error-prone to include the required OSGi headers (see google/error-prone#3903), but not requiring the annotations at all would make it even simpler to use guice within OSGi.

Alternatively the dependency could be marked as optional in the OSGi metadata.

Fixes #1739

COPYBARA_INTEGRATE_REVIEW=#1739 from HannesWell:optionalErrorproneAnnotations 86f9de0
PiperOrigin-RevId: 531531783
copybara-service bot pushed a commit that referenced this pull request 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 pull request 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
@HannesWell HannesWell deleted the osgiMetadata branch May 14, 2023 23:47
@HannesWell
Copy link
Contributor Author

Thank you for your review.

benkard pushed a commit to benkard/jgvariant that referenced this pull request Jun 18, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [com.google.errorprone:error_prone_core](https://errorprone.info) ([source](https://github.com/google/error-prone)) |  | minor | `2.19.1` -> `2.20.0` |
| [com.google.errorprone:error_prone_annotations](https://errorprone.info) ([source](https://github.com/google/error-prone)) | compile | minor | `2.19.1` -> `2.20.0` |

---

### Release Notes

<details>
<summary>google/error-prone</summary>

### [`v2.20.0`](https://github.com/google/error-prone/releases/tag/v2.20.0): Error Prone 2.20.0

[Compare Source](google/error-prone@v2.19.1...v2.20.0)

Changes:

-   This release is compatible with early-access builds of JDK 21.

New Checkers:

-   [`InlineTrivialConstant`](https://errorprone.info/bugpattern/InlineTrivialConstant)
-   [`UnnecessaryStringBuilder`](https://errorprone.info/bugpattern/UnnecessaryStringBuilder)
-   [`BanClassLoader`](https://errorprone.info/bugpattern/BanClassLoader)
-   [`DereferenceWithNullBranch`](https://errorprone.info/bugpattern/DereferenceWithNullBranch)
-   [`DoNotUseRuleChain`](https://errorprone.info/bugpattern/DoNotUseRuleChain)
-   [`LockOnNonEnclosingClassLiteral`](https://errorprone.info/bugpattern/LockOnNonEnclosingClassLiteral)
-   [`MissingRefasterAnnotation`](https://errorprone.info/bugpattern/MissingRefasterAnnotation)
-   [`NamedLikeContextualKeyword`](https://errorprone.info/bugpattern/NamedLikeContextualKeyword)
-   [`NonApiType`](https://errorprone.info/bugpattern/NonApiType)

Fixes issues: [#&#8203;2232](google/error-prone#2232), [#&#8203;2243](google/error-prone#2243), [#&#8203;2997](google/error-prone#2997), [#&#8203;3301](google/error-prone#3301), [#&#8203;3843](google/error-prone#3843), [#&#8203;3903](google/error-prone#3903), [#&#8203;3918](google/error-prone#3918), [#&#8203;3923](google/error-prone#3923), [#&#8203;3931](google/error-prone#3931), [#&#8203;3945](google/error-prone#3945), [#&#8203;3946](google/error-prone#3946)

**Full Changelog**: google/error-prone@v2.19.1...v2.20.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errorprone not an OSGi bundle
2 participants