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

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

Closed
jeroenvandijk opened this issue Jan 6, 2023 · 0 comments · Fixed by #47
Closed

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

jeroenvandijk opened this issue Jan 6, 2023 · 0 comments · Fixed by #47

Comments

@jeroenvandijk
Copy link
Contributor

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*)
  • The install process has to find the main class, and fail if it cannot find the main-ns (and maybe also when it cannot find a -main in that namespace).

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.

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.

1 participant