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 support for reading Multi-Release-Jar content #5357

Closed
wants to merge 1 commit into from

Conversation

laeubi
Copy link
Contributor

@laeubi laeubi commented Aug 24, 2022

This adds methods to the Jar class to read versioned content of a
multi-release jar for the following cases:

  • get a resource or a map of resources for a given release version
  • get a merged manifest according to the OSGi specification
  • get module name/version for a given given release version
  • list all contained release alternative versions

Beside this a unit-test is added to cover these new functions.

Signed-off-by: Christoph Läubrich laeubi@laeubi-soft.de

Copy link
Contributor

@timothyjward timothyjward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think the direction is good, with just a few small fixes required to match spec behaviour.

I would be interested in seeing the aQute.bnd.build.model.EE updated to provide access to the release int for each EE.

biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java Show resolved Hide resolved
biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java Show resolved Hide resolved
biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java Outdated Show resolved Hide resolved
biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java Show resolved Hide resolved
biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java Show resolved Hide resolved
Copy link
Contributor Author

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have applied the suggested fixes and enhanced the test-case.

@laeubi
Copy link
Contributor Author

laeubi commented Aug 24, 2022

I would be interested in seeing the aQute.bnd.build.model.EE updated to provide access to the release int for each EE.

If I understand the code correctly, this is simply EE.getCapabilityVersion().getMajor()

@timothyjward
Copy link
Contributor

At this point I'm happy and think this is worth merging - @bjhargrave do you have anything to add?

@timothyjward
Copy link
Contributor

If I understand the code correctly, this is simply EE.getCapabilityVersion().getMajor()

Yes, although the following isn't exactly readable...

EE myEE = getResolveTargetEE();
manifest = jar.getManifest(myEE.getCapabilityVersion().getMajor()).get();

@laeubi
Copy link
Contributor Author

laeubi commented Aug 24, 2022

I think it won't be a problem to add a new "getRelease()" method here, but lets see first if there is other to do.

@laeubi
Copy link
Contributor Author

laeubi commented Aug 24, 2022

thanks @timothyjward for the review, the Ci is also happy!

@laeubi
Copy link
Contributor Author

laeubi commented Aug 25, 2022

Yes, although the following isn't exactly readable...

EE myEE = getResolveTargetEE();
manifest = jar.getManifest(myEE.getCapabilityVersion().getMajor()).get();

I have opened

for this as it seems to be a valid enhancement regardless of MR support...

@laeubi
Copy link
Contributor Author

laeubi commented Aug 26, 2022

@bjhargrave I have now created two PRs based on this to show how one can uses the Multi-Release-Jar support to:

I hope this i sufficient to review this PR and decide if changes are required before this can be merged.

FYI @stbischof @rotty3000

@timothyjward
Copy link
Contributor

This adds methods to the Jar class to read versioned content of a
multi-release jar for the following cases:

- get a resource or a map of resources for a given release version
- get a merged manifest according to the OSGi specification
- get module name/version for a given given release version
- list all contained release alternative versions

Beside this a unit-test is added to cover these new functions.

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
@laeubi
Copy link
Contributor Author

laeubi commented Aug 28, 2022

The version should be 17 for the third check in the test.

Fixed!

@timothyjward
Copy link
Contributor

@bjhargrave - I think that this should be merged, can we go ahead?

@laeubi
Copy link
Contributor Author

laeubi commented Sep 27, 2022

@rotty3000 can you maybe help here? Its about a full month now with no feedback at all ... :-\

@bjhargrave
Copy link
Member

I am still working on ideas about mrjar support in a side branch based upon the narrative in https://github.com/bndtools/bnd/wiki/Multi-release-JAR-support-design-discussion. Sorry it is taking awhile but have other items to also work on.

Until I have a better idea on how we should handle mrjars, I don't want to merge this partial proposal.

@laeubi
Copy link
Contributor Author

laeubi commented Feb 8, 2023

So now after about half a year later is there any decision / progress on this?

@pkriens
Copy link
Member

pkriens commented Feb 20, 2023

@laeubi can you contact me via Peter.Kriens@aQute.biz? I'd like to have a zoom call to understand all this. I've kept myself out of this discussion (I am not convinced multi release jars are even remotely a good idea, they seem to suffer a lot of accidental complexity) but now with BJ out of the loop I need to get this of the PR list. So if you can contact me, we setup a call.

@laeubi
Copy link
Contributor Author

laeubi commented Feb 20, 2023

@pkriens I send you a mail, I think the main point is not if one likes MR or not, that's not a desiccation made by the tool, I just wanted to support it because more and more libs are start using this and it is part of the OSGi Spec for many years, but yes it might not be used much. That's also why I aim for a quite basic solution as a first step and from my testing with this it works quite good for the rare cases where I needed a MR jar (mostly to add OSGi headers to a 3rd party library).

@pkriens
Copy link
Member

pkriens commented Feb 23, 2023

I will take over this PR

@pkriens pkriens closed this Feb 23, 2023
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.

None yet

4 participants