Welcome! Please see the About page for a little more info on how this works.

0 votes
in tools.deps by

If not, could it (or something like it) be? This would be useful for allowing projects which embed tools.deps, like Cursive, to get classpath info from a project without having to muck around creating a bunch of files.

If -main is going to be the only officially-sanctioned public API to this functionality, it would be good to abstract calls to System/exit in such a way that embedding tools can catch process exits without being killed. deps.clj has an example of one way to do this here: https://github.com/borkdude/deps.clj/blob/master/deps.clj#L34-L39.

1 Answer

0 votes

No, this class is not public API, and has regularly changed in breaking ways (and is about to do so again). I'm planning to move it out of tools.deps entirely and into the installer project as it's a facet of the CLI, not part of tools.deps.

Really, you should be going through clojure.tools.deps/create-basis for most functionality. I'm aware that there are some gaps between what's in make-classpath2/run-core and create-basis and I will shortly close that distance by enhancing some of the data returned in create-basis (in particular adding the basis config and merged argmap to provide access to jvm / main / exec info).

After that, the major differences between these will be: 1) supporting deprecated CLI stuff (some of which is going away now, some later) and 2) -T support, which really should be more directly supported in the deps api, but that's going to wait for a bit longer. Ultimately, make-classpath2 will use create-basis - that's where this is going.

Is there an example anywhere of calling create-basis in a way that supports tools? Looking at the code, I can't just inline `run-core` at the moment, because that doesn't call `create-basis` yet, and figuring out the intricacies of the `run-core` code compared to `create-basis` is hard.

It's hard to know how to support this in a way that won't just break in the near future.
I don't know if this is the best bandwidth way to have this conversation, if it would help to have a convo, you know where to find me, and I'm happy to make out of that a public writeup. This is not secret knowledge but it is context dependent and I'm not totally sure what the set of things is you need to do.

Also, I have some changes in work right now that affect the answers a bit, particularly around the exec argmap attributes.