tools-deps

teodorlu 2024-12-02T12:10:34.385289Z

Hi! How can I find out which version of org.clojure/tools.deps the clojure CLI is using internally? I'm debugging a problem where our CI appears to be running an old version of tools.deps, and I'm trying to narrow down the problem space.

mkvlr 2024-12-02T12:12:38.570849Z

can try https://clojuredocs.org/clojure.core/clojure-version without a deps.edn in the current working dir

πŸ‘€ 1
teodorlu 2024-12-02T12:23:49.116849Z

From CI logs:

bash -c "(mkdir /tmp/fresh && cd /tmp/fresh && clojure -e '(clojure-version)')"
WARNING: Implicit use of clojure.main with options is deprecated, use -M
"1.12.0"
Based on the 1.12.0 result, I'd conclude that we run a recent Clojure version.

teodorlu 2024-12-02T12:26:32.491109Z

The symptom is that Git deps with :git/sha fail to download, complaining that :sha is missing.

Library no.cjohansen/replicant has missing :sha in coordinate.
deps.edn contains this dep:
no.cjohansen/replicant {:git/url ""
                                :git/sha "0cb5064f40a20fc4525bcb018a022cef3dc05da3"}
The official deps.edn reference recommends :git/sha, not :sha. From what I can tell, :git/sha has been allowed for about two years.

mkvlr 2024-12-02T12:29:27.782469Z

ah wait you’re looking for the CLI version? That’s in the clojure script I think

πŸ‘ 1
Alex Miller (Clojure team) 2024-12-02T12:31:26.015229Z

if you do clj -version that tells you the CLI version. https://github.com/clojure/brew-install/blob/1.12.0/CHANGELOG.md can probably be used to find the associated tools.deps version

πŸ‘ 1
Alex Miller (Clojure team) 2024-12-02T12:34:35.759149Z

:sha was original (still supported for backwards compatibility), and :git/sha has been around and preferred since circa tools.deps 0.12.985 / Clojure CLI 1.10.3.933

πŸ‘ 1
Alex Miller (Clojure team) 2024-12-02T12:35:23.285109Z

but the real error may be that it's not finding that sha in the repo

Alex Miller (Clojure team) 2024-12-02T12:35:30.389379Z

indeed, I do not see that sha in that repo

Alex Miller (Clojure team) 2024-12-02T12:36:00.162989Z

oh, no it is there

πŸ‘ 1
teodorlu 2024-12-02T12:37:22.291879Z

Great, that helps narrow down the problem. I'm printing a clojure --version, which from what I can tell is the most recent CLI version (https://github.com/clojure/brew-install/blob/1.12.0/CHANGELOG.md), which should support :git/sha.

$ clojure --version
Clojure CLI version 1.12.0.1488

Alex Miller (Clojure team) 2024-12-02T12:39:31.218239Z

what command are you running to get that error?

teodorlu 2024-12-02T12:43:36.917609Z

clojure --version

Alex Miller (Clojure team) 2024-12-02T12:44:20.960119Z

the https://github.com/clojure/tools.deps/blob/78afc5492f06180c1d2c4904bc626207abb4e44f/src/main/clojure/clojure/tools/deps/extensions/git.clj#L79 that has been in tools.deps for the last 3 years like that says "sha", not ":sha", so you are seeing an old tools.deps, perhaps from a program dependency, not from the CLI dependency

πŸ‘ 1
Alex Miller (Clojure team) 2024-12-02T12:45:25.682569Z

if you are running a tool when you get that, it might be the tool's dependency

πŸ€” 1
Alex Miller (Clojure team) 2024-12-02T12:48:35.531579Z

if you are deploying Datomic Ions, I know they were using an old version of tools.deps for example (not sure if that has been updated)

teodorlu 2024-12-02T12:52:57.415769Z

Normals dependencies won't be able to modify the tools.deps version, right? --- I'm not running a tool, I'm running a clojure -M -m .... The following is the full Makefile target (with added lines for printing versions).

resources/fontawesome-icons:
	clojure --version
	bash -c "(mkdir /tmp/fresh && cd /tmp/fresh && clojure -e '(clojure-version)')"
	clojure -Sdeps "{:deps {no.cjohansen/fontawesome-clj {:mvn/version \"2024.01.22\"} \
	clj-http/clj-http {:mvn/version \"3.12.3\"} \
	hickory/hickory {:mvn/version \"0.7.1\"}}}" \
	-M -m fontawesome.import :download resources 6.4.2
The code runs on a Github action, set up with DeLaGuardo/setup-clojure@13.0:
- name: Install clojure tools
        uses: DeLaGuardo/setup-clojure@13.0
        with:
          cli: 1.12.0.1488

teodorlu 2024-12-02T12:56:21.801419Z

Thanks a lot for the help, @alexmiller and @mkvlr. I'll do some further digging on my own, I might have to try narrow down the problem from a different angle!

Alex Miller (Clojure team) 2024-12-02T12:57:53.839639Z

tools.deps is just a library. if you run a program that uses it as such, it can of course be out of date. I don't know what fontawesome.import does, but maybe it uses tools.deps

Alex Miller (Clojure team) 2024-12-02T12:58:33.460139Z

you could look at

clojure -Sdeps "{:deps {no.cjohansen/fontawesome-clj {:mvn/version \"2024.01.22\"} \
	clj-http/clj-http {:mvn/version \"3.12.3\"} \
	hickory/hickory {:mvn/version \"0.7.1\"}}}" -Stree

πŸ‘ 1
teodorlu 2024-12-02T13:47:59.635469Z

Apologies Alex and Martin: I was misreading Github Action terminal logs, and wasn't looking at the correct Makefile target. The Makefile target that was actually producing the errors depended on

{badigeon/badigeon {:git/url ""
                    :sha "f4bcca58536f49c10a5ea87b662f33ccf83338ce"}}
, which uses org.clojure/tools.deps.alpha {:mvn/version "0.11.910"}. If nothing else, I've learned a thing or two about tools.build!

Alex Miller (Clojure team) 2024-12-02T13:53:19.034229Z

yes, that's quite old. I think tools.build is probably a better choice now for what badigeon does

πŸ‘ 1