babashka / bbin

Install any Babashka script or project with one command
MIT License
139 stars 9 forks source link

No need to run uberjar via babashka.process/exec #46

Closed jeroenvandijk closed 1 year ago

jeroenvandijk commented 1 year ago

bbin install <uberjar> will create a wrapper script that relies on babashka.process/exec to execute the jar. This means that babashka is invoked twice, adding extra startup time for the script (also see #45).

After some personal testing and a conversation with @borkdude in Slack I believe this is unnecessary.

Proposed alternative

(require '[babashka.classpath :refer [add-classpath]])
(add-classpath "the-uber-jar.jar")
(require '[the-main-ns])
(apply the-main-ns/-main *command-line-args*)

I've played around with the compiled code from Babashka itself to find the main ns and I found that this runs in interpreted Babashka as well. (here and here)

I'll create a PR for this issue somewhere the coming days unless there are reasons for babashka.process/exec that I missed.