Discussion copied from Slack:
It is fairly common for tooling to be want to read the deps.edn
environment as if it were under a set of aliases, i.e., for a tool to want to see the world as if a specific set of aliases were provided, that are different to the aliases needed to run the tool.
This touches on how -X.. mvn-pom
works, as well as other tools on https://github.com/clojure/tools.deps.alpha/wiki/Tools such as depot
: the environment needed to run the tool is not the same as the environment the tool wants for analysis.
depstar
"works around" this problem by relying on its own runtime environment being the same as what goes into the JAR file but just excluding itself. This is only tenable because it is a very small tool that has zero external dependencies. You can override this and tell depstar
to use a different classpath, but that approach doesn't work for tools that actually want to look at the versions of dependencies, such as mvn-pom
, depot
, etc.
Alex Miller said: "the datomic ion dev tools is another example"
Michiel Borkent said: "I also have a couple of tools that just receive a --classpath
arg. But it depends on the tool. For mvn-pom
that might not be so convenient, and getting a list of aliases to resolve versions with might be better."
Clarification of the "ask" here, and an addition courtesy of Alex: this process must take into account the various deps.edn
files that the CLI already uses -- system, user, project, command-line -- and must respect the equivalent of -Srepro
so that the user deps.edn
can be elided if desired. In addition, if t.d.a is enhanced to support multiple "project" deps.edn
files, per https://ask.clojure.org/index.php/9849/teams-common-dependencies-tooling-across-multiple-projects, then this process should also support that.
What tools need is something in t.d.a that they can call with:
- A list of aliases
- An option equivalent to
-Srepro
- The implicit list of
deps.edn
files that match how the CLI would read them (this is intended to be weasel-wording to allow for the "extra deps.edn
file" posited in that other "ask" to be specified here somehow
The idea here is that tooling wants to mimic how the Clojure CLI processes deps.edn
files and aliases and certain other options but the current API exposed by t.d.a is too low-level to make this easy and we don't want every tool based on t.d.a to have to duplicate all that multi-file merging and alias selection.