Fork me on GitHub
#tools-deps
<
2021-07-22
>
borkdude09:07:19

I have looked into making bb compatible with some of the namespaces of tools.build, most of them work, except those which depend on tools.deps.alpha (since it contains many dependencies that can't run from source with bb, like the mvn and s3 stuff). What I noticed is that some namespaces use tools.deps.alpha but only one function from it: join-classpath which is a pretty basic function which doesn't need any mvn/s3 stuff.

$ rg "deps/"
clojure/clojure/tools/build/tasks/compile_clj.clj
50:                   deps/join-classpath)

clojure/clojure/tools/build/tasks/create_basis.clj
17:  "Wrapper for deps/create-basis, but ensure relative paths are resolved
30:     (deps/create-basis params))))

clojure/clojure/tools/build/tasks/process.clj
93:                 deps/join-classpath)]
(https://github.com/clojure/tools.deps.alpha/blob/dec88af58b9e6f6e2f1949c94fbd1d93eecc5959/src/main/clojure/clojure/tools/deps/alpha.clj#L611) In fact, it seems only the create-basis namespace really needs tools.deps.alpha and the rest could just use join-classpath function that could be "inlined" into tools.build itself. This might also benefit load time if you're not going through create-basis in a build step (perhaps you already have the basis in a file somewhere for example), avoiding to load tools.deps.alpha in that case. Just wanted to drop this thought here in case it makes sense for other use cases as well. Another approach is to "podify" the entire tools.build library which should be possible now that there is a native version of tools.deps.alpha possible (https://github.com/babashka/babashka/issues/951).

seancorfield16:07:10

@borkdude create-basis itself is two useful parts: the find/read/merge EDN file part (I've had variants of that to access alias data in several projects), and the dependency resolution (download/clone/etc). Only the second part needs t.d.a So it would be nice to have a small lib with just the first part -- that many tools could use, if they don't need the whole dep/res stuff.

seancorfield16:07:20

(I'd also like to see the EDN arg parsing and require/resolve portion of clojure.run.exec as a separate lib too -- but that's a separate discussion 🙂 )

Jakub Holý (HolyJak)16:07:38

Is there a way to force a particular minimal version of clojure CLI? I have few times run into problems where my projects failed on other people's computers because they had a too old version of the CLI 🙏 So something like :clijure-cli/min-version 1.10.3.855 in deps.edn that would trigger a warning when run with an older version of the CLI would help.

seancorfield16:07:51

I run into that a lot too -- and have shot myself in the foot a couple of times by using a new CLI/t.d.a feature in a script and then having it fail on a server that hasn't been updated. I think it's important to recognize that we now have three "cogs" in that machine that tooling might be version-sensitive about: the CLI itself, the version of t.d.a being used, and the version of Clojure itself. Right now, the latter is controllable by specifying a minimum org.clojure/clojure version in your project but the other two are not (and I've been bitten by both but mostly by the CLI version).

😿 2
seancorfield16:07:28

Now, the problem is that the CLI itself isn't checking deps.edn and if the cache files are not stale will not even run the step to build the basis etc (which is what reads/analyzes deps.edn).

jjttjj20:07:39

Hi are there any known issues with using :git/url deps for private repos on Windows? I just get

Cloning: [email protected]:My/project.git
printed and then it hangs forever. I can clone the project from the command line successfully just using git clone wait I think I might see what the issue is now

jjttjj21:07:22

For what it's worth I had to change GIT_SSH env var to "C:\Windows\System32\OpenSSH\ssh.exe" (it was plink before). This didn't immediately fix things but after bashing on the keyboard a bunch (not ultimately changing anything else, as far as I'm aware), things just randomly started working

borkdude20:07:05

@jjttjj you can try to debug using GITLIBS_DEBUG set to true

jjttjj21:07:34

Thank! That's definitely useful