tools-deps

borkdude 2025-08-07T14:14:55.650889Z

Is this behavior correct, if just the :test alias contains a main function, but not :sci or :demo should it still pick the main function from :test ? It's kind of annoying since I want to invoke my own main function from the command line while having deps from these aliases and clj -A:... doesn't do what I'd expect either (still)

clj -M:build:test:sci:demo -m shadow.cljs.devtools.cli watch viewers

seancorfield 2025-08-07T14:17:23.727319Z

This is why I often have both a :test and a :runner alias. It's also why I have a :no-main alias in my user deps.edn: https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn#L37-L39

borkdude 2025-08-07T14:17:49.004339Z

I was just going to type:

Adding an alias :clear-main {:main-opts []} would solve it but this feels a bit like CSS ;)

😅 1
seancorfield 2025-08-07T14:17:49.976309Z

clj -M:build:test:sci:demo:no-main -m shadow.cljs.devtools.cli watch viewers

borkdude 2025-08-07T14:19:01.726809Z

Does -X also work like this? if :test has an exec-fn but :demo hasn't, does it still pick the exec-fn from :test? I thought I'd seen different behavior before but could be wrong

seancorfield 2025-08-07T14:19:42.477629Z

:exec-fn is last-one-wins since that option in merge'd

borkdude 2025-08-07T14:20:07.773009Z

right, I guess it's just merging all the things then

seancorfield 2025-08-07T14:20:20.420929Z

But if you have :test set up to work with -X (only) then you can safely use -M:test without getting stray main opts.

borkdude 2025-08-07T14:20:29.125219Z

yeah

thheller 2025-08-07T14:31:52.068899Z

FWIW I'm open to adding a shadow-cljs "entry" that works with -X, as in takes a map instead of the standard command line arguments

thheller 2025-08-07T14:32:36.695349Z

but not really related to the question I guess 😉

borkdude 2025-08-07T14:33:57.475369Z

Yeah not a big issue, the issue is more general than shadow. I think if -A did nothing more than add a bunch of deps to the classpath, this would be what I used

seancorfield 2025-08-07T14:34:23.530829Z

@alexmiller Maybe when we get to Clojure 1.13, we can have a CLI 1.13.0.xxxx that finally drops :main-opts from -A so it can be used as above? 🙂

✨ 1
🎉 1
2025-08-07T14:36:26.457869Z

That would be great

seancorfield 2025-08-07T14:37:18.680399Z

(that would be a tools.deps change I believe?)

borkdude 2025-08-07T14:49:00.982169Z

yes, just a tools.deps change, not a clojure change

seancorfield 2025-08-07T15:38:54.965399Z

Well, the CLI needs an update to include that tools.deps change since it's a bundled uberjar, right?

borkdude 2025-08-07T15:42:48.974539Z

yes, with clojure I mean the language. with tools.deps I roughly meant the CLI + tools.deps

seancorfield 2025-08-07T17:03:13.847779Z

Right, I just meant that it seems like a change that would be unlikely to be made in a 1.12.1.xxxx version since it's a "big" change (and potentially breaking people's workflows if they've been ignoring the deprecation warning). Hence thinking 1.13.0.yyyy would be a good time to make the change.