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

Pathing jar #3

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
1 participant
@timgilbert
Copy link

timgilbert commented Mar 8, 2019

Hey, so this is probably not fully-baked yet, but it does provide a working solution to #2 so I thought I'd put it up for review and feedback. What it does is to create a pathing jar if the -classpath parameter is too long for Windows, and then removes the jar after the java invocation exits. This is not the most elegant solution but it does work for me (on java 1.8.0_172-b11) and I'm able to fire up clj in my big project with tons o' dependencies.

We could probably hook into the tools.deps caching mechanism to improve this - currently it generates a jar on every invocation of clj, but it might actually be better to generate the jar from the Clojure side when the classpath cache files are generated and leave them in ~/.clojure somewhere. One complication with that is that classpaths in jar manifests are required to be relative paths, so the pathing jar currently creates them in the user's .m2 repository root.

@timgilbert timgilbert force-pushed the timgilbert:pathing-jar branch from ae579d8 to da309d9 Mar 8, 2019

@timgilbert

This comment has been minimized.

Copy link
Author

timgilbert commented Mar 8, 2019

Note: this is working, but somewhat ugly; I'll probably pursue fixing this from the Clojure side, which I've detailed at https://dev.clojure.org/jira/browse/TDEPS-120. I was able to test this locally and was able to use absolute paths in the pathing jar by transforming them to file:///C:/Users/tim/.m2/ ... format.

@timgilbert

This comment has been minimized.

Copy link
Author

timgilbert commented Mar 20, 2019

I've managed to produce half of a solution for this in TDEPS-120, which adds a flag to make-classpath that will produce a pathing jar file. This uses the java.util.jar APIs to create the manifest and jar file from the Clojure side of things when the classpath is being generated, which should be a better, faster way to do things versus to shelling out to jar.exe from the PowerShell side of things.

Assuming the patches there get merged, this will still require some updates to the PowerShell side of things to pass the --cp-jar file to clojure during classpath generation and then to actually execute Clojure via java.exe -cp .cpcache/38473872.jar clojure.main or whatnot. I'll open a different PR for that work, and close this one for now.

@timgilbert timgilbert closed this Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.