Dependency graphs #1554
Replies: 11 comments 17 replies
-
Mermaid vs Graphviz (dot)
Example without any customizationMermaid
graph LR
subgraph :core
:core:analytics[analytics]
:core:common[common]
:core:data[data]
:core:database[database]
:core:datastore[datastore]
:core:datastore-proto[datastore-proto]
:core:designsystem[designsystem]
:core:model[model]
:core:network[network]
:core:notifications[notifications]
:core:ui[ui]
end
subgraph :feature
:feature:topic[topic]
end
:core:data ---> :core:analytics
:core:data ---> :core:common
:core:data ---> :core:database
:core:data ---> :core:datastore
:core:data ---> :core:network
:core:data ---> :core:notifications
:core:database ---> :core:model
:core:datastore ---> :core:common
:core:datastore ---> :core:datastore-proto
:core:datastore ---> :core:model
:core:network ---> :core:common
:core:network ---> :core:model
:core:notifications ---> :core:common
:core:notifications ---> :core:model
:core:ui ---> :core:analytics
:core:ui ---> :core:designsystem
:core:ui ---> :core:model
:feature:topic ---> :core:data
:feature:topic ---> :core:designsystem
:feature:topic ---> :core:ui
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Grouping by "scope" (parent module)I think it looks great, and helps with the overall legibillity. Mermaid
graph LR
subgraph :core
:core:analytics[analytics]
:core:common[common]
:core:data[data]
:core:database[database]
:core:datastore[datastore]
:core:datastore-proto[datastore-proto]
:core:designsystem[designsystem]
:core:model[model]
:core:network[network]
:core:notifications[notifications]
:core:ui[ui]
end
subgraph :feature
:feature:topic[topic]
end
:core:data -.-> :core:analytics
:core:data ---> :core:common
:core:data ---> :core:database
:core:data ---> :core:datastore
:core:data ---> :core:network
:core:data -.-> :core:notifications
:core:database ---> :core:model
:core:datastore -.-> :core:common
:core:datastore ---> :core:datastore-proto
:core:datastore ---> :core:model
:core:network ---> :core:common
:core:network ---> :core:model
:core:notifications -.-> :core:common
:core:notifications ---> :core:model
:core:ui ---> :core:analytics
:core:ui ---> :core:designsystem
:core:ui ---> :core:model
:feature:topic -.-> :core:data
:feature:topic -.-> :core:designsystem
:feature:topic -.-> :core:ui
|
Beta Was this translation helpful? Give feedback.
-
Module typesI feel like rendering pure (lightweight) Kotlin JVM projects differently from Android (heavy) projects is a good addition.
Mermaid
graph LR
subgraph :core
:core:analytics[analytics]:::android
:core:common[common]:::jvm
:core:data[data]:::android
:core:database[database]:::android
:core:datastore[datastore]:::android
:core:datastore-proto[datastore-proto]:::android
:core:designsystem[designsystem]:::android
:core:model[model]:::jvm
:core:network[network]:::android
:core:notifications[notifications]:::android
:core:ui[ui]:::android
end
subgraph :feature
:feature:topic[topic]:::android
end
:core:data -.-> :core:analytics
:core:data ---> :core:common
:core:data ---> :core:database
:core:data ---> :core:datastore
:core:data ---> :core:network
:core:data -.-> :core:notifications
:core:database ---> :core:model
:core:datastore -.-> :core:common
:core:datastore ---> :core:datastore-proto
:core:datastore ---> :core:model
:core:network ---> :core:common
:core:network ---> :core:model
:core:notifications -.-> :core:common
:core:notifications ---> :core:model
:core:ui ---> :core:analytics
:core:ui ---> :core:designsystem
:core:ui ---> :core:model
:feature:topic -.-> :core:data
:feature:topic -.-> :core:designsystem
:feature:topic -.-> :core:ui
classDef android fill:#3ddc84,stroke:#fff,stroke-width:2px,color:#fff;
classDef jvm fill:#7F52FF,stroke:#fff,stroke-width:2px,color:#fff;
|
Beta Was this translation helpful? Give feedback.
-
Focus the "target" moduleNot sure if this will be really helpful since it will always be the left-most node. Mermaid
graph LR
subgraph :core
:core:analytics[analytics]:::android
:core:common[common]:::jvm
:core:data[data]:::android
:core:database[database]:::android
:core:datastore[datastore]:::android
:core:datastore-proto[datastore-proto]:::android
:core:designsystem[designsystem]:::android
:core:model[model]:::jvm
:core:network[network]:::android
:core:notifications[notifications]:::android
:core:ui[ui]:::android
end
subgraph :feature
:feature:topic[topic]:::android-focus
end
:core:data -.-> :core:analytics
:core:data ---> :core:common
:core:data ---> :core:database
:core:data ---> :core:datastore
:core:data ---> :core:network
:core:data -.-> :core:notifications
:core:database ---> :core:model
:core:datastore -.-> :core:common
:core:datastore ---> :core:datastore-proto
:core:datastore ---> :core:model
:core:network ---> :core:common
:core:network ---> :core:model
:core:notifications -.-> :core:common
:core:notifications ---> :core:model
:core:ui ---> :core:analytics
:core:ui ---> :core:designsystem
:core:ui ---> :core:model
:feature:topic -.-> :core:data
:feature:topic -.-> :core:designsystem
:feature:topic -.-> :core:ui
classDef android-focus fill:#3ddc84,stroke:#000,stroke-width:4px,color:#fff;
classDef android fill:#3ddc84,stroke:#fff,stroke-width:2px,color:#fff;
classDef jvm fill:#7F52FF,stroke:#fff,stroke-width:2px,color:#fff;
|
Beta Was this translation helpful? Give feedback.
-
Critical pathI don't think adding the critical paths (they often are many ) is really valuable here, and makes the graphs more complex than they need to. For example, here the critical height is 3, which makes almost everything painted red. Mermaid
graph LR
subgraph :core
:core:analytics[analytics]:::android
:core:common[common]:::jvm
:core:data[data]:::android
:core:database[database]:::android
:core:datastore[datastore]:::android
:core:datastore-proto[datastore-proto]:::android
:core:designsystem[designsystem]:::android
:core:model[model]:::jvm
:core:network[network]:::android
:core:notifications[notifications]:::android
:core:ui[ui]:::android
end
subgraph :feature
:feature:topic[topic]:::android
end
:core:data -.-> :core:analytics
:core:data ---> :core:common
:core:data ---> :core:database
:core:data ---> :core:datastore
:core:data ---> :core:network
:core:data -.-> :core:notifications
:core:database ---> :core:model
:core:datastore -.-> :core:common
:core:datastore ---> :core:datastore-proto
:core:datastore ---> :core:model
:core:network ---> :core:common
:core:network ---> :core:model
:core:notifications -.-> :core:common
:core:notifications ---> :core:model
:core:ui ---> :core:analytics
:core:ui ---> :core:designsystem
:core:ui ---> :core:model
:feature:topic -.-> :core:data
:feature:topic -.-> :core:designsystem
:feature:topic -.-> :core:ui
classDef android fill:#3ddc84,stroke:#fff,stroke-width:2px,color:#fff;
classDef jvm fill:#7F52FF,stroke:#fff,stroke-width:2px,color:#fff;
linkStyle 2,3,4,5,6,7,8,9,10,11,12,13,17 stroke:red;
|
Beta Was this translation helpful? Give feedback.
-
Links rendererThere are many alternatives to the default layout rederer, making links sometimes easier to understand for larger graphs.
Fixed in version 11: https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0 see current version
info
Mermaid (elk)
%%{init:{'theme':'dark', 'flowchart': { 'defaultRenderer': 'elk' } }}%%
graph LR
subgraph :core
:core:analytics[analytics]:::android
:core:common[common]:::jvm
:core:data[data]:::android
:core:database[database]:::android
:core:datastore[datastore]:::android
:core:datastore-proto[datastore-proto]:::android
:core:designsystem[designsystem]:::android
:core:model[model]:::jvm
:core:network[network]:::android
:core:notifications[notifications]:::android
:core:ui[ui]:::android
end
subgraph :feature
:feature:topic[topic]:::android
end
:core:data -.-> :core:analytics
:core:data ---> :core:common
:core:data ---> :core:database
:core:data ---> :core:datastore
:core:data ---> :core:network
:core:data -.-> :core:notifications
:core:database ---> :core:model
:core:datastore -.-> :core:common
:core:datastore ---> :core:datastore-proto
:core:datastore ---> :core:model
:core:network ---> :core:common
:core:network ---> :core:model
:core:notifications -.-> :core:common
:core:notifications ---> :core:model
:core:ui ---> :core:analytics
:core:ui ---> :core:designsystem
:core:ui ---> :core:model
:feature:topic -.-> :core:data
:feature:topic -.-> :core:designsystem
:feature:topic -.-> :core:ui
classDef android fill:#3ddc84,stroke:#fff,stroke-width:2px,color:#fff;
classDef jvm fill:#7F52FF,stroke:#fff,stroke-width:2px,color:#fff;
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@SimonMarquis Just to let you know I haven't forgotten about this, just been busy with other things. @yschimke FYI |
Beta Was this translation helpful? Give feedback.
-
If we minimised the information in each module graph, is it easy to navigate between them by click? |
Beta Was this translation helpful? Give feedback.
-
Given https://github.com/android/nowinandroid/blob/main/docs/ModularizationLearningJourney.md, can we highlight any mistakes we should correct. Maybe there aren't any.
But it would be interested to see layering violations if any. |
Beta Was this translation helpful? Give feedback.
-
First of all, let's ackowledge the initial work of @mmoczkowski in #310 for the very nice looking graphs, but it seems like we won't be able to get this tool open-sourced 😢
So, here is an attempt to improve the current state of dependency graphs in this project.
Let's take
:feature:topic
as an example in this discussion as it contains a good amount of dependencies.In this discussion, I'll list some important questions that I think we need to answer before pushing the first PR, as well as potential solutions with examples.
The code to generate these graphs is ~100 loc (and runs in a few milliseconds) and is currently designed as a custom convention plugin in
build-logic
, registering a task that dumps these graphs for each modules. But the implementation can be changed depending on what we need in the end.Beta Was this translation helpful? Give feedback.
All reactions