tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
2021-03-16T00:00:53.307100Z

Has there been any consideration to adding a key to a dependency map which has :deps/manifest be of type :deps to permit including a vector of aliases to include? For example, I have a project intended to be used as a library which needs to include different natives jars depending on the OS, but without asking my dependents to include those native jars themselves I can't provide a good way to use only one set of them. I think it would be useful to be able to specify something like so:

{:git/url "some-git"
 :sha "abc123"
 :deps/manifest :deps
 :deps/aliases [:windows-natives]}
and have this bring in all the appropriate deps, based on the keys which modify paths or dependencies.

alexmiller 2021-03-16T00:03:42.307700Z

it has been suggested, yes

alexmiller 2021-03-16T00:04:06.308100Z

at some point I will think more about it :)

2021-03-16T00:04:39.308800Z

Sounds good! I was mostly curious since this seems to be something that would require running a modified version of tools.deps, it couldn't really be done with additional tooling.

vlaaad 2021-03-16T08:22:09.000300Z

FYI: the issue is https://clojure.atlassian.net/browse/TDEPS-116

vlaaad 2021-03-16T10:22:21.001300Z

Btw I think there might be another solution to this problem — specifying path in the git coordinate to the folder in the repo of where the actual dependency is located

vlaaad 2021-03-16T10:23:39.002500Z

That way there is no need to figure out what aliases are public and what aliases are internal and may change

mkvlr 2021-03-16T10:38:53.005300Z

I really like the ability to set the `:deps/manifest` to :deps to consume a standard clojure lib from git without needing a `deps.edn` upstream as long as the source files are in `src/` . Is is even possible set options this way? If not and I’d like to see it should I put it on http://ask.clojure.org?

alexmiller 2021-03-16T12:26:30.005900Z

I don’t understand what you’re looking for - what options?

alexmiller 2021-03-16T12:27:51.007Z

You can do that now with :deps/root but I’m not sure how that does what you’re asking about

borkdude 2021-03-16T12:31:05.009600Z

My guess, mkvlr means: an option to set :deps/manifest :edn as the default if no pom.xml or deps.edn is found

souenzzo 2021-03-16T12:32:16.011300Z

Not sure how it scale, but you can control "profiles" with deps/root:

deps.edn
windows-extras/deps.edn
linux-extras/deps.edn
Where windows-extras/deps.edn
{:deps {lib/window-dll {...}}}
Then the consumer:
:deps {app/core {:git ...}
       app/core+windows-extras {:git ... :git/root "windows-extras"}}

vlaaad 2021-03-16T12:40:42.014600Z

oh, forgot about :deps/root

mkvlr 2021-03-16T12:40:50.014900Z

@alexmiller @borkdude say setting another :paths or :deps in case the project requires it. I normally fork the project and make a fix and then I have another branch where I add a deps.edn because I only want to open a PR with the fix (and consume it locally) but not add the deps.edn upstream. A workaround for setting :deps is to add them to my root, but then it’s not clear what to remove later. Does that make sense?

borkdude 2021-03-16T12:41:26.015300Z

@mkvlr you don't have to fork, you can add :deps/manifest :deps in your deps.edn for that lib

mkvlr 2021-03-16T12:42:08.015800Z

@borkdude and can I provide a different :paths and :deps for that lib in that case? Within the same map?

borkdude 2021-03-16T12:42:52.016600Z

ah, so when the dep doesn't use the standard src and has other deps? hmm, right

mkvlr 2021-03-16T12:43:09.017Z

yes, the first part I learned https://clojurians.slack.com/archives/C6QH853H8/p1615891133005300 and like it a lot

mkvlr 2021-03-16T12:43:32.017800Z

but might be useful to extend it?

mkvlr 2021-03-16T12:44:30.019Z

well I’d find it useful anyway 😼

borkdude 2021-03-16T12:44:32.019200Z

:deps/manifest {:type :deps :paths ["src2"]}, something like that?

mkvlr 2021-03-16T12:45:43.019800Z

yeah

mkvlr 2021-03-16T12:48:36.020700Z

:deps/manifest {:paths ["src2"]} not sure if :type could even be omitted or if overloading :deps/manifest is right. It currently stands for a manifest type.

borkdude 2021-03-16T12:53:15.021200Z

:deps/manifest currently indicates either :pom or :deps

mkvlr 2021-03-16T12:54:49.022Z

yes, which is the type of project (from the docs: Default is to auto-detect the project type (currently either `:deps` or `:pom`))

alexmiller 2021-03-16T12:58:18.023200Z

I don't think it makes sense for an external consumer of a project to determine the paths to use in the project, seems like the project creator should be the one defining that

alexmiller 2021-03-16T12:59:25.024600Z

but it does make sense to me for a project creator to potentially provide standard ways to modify the classpath (presumably via aliases)

mkvlr 2021-03-16T13:00:13.025300Z

my use case is having this be a temporary measure for a lib to which I’m contributing a fix. Temporary until its merged upstream.

mkvlr 2021-03-16T13:01:36.026Z

in some way :deps/manifest :deps is also an external consumer of a project defining an (empty) deps.edn

alexmiller 2021-03-16T13:01:54.026400Z

there are already features in deps.edn for that - namely :classpath-overrides

alexmiller 2021-03-16T13:02:37.026700Z

or :override-deps, depending what you're doing

mkvlr 2021-03-16T13:08:07.029300Z

yes, I can add the deps of the lib somewhere else (to the root or an alias or whatever) but the intention is less clear. At that point I’d rather fork the repo and add a deps.edn.

alexmiller 2021-03-16T16:15:07.029700Z

Clojure CLI https://clojure.org/releases/tools#v1.10.3.814 is now available! • git deps: switch from using jgit to shelling out to git (must be git >= 2.5) - big thanks to @ghadi for all the initial work on this! ◦ New env vars for control: ▪︎ GITLIBS_COMMAND - command to invoke when shelling out to git, default = git ▪︎ GITLIBS_DEBUG - set to true to print git commands and output to stderr, default = false • Made git fetch only when shas can’t be resolved to improve performance • Bump dep versions for tools.cli and aws api to latest (in particular, moves transitive jetty deps to latest, past a CVE) • Use https://github.com/clojure/tools.deps.alpha/blob/master/CHANGELOG.md 0.11.905 In general, this should resolve a large set of differences between using git deps through clj vs git at the command line, since they are now the same. Some additional benefits include a smaller deps footprint, and better performance.

🎉 13
borkdude 2021-03-16T16:24:07.030100Z

Awesome!

2021-03-16T20:39:30.033500Z

Is there a way in to override the location of ~/.m2/settings.xml? I am trying to work around a limitation of our CI build system. This issue seems to be related https://clojure.atlassian.net/browse/TDEPS-99.

alexmiller 2021-03-16T20:45:56.033800Z

No, not currently

2021-03-16T20:47:29.034Z

Ok. Thanks.

alexmiller 2021-03-16T20:50:29.034300Z

if you want to vote for this, please do so here: https://ask.clojure.org/index.php/7865/allow-specify-maven-settings-provide-credentials-directly

👍 2