Fork me on GitHub
#tools-deps
<
2024-02-06
>
borkdude10:02:31

I ran into some issues with a newer version of tools.deps when you provide a :project "deps.edn" in a directory where that deps.edn doesn't exist. The macro in-project-dir calls .getParentFile which returns nil when the file doesn't exist on disk which then results into NPEs later on. https://github.com/clojure/tools.deps/blob/e0217fde8455ebdaa1f2231aef21f94264a1c40b/src/main/clojure/clojure/tools/deps.clj#L790 E.g.:

user=> (d/create-basis {:project "x.edn"})
Execution error (NullPointerException) at clojure.tools.deps.util.dir/canonicalize (dir.clj:30).
Cannot invoke "java.io.File.isAbsolute()" because "f" is null
Doing something like (jio/file (or (.getParentFile (jio/file ~project-deps)) ".")) will fix this, but I'll leave it up to you of course Moreover, note that when upgrading tools.build to the latest release of tools.deps, the test suite fails with:
ERROR in (test-install-no-pom) (dir.clj:30)
Uncaught exception, not in assertion.
expected: nil
  actual: java.lang.NullPointerException: Cannot invoke "java.io.File.isAbsolute()" because "f" is null
Another issue I ran into was that .equals called in that macro results into a reflection issue with graalvm (which I can fix downstream but could be nice to fix upstream, maybe by replacing .equals simply with =?

👍 1
Alex Miller (Clojure team)13:02:22

Thx, will take a look when I get a chance

borkdude10:02:49

I can log an ask issue if that would be of any help

Alex Miller (Clojure team)13:02:09

I logged jiras for it already

👍 1