adding jar offset rewriting and support for preamble scripts from files #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After realizing that the original lein-bin repository was dead and failing to find this one for months, I finally did. This PR is replicating the following PR I did in that repo a while back:
Raynes/lein-bin#29
The original comment from that PR pasted below for reference (in case the original lein-bin repo goes away etc).
TLDR: rewriting jar files the way this lib currently does (prepending data to the jar) leaves the jar file integrity compromised. You can see this by issuing:
on a jar file created with lein-binplus. We can see that the file is processed anyway, but unzip gives us a warning. Other tools such as zipdetails does not fare so well:
this PR uses clj-zip-meta to rewrite the jar-internal offsets so that the jar file integrity is regained.
Should be noted that clj-zip-meta is not as performant as I would have liked. It can take a few seconds to rewrite the offsets. I know how to increase performance of clj-zip-meta, just haven't had the time. Still, I would rather have it correct and a few seconds slow than incorrect and fast : )
I also added the ability to use external prelude scripts (from files) as some of the preludes I've come up with (drip jvm launcher support for exapmle) turned out to be so complex I would rather not hard code them into the project.clj file.
I submit this pull request in all humbleness and I have to say I'm quite happy to find a maintained fork of lein-bin on github.
Original Pull Request Comment
First of all, thank you for this library. I have been looking for a way to do this for ages and this really solves the problem in an elegant and once-and-for-all way.
With that being said, the current state of this library still left me with two items missing from my wish list of perfection:
unzip -l
on the resulting jar).I'm somewhat new to clojure and solving this problem led me down quite a journey. In (not so) short:
apologies for the rambling. It was some journey and I would like to thank the writers of this library for writing something so good that it was worth the above trouble to improve on.
If you deem this change acceptable, great. If not, this still solves my local problem so again, many thanks for this library.