clone-from-here
├── example
└── clojure-polylith-realworld-example-app
When we talk about poly
dependencies, we refer to dependencies between bricks (components and bases).
For 3rd-party library dependencies, see Libraries.
We’ll switch from our example
tutorial to the RealWorld example app to explore dependencies.
If you’ve been following our ongoing example
tutorial, first take a moment to ensure you aren’t currently in the example
workspace directory.
Change directory, e.g., to the parent folder of your example workspace:
clone-from-here
├── example
└── clojure-polylith-realworld-example-app
Then run:
git clone https://github.com/furkan3ayraktar/clojure-polylith-realworld-example-app.git
cd clojure-polylith-realworld-example-app
Have a look at the Realworld example app workspace:
poly info
Look at all those lovely bricks we have to play with!
List all poly
dependencies by running the deps command:
poly deps
This is a summary of all brick dependencies in the workspace. Interfaces are shown in yellow, components in green, and bases in blue.
Notice the headers across the top are yellow (interfaces).
Each x
is a src
dependency, t
is a test
only dependency (code that lives in any of the directories specified in :aliases > :test > :extra-paths
).
Reading the article
component row, left to right, we see it uses database
, profile
, and spec
interfaces (and the user
interface, but only for testing).
Reading the article
interface column, top to bottom, we see it is used by the comment
component and rest-api
base.
Our example here does not show it, but bases can also depend on other bases. |
You can ask poly to hone in on the dependencies for a single brick.
Ask poly
to report on the article
brick:
poly deps brick:article
We’ve looked at brick ⇔ interface dependencies. To examine brick ⇔ brick dependencies, you need to specify a project:
poly deps project:rb
The header across the top is now green (components) instead of yellow (interfaces).
This component reporting is possible because poly
is aware of all the implementing components within the selected project.
This report has extra symbols.
The +
sign indicates an indirect dependency, and the -
sign indicates indirect test dependencies (not present in our example output).
An example is the article
component using the log
component indirectly: article
uses database
, and database
uses log
.
If you have many brick dependencies, you might prefer the compact format:
poly deps project:rb :compact
We can also show brick ⇔ brick dependencies for a specific brick within a project:
poly deps project:rb brick:article
For large workspaces, it can sometimes make reading the diagram easier if you swap the axes:
poly deps :swap-axes
The poly
tool restricts what can access what:
Entity | From the :src context | From the :test context | Caution |
---|---|---|---|
Can only access:
| Can access any namespace. | If component | |
Can access any namespace. | |||
Can access any namespace. | Can access any namespace. | While tests are fine, we recommend against including |
The poly
tool reports on circular brick dependencies.
If you have a dependency chain like A > B > A, or A > B > C > A, then poly
will show Error 104 - Circular dependencies
.
To read more about this and other errors, see the check command.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close