-
Notifications
You must be signed in to change notification settings - Fork 835
fix(exposition): export internal package for OSGi resolution #2415
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -61,6 +61,21 @@ | |||||||
|
|
||||||||
| <build> | ||||||||
| <plugins> | ||||||||
| <plugin> | ||||||||
| <groupId>org.apache.felix</groupId> | ||||||||
| <artifactId>maven-bundle-plugin</artifactId> | ||||||||
| <configuration> | ||||||||
| <instructions> | ||||||||
| <!-- Required for OSGi: textformats loads protobuf impl via Class.forName --> | ||||||||
| <Export-Package> | ||||||||
| io.prometheus.metrics.expositionformats.generated*;version="${project.version}" | ||||||||
| </Export-Package> | ||||||||
| <_exportcontents> | ||||||||
| io.prometheus.metrics.expositionformats.internal;version="${project.version}" | ||||||||
| </_exportcontents> | ||||||||
| </instructions> | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While verifying this fix I hit a second manifest problem in this bundle that's pre-existing, but
…while the jar contains zero Why this blocks the original report: Second-order effect from this PR specifically: the newly exported Adding
Suggested change
Resulting manifest: with all that being said, are there some tests we can include to verify that all of this actually works and fixes the issue? I have limited experience with OSGi, so I defer to you and @anjeongkyun to hopefully weigh in |
||||||||
| </configuration> | ||||||||
| </plugin> | ||||||||
| <plugin> | ||||||||
| <groupId>org.apache.maven.plugins</groupId> | ||||||||
| <artifactId>maven-resources-plugin</artifactId> | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,21 @@ | |
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.felix</groupId> | ||
| <artifactId>maven-bundle-plugin</artifactId> | ||
| <configuration> | ||
| <instructions> | ||
| <!-- Required for OSGi: textformats loads protobuf impl via Class.forName --> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is the right diagnosis, and it points at the half of the problem that this PR doesn't fix.
So a deployment that installs only One line in <Import-Package>io.prometheus.metrics.expositionformats.internal;resolution:=optional,*</Import-Package>I built this and confirmed the manifest:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, the comment sits above |
||
| <Export-Package> | ||
| io.prometheus.metrics.expositionformats.generated*;version="${project.version}" | ||
| </Export-Package> | ||
| <_exportcontents> | ||
| io.prometheus.metrics.expositionformats.internal;version="${project.version}" | ||
| </_exportcontents> | ||
| </instructions> | ||
| </configuration> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.codehaus.mojo</groupId> | ||
| <artifactId>build-helper-maven-plugin</artifactId> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${project.version}is1.8.1-SNAPSHOTon snapshot builds, which isn't valid OSGi versionsyntax, so bnd rewrites it to
1.8.1.SNAPSHOT. That sorts below a released1.8.1. Built bothbranches to confirm the delta:
bnd already defaults exported-package versions to the cleaned project version, so on a release
build the attribute produces exactly what you'd get without it — it only changes behavior on
snapshots, and only for the worse. Dropping it restores
1.8.1(verified locally).Same applies to
prometheus-metrics-exposition-formats-shaded/pom.xml