This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-01
Channels
- # aleph (6)
- # announcements (37)
- # aws (1)
- # beginners (67)
- # calva (9)
- # clerk (5)
- # clj-kondo (3)
- # clojure (19)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (36)
- # clojure-uk (5)
- # clojuredesign-podcast (7)
- # clojurescript (28)
- # datomic (9)
- # emacs (8)
- # figwheel-main (4)
- # fulcro (6)
- # hyperfiddle (19)
- # integrant (4)
- # java (9)
- # lsp (131)
- # malli (9)
- # missionary (85)
- # off-topic (13)
- # pathom (3)
- # polylith (11)
- # releases (1)
- # sci (4)
- # shadow-cljs (7)
- # specter (2)
- # vscode (1)
- # xtdb (2)
Polylith documentation and examples suggest using poly/<brick-name>
in deps.edn files to refer to bricks. I think this is an anti-pattern - if a project in your workspace ends up (even transitively) git-dependent on a 3rd party lib which itself is developed and distributed as a polylith project then the bricks used by that 3rd party lib might collide with your own. Say you have a poly/string-utils
brick and the 3rd party lib also has a poly/string-utils
inside. Either tools.deps is going to complain or you'll likely start getting namespace/function/etc not found errors.
I've always assumed poly
was only used because that was a name they chose; my project uses its own prefix like patrix/<brick>
but it's used in some reference implementations like https://github.com/furkan3ayraktar/clojure-polylith-realworld-example-app/blob/master/projects/realworld-backend/deps.edn
> I'm not sure now but I recall this pattern used to be recommended some time ago Yes, we suggest this naming pattern in the documentation. I understand now that this could cause problems. Maybe we should suggest that people prefix their bricks with e.g. the workspace name (or similar)? Or at least mention this risk.
AFAIK all these names are treated the same way as groupid/artifactid
by tools.deps on a global level so one should try and keep them unique especially if one publishes artifacts for consumption from the workspace or plans to depend on artifacts published from a polylith repo.
workspace name could be an option if it's unique enough - that's what I used with polylith-kaocha
However, if you really want to be on the safe side, then perhaps your-group-id.workspace-name/brick-name
I followed the Kaocha runner's example in my runner (so far the only library I've published, built with Polylith):
polylith-external-test-runner.bases/external-test-runner-cli {:local/root "../../bases/external-test-runner-cli"}
polylith-external-test-runner.components/external-test-runner {:local/root "../../components/external-test-runner"}
polylith-external-test-runner.components/util {:local/root "../../components/util"}}
It probably would be good for the documentation to mention that "lib names" (which is what I believe tools.deps
et al calls them) should be globally unique for projects that are intended to be used as libraries (it doesn't matter for applications).
As long as you aren't (unless by intention) shadow the lib-name of a dep of that application
I have changed the lib name prefix to https://github.com/polyfy/polylith/blob/master/projects/poly/deps.edn in the latest https://cljdoc.org/d/polylith/clj-poly/0.2.19-SNAPSHOT/doc/readme release.