[bndlib] Provide a `-nice` option
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.
-prettyprint
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
@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.
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.
@pkriens if you don't have any objections in general, you can assign this to me.
Why not make it the standard? No option? They are functionally the same manifests and it only adds a few more characters.
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 🤣
Yeah, that would work :-)
The only problem might be test case ... We are actually looking at the manifest in some places I think.
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 https://github.com/bndtools/bnd/pull/6323/commits/0503ff76aefc63a909e6e47847acc16e374a727b of PR https://github.com/bndtools/bnd/pull/6323/files
@chrisrueger can this be closed?
@chrisrueger can this be closed?
I won't have the time right now to work on it. There is still your suggestion in closed PR https://github.com/bndtools/bnd/pull/6323#issuecomment-2407597883 So maybe somebody can take this over in the future. Yes, so let's close it (for now, if you want to keep the issue list small)