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

[bndlib] Provide a -nice option #6321

Open
laeubi opened this issue Oct 10, 2024 · 9 comments · May be fixed by #6323
Open

[bndlib] Provide a -nice option #6321

laeubi opened this issue Oct 10, 2024 · 9 comments · May be fixed by #6323

Comments

@laeubi
Copy link
Contributor

laeubi commented Oct 10, 2024

Felix Bundle plugin has a niceManifest option that formats Manifest

Output a nicely formatted manifest that still respects the 72 character line limit.

It would be good if bnd offers a -nice option as well, as manifest are sometimes inspected on raw text editors as well, used in debug outputs and so on.
If bndlib offer the code, felix can even migrate to that code to reduce duplication of such efforts.

@stbischof
Copy link
Contributor

stbischof commented Oct 10, 2024

-prettyprint

@chrisrueger
Copy link
Contributor

chrisrueger commented Oct 10, 2024

bnd cli already has print command (via JarPrinter.java which is also used in the print view of the JarViewer), but after reading your sentence again, I don't think it respects the 72 character limit.

But we could try to integrate it.
I think in bnd the manifest writing part is in https://github.com/bndtools/bnd/blob/master/aQute.libg/src/aQute/lib/manifest/ManifestUtil.java

@laeubi
Copy link
Contributor Author

laeubi commented Oct 10, 2024

@chrisrueger the Jar printer prints something completely different that is not usable as a Manifest file as far as I see.

The option in maven-bunlde plugin produces something that is used as the manifest actually located inside the jar itself.

@chrisrueger
Copy link
Contributor

chrisrueger commented Oct 10, 2024

I updated my comment.

we could try to integrate it.
I think in bnd the manifest writing part is in https://github.com/bndtools/bnd/blob/master/aQute.libg/src/aQute/lib/manifest/ManifestUtil.java

and hook in https://github.com/bndtools/bnd/blob/master/biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java#L366 to read a new "-nice" / "prettyprintManifest" instruction

String nice = getProperty(NICE);

and pass it along.
Should be doable.

Could you contribute the addition to ManifestUtil so that it can do what Felix ManifestWriter does?

I can help out with the rest. I just added a new instruction in another PR so I have touched some relevant places.

@chrisrueger
Copy link
Contributor

@pkriens if you don't have any objections in general, you can assign this to me.

@pkriens
Copy link
Member

pkriens commented Oct 10, 2024

Why not make it the standard? No option? They are functionally the same manifests and it only adds a few more characters.

@chrisrueger
Copy link
Contributor

chrisrueger commented Oct 10, 2024

Why not make it the standard? No option? They are functionally the same manifests and it only adds a few more characters.

Can I then have an "ugly" option? sorry couldn't resist 🤣

@chrisrueger chrisrueger linked a pull request Oct 11, 2024 that will close this issue
@pkriens
Copy link
Member

pkriens commented Oct 11, 2024

Yeah, that would work :-)

The only problem might be test case ... We are actually looking at the manifest in some places I think.

@chrisrueger
Copy link
Contributor

chrisrueger commented Oct 11, 2024

The only problem might be test case ... We are actually looking at the manifest in some places I think.

There were indeed two testcases in bnd which failed after I added the nice-writer from felix.
I fixed them in commit 0503ff7 of PR https://github.com/bndtools/bnd/pull/6323/files

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 a pull request may close this issue.

4 participants