tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
2020-11-28T17:10:04.082500Z

I swore I saw an example of a clojure shell script that included the deps.edn in the file itself, but no amount of googling is turning anything up. Was I dreaming, or is it possible?

nbardiuk 2020-11-28T17:11:36.082900Z

or if you need oneliner https://gist.github.com/nbardiuk/166dc6695bf55a351fa3070fd4065b8a

2020-11-28T17:11:38.083100Z

Awesome! Thanks @nbardiuk

dominicm 2020-11-28T18:52:01.083300Z

The shebang won't work on Linux, so don't do that

borkdude 2020-11-28T18:55:00.083500Z

Yep. The ericnormand example should work correctly on linux and macOS

borkdude 2020-11-28T18:55:58.083700Z

But not on Windows, because Windows doesn't have shebangs

dominicm 2020-11-28T18:56:16.083900Z

There's a Monroe shebang around somewhere that also works on both.

borkdude 2020-11-28T18:56:30.084100Z

That's why you should write a babashka script to launch Clojure cross platform ;P

dominicm 2020-11-28T18:57:14.084300Z

https://clojure.org/guides/faq#clj_standalone here you are :)

borkdude 2020-11-28T18:57:16.084500Z

I think you could pull that off with environment variables

borkdude 2020-11-28T18:58:02.084700Z

oh right, because strings are just constants :)

borkdude 2020-11-28T19:09:18.084900Z

Cross platform launcher script. Should work on linux, macos and Windows: https://github.com/babashka/book/issues/8

borkdude 2020-11-28T19:19:04.086900Z

I just found a cross platform way (which really means: also works on Windows) to the single script with deps "exec" bash trick to invoke a Clojure JVM script, using babashka: https://github.com/babashka/book/issues/8

👍 1
borkdude 2020-11-28T19:19:23.087400Z

You could also do this with JVM Clojure only, but then it's slightly slower because of the startup of the first JVM