Fork me on GitHub
#tools-deps
<
2022-04-29
>
Ben Sless07:04:09

Can several projects in the same repository, each in their own directory, be requited as git deps?

pavlosmelissinos07:04:05

You could use :local/root but that will always use the current version of the project in the local filesystem (this is what #polylith uses/suggests). If you want to pin a project to a specific :git/sha/`:git/tag` I'm pretty sure you can use it as usual and combine it with the :deps/root attribute (haven't tried it myself but I don't see why it wouldn't work) Reference: https://clojure.org/reference/deps_and_cli#_dependencies

Adam Helins07:04:13

How does it play out when two projects within the same repo are requested at the same time?

pavlosmelissinos08:04:55

Well you have to use a different name for each dependency (so you can't use the reverse domain notation) but other than that there shouldn't be any issues, at least in the case of :local/root. I'm not sure though how well that would work in the case of :deps/root, sorry.

Ben Sless09:04:51

So using deps/root will clone the entire repository but recognize the correct deps.edn?

pavlosmelissinos10:04:50

I'm not sure if it clones the entire repository (or if it uses something like git's partial clone) but it seems there's https://github.com/clojure/tools.deps.alpha/blob/c815c440e0521647a590a700cf08d6eb9ad8c1f8/src/main/clojure/clojure/tools/deps/alpha/extensions/deps.clj#L32-L35 regardless

borkdude12:04:47

Yes, :deps/root is the thing you can use for that

🙏 1
borkdude12:04:24

e.g. here we have multiple projects within one repo: https://github.com/babashka/nbb-features/tree/main/features

Alex Miller (Clojure team)13:04:04

a git dep with :deps/root will clone the entire repo and then point into a sub path for the dep

🙏 2
Alex Miller (Clojure team)13:04:33

if you have multiple, they share the same cloned dir (for a given sha)

Alex Miller (Clojure team)13:04:27

I guess more precisely, they share the same git object dir (for all shas) and the same working tree (for a given sha)

Ben Sless14:04:52

Cool, just what I needed. I think that covers everything I need to make a multi module project + build

Ben Sless14:04:50

When using this scheme, if one sub project depends on another can it always refer to it by local root?

Alex Miller (Clojure team)14:04:29

yes BUT local deps lose the "git source" tracking and can't be version compared in that way

Alex Miller (Clojure team)14:04:02

we have an open issue about this and it's definitely something to be further explored

Alex Miller (Clojure team)14:04:30

Maybe that mostly affects external users of the monorepo (which isn't a thing for you)

Ben Sless15:04:04

but can they still pin a specific version by requiring it as a top level?

Ben Sless18:04:34

Question regarding collisions, let's say I have a git repo acme/foo, with sub modules bar and bazz, how can I require them both? How meaningful is the key when I specify a git url?

{com.acme/foo.bar {:git/tag "" :git/sha "" 
                   :git/url ""
                   :deps/root "./module-bar"}}

Alex Miller (Clojure team)20:04:11

They're keys in a map - they have to be unique

Ben Sless02:05:06

What I mean is, if I specify a git repo, does the key matter in any way besides the requirement it be unique?

dharrigan18:04:20

Is 1.11.1.1113 an official release (or pre-release?)

dharrigan18:04:57

Ah, yes it is.

Alex Miller (Clojure team)18:04:36

Official - I accidentally called it a pre release on the announcement originally

👍 1