Fork me on GitHub
#tools-deps
<
2023-03-24
>
mkvlr09:03:57

given :main-opts in my :test alias and none in my :dev alias, is there a way for me to start with clojure.main so I can do clj -M:dev:test -e ,,,? clj -M:test:dev will run :main-opts from :test which I don’t want.

borkdude11:03:34

The hack I use for this is:

clj -Scp $(clj -Spath -A:dev:test) -M -e ...

borkdude11:03:50

Optimally you should be able to:

clj -A:dev:test -M -e 
but currently -A: still runs :main-opts which I hope will be removed sooner than later

seancorfield12:03:33

Use -r to start a REPL: clj -A:dev:test -r

borkdude12:03:36

@U04V70XH6 -A:dev:test will still kick off the :main-opts of the :test alias, no?

borkdude12:03:53

and shouldn't this be -M -r?

seancorfield13:03:46

Hmm, I shouldn't offer advice at 6 am without coffee. I use -r on some projects but I think maybe I have an empty :main-opts in an alias and use that to override previous :main-opts

seancorfield13:03:48

Ah, you can hack around it by doing clj -X:dev:test -M -r

👍 2
seancorfield13:03:11

I will now either go back to bed for a few hours or make a

borkdude13:03:56

ah nice, the -X is good :)

borkdude13:03:04

thanks for the hack!

borkdude12:03:38

Unfortunately the -X hack didn't work, I'm getting:

Unqualified function can't be resolved: -M

borkdude12:03:36

@U064X3EF3 When can we get -A with ignorance of :main-opts? 🙏

Alex Miller (Clojure team)12:03:53

Can’t you just split into two aliases as a workaround? Seems like you’re making this so hard

borkdude12:03:40

yes, that has been the workaround, but it's a workaround that keeps coming up ;)

borkdude12:03:56

but good to hear it's coming

Alejandro17:03:02

Why are the resources and target dirs included in :paths ["src" "resources" "target"] in the documentation of figwheel? Isn't this option for listing source code directories? https://figwheel.org/docs/create_a_build.html

seancorfield17:03:12

Did you mean to ask that in the #CALJ3BFLP channel?

Alejandro17:03:36

Oh, yeah. But anyway, it's deps.edn.

seancorfield17:03:57

Sure, but only Figwheel users (or possibly only the Figwheel maintainers) will know the answer to this.

seancorfield17:03:28

:paths just puts folders on the classpath so they're available when running code.

seancorfield17:03:58

(so, no, it's not just source code directories -- it's anything you want on the classpath)

seancorfield18:03:36

Having target on the classpath sounds a bit odd to me but I guess it depends what Figwheel puts into that folder.

seancorfield18:03:24

If you've been using Leiningen (or Boot) previously, maybe this old blog post of mine will shed some light? https://corfield.org/blog/2018/04/18/all-the-paths/

Alejandro18:03:23

Yeah, this explains a lot, thanks.

borkdude19:03:22

I don't think this is the reason figwheel chose this, but having the target/classes directory in paths is somewhat necessary for libraries that support deps/prep-lib