This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-23
Channels
- # adventofcode (16)
- # babashka (41)
- # beginners (31)
- # biff (1)
- # calva (9)
- # clj-otel (2)
- # clojure (124)
- # clojure-austin (1)
- # clojure-belgium (1)
- # clojure-europe (11)
- # clojure-nl (3)
- # clojure-norway (8)
- # clojure-uk (5)
- # clojuredesign-podcast (10)
- # cryogen (1)
- # cursive (4)
- # data-science (1)
- # datomic (12)
- # emacs (37)
- # events (2)
- # fulcro (13)
- # guix (1)
- # honeysql (1)
- # hyperfiddle (8)
- # jobs (1)
- # missionary (21)
- # overtone (3)
- # pathom (6)
- # polylith (1)
- # portal (1)
- # practicalli (1)
- # releases (1)
- # remote-jobs (13)
- # ring (2)
- # sci (14)
- # shadow-cljs (23)
- # squint (4)
Here's some docs regarding that: https://github.com/babashka/babashka/wiki/Self-contained-executable#tasks
When you use this option does the :init task get called in the same way that the bb task-name
does?
I also have a supplementary question - you say put the bb.edn on your classpath, as I am not a java dev, what does that actually mean in practical terms?
the wiki already explains:
Put the file in resources/META-INF/bb.edn
and add resources
to your classpath
Thanks I was looking at the bb book, and was struggling to understand this - my bad - not yours.
no problem! all the files that are on the classpath end up in the jar, but without the paths prepended.
so file resources/foo.txt
becomes /foo.txt
in the jar file (a jar file is just a zip file)
you have to provide a copy of your bb.edn there, else it won't be part of the jar and bb doesn't have this information
you can just make this part of your build script, copy the file and ignore it in gitignore, be creative ;)
Interestingly, when you do this the bb tasks
option is not available - i.e. ./uber-foo tasks
does not return the tasks list with docs?
The normal bb arguments do not apply since it's now your own self-contained binary, babashka arguments are not read anymore
I have followed that and have the tasks working from an exec. I was just pointing out that there is a bb option to view the liast of tasks and that is not available when you create the self-contained executable. It would just be good to have a way to tell the user the list of tasks as in bb tasks. Everything else is working as your docs says.
unfortunately I don't think there is currently a way to call bb tasks
programmatically
I was just stating that as the tasks option is my main entry point for my users, being able to show the list of tasks as in bb tasks
from the self-contained executable would be good.
I was wondering about having a task that read the resources/META-INF/bb.edn file and printed out the list.
Understood. Since this isn't exposed today (but we could in a future version, issue welcome), perhaps you can copy-paste the logic from here:
I don't think you really need the sci-ctx etc. It's basically just reading an EDN file and determining the original order of tasks, and then print the stuff
it's slightly more complicated in the original, but you can probably simplify it for your purposes. it prints docstrings from functions and therefore it needs to load stuff on demand
The io/resource does not seem to return the file. fs/cwd returns the location where the self-contained exe (SCE) is running. I am not sure how you can get inside the exe to access the uberjar files?
@U4C3ZU6KX binaries are OS-specific so you need to build for each OS specifically, but given that you can already download binaries for bb for each OS, you can build all of them on a single machine
I would go with the -static binary wherever possible for linux and ignore the non-static one
How to manage verbose argument in babashka? Anyone has a guide about it? Perhaps just a general guide about logging message would be what I need. I am always wondering how it should be managed