tools-deps

bhauman 2025-02-03T20:07:47.394279Z

OK I have jarred up and deployed a tool rebel-readline-nrepl 0.1.5-SNAPSHOT and then installed it

clojure -Ttools install com.bhauman/rebel-readline-nrepl '{:mvn/version "0.1.5-SNAPSHOT"}' :as nrebel  

bhauman 2025-02-03T20:11:16.609649Z

and deps.edn has the :tools/usage entry:

:tools/usage {:ns-default rebel-readline.nrepl}
yet when I go to execute it I'm getting an error indicated that the :tools/usage isn't really getting picked up.
clojure -Tnrebel connect :port 50668
Unqualified function can't be resolved: connect And of course this works:
clojure -Tnrebel rebel-readline.nrepl/connect :port 50668

bhauman 2025-02-03T20:12:14.774489Z

Is there something that needs to happen during packaging that I'm missing?

bhauman 2025-02-03T20:15:40.785239Z

And or is there documentation that I'm not finding?

lread 2025-02-03T20:20:53.608769Z

I guess the first thing to check is if the latest snapshot is being downloaded from clojars.

lread 2025-02-03T20:22:44.468139Z

Oh probably not that. I just tried and could reproduce it (I would not have had any of your snapshots in my local m2 repo). Now I actually have to READ what you asked. simple_smile

Alex Miller (Clojure team) 2025-02-03T20:33:11.145359Z

There is not currently a way to pick up tools/usage from mvn jars, only from git and local

bhauman 2025-02-03T20:33:45.868169Z

Ahhhh, I was just starting to come to that conclusion

bhauman 2025-02-03T20:34:03.002479Z

very nice to have it confirmed

bhauman 2025-02-03T20:34:45.776019Z

considering the deps.edn isn't included in the package it makes sense

lread 2025-02-03T20:34:57.954959Z

Ah. Right. <Lee stops poking around. simple_smile>

Alex Miller (Clojure team) 2025-02-03T20:35:25.784899Z

https://clojure.org/reference/deps_edn#tools implies this but I guess doesn’t say it explicitly

Alex Miller (Clojure team) 2025-02-03T20:36:15.012899Z

Kind of a tbd area

bhauman 2025-02-03T20:55:44.800449Z

Yeah reading that, it's pretty explicit. I swear I'd read that 20 times but it didn't dent the assumptions, thanks!

Alex Miller (Clojure team) 2025-02-03T21:01:59.497799Z

The question is like where should you put it in the jar - what path, in the manifest, in a special classifier file in maven (ala .pom), etc

bhauman 2025-02-03T21:02:58.883309Z

the easiest would be the "/src" ?

Alex Miller (Clojure team) 2025-02-03T21:03:01.192179Z

If you put it in file at root, they all collide in classpath so pretty gross

Alex Miller (Clojure team) 2025-02-03T21:03:37.294899Z

There is no src/ in the jar

bhauman 2025-02-03T21:03:49.674419Z

oh Yeah

Alex Miller (Clojure team) 2025-02-03T21:04:38.334889Z

Maven has a convention for this stuff under meta-inf but I just couldn’t decide when I last looked at it

Alex Miller (Clojure team) 2025-02-03T21:05:21.712639Z

Is there some reason you want to distribute as jar vs github?

Alex Miller (Clojure team) 2025-02-03T21:05:40.877409Z

For tools, the latter is usually ok

bhauman 2025-02-03T21:08:51.533599Z

It should be fine but I'm still having trouble doing even that:

clojure -Ttools install-latest :lib com.bhauman/rebel-readline :coord '{:git/url "" :deps/root "/rebel-readline"}' :as testrr

Alex Miller (Clojure team) 2025-02-03T21:11:50.403179Z

it's looking for a deps.edn or pom.xml at https://github.com/bhauman/rebel-readline

Alex Miller (Clojure team) 2025-02-03T21:12:13.817409Z

I guess b/c you have it in subdir?

Alex Miller (Clojure team) 2025-02-03T21:12:51.242239Z

oh, no leading / in that :deps/root

Alex Miller (Clojure team) 2025-02-03T21:14:41.234989Z

and at latest tag (0.1.4), that deps.edn isn't there

Alex Miller (Clojure team) 2025-02-03T21:14:52.945519Z

install-latest of git deps only works off latest tag (assuming you don't specify a sha)

bhauman 2025-02-03T21:16:55.260399Z

yep! thanks! It's working and I understand it much better now. Time to finish the readme

Alex Miller (Clojure team) 2025-02-03T21:17:56.662159Z

so like clojure -Ttools install io.github.bhauman/rebel-readline '{:deps/root "rebel-readline" :git/sha "8960ca7281d58e76a0c8a9253f581eed95019357"}' :as testrr works

bhauman 2025-02-03T21:19:38.619139Z

Thanks! and it all makes perfect sense in hindsight.. I just haven't had to use the git coords or tools much before. I really appreciate the help with this.

Alex Miller (Clojure team) 2025-02-03T21:27:58.499909Z

np, happy to support people doing more with it and keep pushing the boundaries of it! I would like to figure out the maven tool thing

bhauman 2025-02-03T21:28:51.188969Z

Does install-latest cache the latest tag?

Alex Miller (Clojure team) 2025-02-03T21:32:13.744419Z

it will install a file based on the tool name at ~/.clojure/tools/testrr.edn - if via install-latest, that should have both tag and sha

Alex Miller (Clojure team) 2025-02-03T21:33:30.253729Z

not sure if you mean "cache the tag name" or "cache the repo at the tag" - both are true in different ways

bhauman 2025-02-03T21:33:53.883609Z

clojure -Ttools install :lib com.github.bhauman/rebel-readline :coord '{:deps/root "rebel-readline"}' :as testanother

bhauman 2025-02-03T21:34:49.801019Z

My concern is I pushed a tag v0.1.5-snapshot and it's not working perhaps there is a lag on the tag being seen via caching on the github end

Alex Miller (Clojure team) 2025-02-03T21:36:03.160619Z

you're using install there, which requires a :git/sha I think? did you mean install-latest?

bhauman 2025-02-03T21:36:19.624509Z

sorry its install latest

bhauman 2025-02-03T21:36:48.001489Z

clojure -Ttools install-latest :lib com.github.bhauman/rebel-readline :coord '{:deps/root "rebel-readline"}' :as testanother
Execution error (ExceptionInfo) at clojure.tools.deps.extensions/throw-bad-manifest (extensions.clj:158). Manifest file not found for com.github.bhauman/rebel-readline in coordinate {:deps/root "rebel-readline", :git/tag "v0.1.4", :git/sha "9486d3a"}

Alex Miller (Clojure team) 2025-02-03T21:37:57.887169Z

clojure -T:deps find-versions :lib com.github.bhauman/rebel-readline
seems to find the tag

Alex Miller (Clojure team) 2025-02-03T21:39:28.351669Z

I wonder if the coord is being ignored here

bhauman 2025-02-03T21:40:34.043059Z

but it's outputing {:deps/root "rebel-readline", :git/tag "v0.1.4", :git/sha "9486d3a"}

Alex Miller (Clojure team) 2025-02-03T21:43:46.257199Z

yeah, not sure what's happening there, give me a moment and I'll look at it in a repl

Alex Miller (Clojure team) 2025-02-03T21:46:03.197549Z

oh, it's filtering out the snapshot tag

Alex Miller (Clojure team) 2025-02-03T21:46:30.007759Z

uses similar logic to maven and ignores snapshot tags when finding "latest"

Alex Miller (Clojure team) 2025-02-03T21:46:50.466559Z

(defn- release-version?
  "Release version does not contain any of:
    a, alpha, b, beta, m, milestone, rc, cr, snapshot"

bhauman 2025-02-03T21:48:45.817649Z

of course I found another edge case

Alex Miller (Clojure team) 2025-02-03T21:48:55.328929Z

yeah, I forgot about that one :)

bhauman 2025-02-03T22:26:52.039129Z

Well, gosh, I guess I'm just hitting all the walls. Now it's installing and I'm back to where I'm getting the unqualified function error:

clojure -Ttools install-latest :lib com.github.bhauman/rebel-readline :coord '{:deps/root "rebel-readline-nrepl"}' :as nrebel
nrebel: Installed com.github.bhauman/rebel-readline v0.1.4.1 {:deps/root "rebel-readline-nrepl", :git/tag "v0.1.4.1", :git/sha "8960ca7"}
bruce$ clojure -Tnrebel connect :port 50668
Unqualified function can't be resolved: connect
rebel-readline-nrepl/deps.edn
{:paths ["src"]
 :deps  {com.bhauman/rebel-readline {:mvn/version "0.1.5-SNAPSHOT"}
         ;; DEV for cider
         ;;com.bhauman/rebel-readline {:local/root "../rebel-readline"}
         nrepl/nrepl {:mvn/version "1.3.1"}
         org.clojure/tools.cli {:mvn/version "1.1.230"}}
 :tools/usage {:ns-default rebel-readline.nrepl} <<<<<<<<<<<HERE
rebel-readline-nrepl/src/rebel-readline/nrepl.clj
(ns rebel-readline.nrepl
  "This is the interface for clojure tools"
  (:require [rebel-readline.nrepl.main :as main]))

(defn connect [config]
  (main/start-repl (or config {})))
I'm betting it's the subdirectory...

Alex Miller (Clojure team) 2025-02-03T23:03:05.663659Z

going to start threading so we're not spamming the channel...

Alex Miller (Clojure team) 2025-02-03T23:03:40.620149Z

the subdir makes it into the ~/.clojure/tools/nrebel.edn so that's good (we did actually fix some stuff in this area recently)

bhauman 2025-02-03T23:04:03.900819Z

oh I should get the latest

Alex Miller (Clojure team) 2025-02-03T23:04:50.634499Z

does clojure -Tnrebel rebel-readline.nrepl/connect :port 50668 work as expected?

bhauman 2025-02-03T23:05:00.338739Z

yes it does

bhauman 2025-02-03T23:06:32.385249Z

I have the latest version of clojure so I should have the latest tools.deps

Alex Miller (Clojure team) 2025-02-03T23:17:11.365739Z

I'm looking, give me a few

bhauman 2025-02-03T23:20:28.152599Z

thank you

Alex Miller (Clojure team) 2025-02-03T23:22:58.930189Z

this is exactly an area where I made significant changes about a month ago :)

Alex Miller (Clojure team) 2025-02-03T23:27:31.002749Z

you misspelled ":tools/useage" in your deps.edn, should be :tools/usage :)

Alex Miller (Clojure team) 2025-02-03T23:31:17.130209Z

seems to flow through as expected once I changed that in my local checkout

bhauman 2025-02-03T23:37:12.308269Z

I am sorry. I thought that change was checked in. I owe you... Somehow I knew we'd end up here with the egg dripping off my nose.

Alex Miller (Clojure team) 2025-02-04T00:05:34.709169Z

No worries, happy to check through all this, has not seen that much use

🙏 1