clojure-dev 2024-05-02

For cider stuff, we can wrap clojure with a clojure.sh script which seemingly breaks the add-lib feature. (the user who reported this also uses a HTTP proxy) Which specific things does the add-lib implementation expect?

Alex Miller (Clojure team) 2024-05-02T11:37:28.870059Z

It expects to shell out to clojure and use stdin and stdout

Alex Miller (Clojure team) 2024-05-02T11:39:02.321499Z

The stdin part is different than other uses of clojure which mostly pass args instead

Alex Miller (Clojure team) 2024-05-02T11:39:44.076409Z

What does clojure.sh do?

https://github.com/clojure-emacs/enrich-classpath/blob/master/tools.deps/src/cider/enrich_classpath/clojure.sh#L40 it is for wrapping the clojure command to add more things to the classpath with some bash black magic

Alex Miller (Clojure team) 2024-05-02T12:35:50.691289Z

Well that would certainly not work with the add-libs calls

> Do you get an exception? Not directly https://github.com/clojure-emacs/cider/issues/3651 We get a ArtifactDescriptorException Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-core:jar:2.17.0

Well that would certainly not work with the add-libs calls
What part not? clojure.sh ends up calling clojure (the official one) as usual with a speficic classpath pre-computed, that's all. Nothing should prevent the produced JVM process from calling clojure , hence my question

Alex Miller (Clojure team) 2024-05-02T13:07:11.079679Z

I guess it’s not obvious to me that stdin will be piped through that? The error above seems totally unrelated though

Alex Miller (Clojure team) 2024-05-02T13:08:39.609139Z

Proxy seems more likely relevant, but not sure

From the issue report it seemed fairly likely. How is proxy info conveyed?

Alex Miller (Clojure team) 2024-05-02T13:46:45.345989Z

https://clojure.org/reference/clojure_cli#procurer_maven has a section on proxies but I’m not sure why this wrapper would affect things

Yeah definitely we don't go that deep. I'll try to repro the issue locally first and then get back to this. Thanks for the assistance!

@alexmiller is there a easy way of debugging the .basis file writing? Looking at this issue I see the .cpcache/xxx.basis file is being written with nil when clojure is run with this clojure.sh wrapper script. But I'm finding it hard to debug since the clojure command is loading the AOT compiled version of tools.deps inside clojure-tools-1.11.3.1463.jar

Alex Miller (Clojure team) 2024-05-02T17:42:41.792559Z

You can hack the Clojure classpath inside your clojure script file to prefix a local checkout of tools.deps if that helps

by building a tools.dep jar and prefixing it in the -cp ?

Alex Miller (Clojure team) 2024-05-02T17:44:26.586359Z

Don’t need a jar, just checkout and put tools.deps/src/main/clojure on the classpath

oh yeah, make sense

Alex Miller (Clojure team) 2024-05-02T17:44:50.331449Z

Then you can modify that source or even debug it remotely

Alex Miller (Clojure team) 2024-05-02T17:45:35.985299Z

Writing nil is pretty weird though

Alex Miller (Clojure team) 2024-05-02T17:47:35.142059Z

If you capture the args to make-classpath2, that’s the entry point from the bash, would be good to know which side of that is the problem

yeah, I was trying to do that

quite a few differences

Alex Miller (Clojure team) 2024-05-02T18:23:20.329569Z

yeah, if using -Scp, you're basically turning off the whole "calculate deps and basis" system