tools-deps

vemv 2023-08-19T04:15:37.529509Z

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) 2023-08-19T04:21:14.774019Z

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

Alex Miller (Clojure team) 2023-08-19T04:21:31.337659Z

It will use that as if it was the cwd

vemv 2023-08-19T04:22:43.182059Z

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

Alex Miller (Clojure team) 2023-08-19T04:22:58.260479Z

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

👍 1
vemv 2023-08-19T04:43:12.905129Z

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

Alex Miller (Clojure team) 2023-08-19T04:58:07.055649Z

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

vemv 2023-08-19T05:17:31.696289Z

(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

Alex Miller (Clojure team) 2023-08-19T05:30:24.444119Z

Not currently

👍 1