This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-22
Channels
- # ai (1)
- # announcements (4)
- # babashka (23)
- # beginners (27)
- # biff (17)
- # calva (5)
- # clerk (6)
- # clj-commons (27)
- # clj-kondo (35)
- # clojars (12)
- # clojure (27)
- # clojure-denver (3)
- # clojure-europe (71)
- # clojure-norway (7)
- # clojure-spec (5)
- # clojure-uk (2)
- # clojurescript (45)
- # data-science (9)
- # datomic (4)
- # dev-tooling (2)
- # devcards (1)
- # hoplon (2)
- # hyperfiddle (36)
- # introduce-yourself (3)
- # malli (11)
- # missionary (2)
- # off-topic (63)
- # polylith (5)
- # rdf (2)
- # reagent (12)
- # schema (1)
- # shadow-cljs (11)
- # sql (6)
- # tools-deps (23)
- # xtdb (6)
I’m feeling a bit silly about this, but I can’t figure out the incantation to get a REPL using a tool classpath. Say I would normally do clojure -T:build <something>
to run a tool, how do I start a REPL with that classpath?
This made me curious. In theory you can run clojure -Tmy-tool some-fn
where some-fn
will start a REPL... but the gotcha is that it needs to accept a single hash map argument -- for -X
style invocation -- and I couldn't find anything that fit the bill...
Does this mean that no-one is using REPLs to develop their builds? It makes me feel better about not doing it myself, but surprises me.
You said "tool" so I assumed you meant -Tmy-tool
not -T:some-alias
clojure -A:the-alias
Yeah, I start a "build REPL" at work with clj -M:build -i build.clj -r
I think
Let me see what's in the script I use for that... I suspect it works well because it's a Polylith project and there are no dependencies unless you specify the :dev
alias 🙂
Oh, I only have that on my other machine so I can't check right now.
So I just tried that in my project, and I get the project paths, at least (`src` etc, not .
)
Mostly when I'm working with my build.clj
, I just use -M:build
or similar and don't care whether the rest of the project is accessible or not.
That seems odd, particularly since the paths are incorrect. I’m curious what others do.
So weirdly, the deps are correct but the paths are not. I suspect this is because the alias uses :deps
rather than :extra-deps
. I guess the paths are not a problem as long as your build is in a single file.
I guess it depends on how isolated you need it to be while working on it. You could use -Sdeps '{:paths ["."]}'
I suspect.
I tend to work on my build.clj
files alongside the project files so I want "src"
etc as my paths -- nothing in my build.clj
files relies on the paths being just "."
That wouldn’t work for me without something like the -Sdeps
trick, since I slurp config files from the path.
Actually, that would work as long as the CWD is set correctly, I guess only resource loading would be affected.
How do you normally start your REPL for working with code? Via Cursive, I'd assume, with nREPL etc?
Yes, either nREPL or socket REPL. But right, this is all part of a large change I’m making to how Cursive uses deps. I’m going to use deps.clj, which will make it easier to just allow people to enter the same things they’d enter on the command line to start their REPLs, and it’ll work more like the CLI than my current frankenintegration.