Fork me on GitHub
#tools-deps
<
2023-08-19
>
vemv04:08:37

How can I create a basis for an absolute path if the JVM's current directory is unrelated? e.g.

user> (tools.deps/create-basis {:project "/Users/vemv/foo/bar/deps.edn"})
Execution error (ExceptionInfo) at clojure.tools.deps.extensions.local/ensure-file (local.clj:41).
Local lib yyy not found: xxx
what's failing is that a dependency is defined like this: foo/bar {:local/root "../../baz"} so it's tripping up due to my unrelated CWD. (names redacted)

Alex Miller (Clojure team)04:08:14

You can wrap in c.t.deps.util.dir/with-dir

Alex Miller (Clojure team)04:08:31

It will use that as if it was the cwd

vemv04:08:43

Thank you! 🙏 You might want to consider an addition to the create-basis docstring

Alex Miller (Clojure team)04:08:58

You shouldn’t need to set the :project then either

👍 2
vemv04:08:12

> You shouldn’t need to set the :project then either I tried this and my tests began failing 🥲

Alex Miller (Clojure team)04:08:07

Well I could be crazy but I would expect it to use deps.edn as the relative path, resolved against the with-dir

vemv05:08:31

(Sorry if FAQ) Given :deps {x/x {:local/root "../../x"}}, can I pull in its aliases too? e.g. it defines :dev, I'd like to use its :dev alias from the dependent project Some extra context: ../../x is not under my control (not without forking) so I can't simply re-architect things