diff --git a/app/README.md b/app/README.md
index 186f7442f..cbcdc35be 100644
--- a/app/README.md
+++ b/app/README.md
@@ -11,6 +11,42 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
+ subgraph :feature
+ direction TB
+ subgraph :feature:settings
+ direction TB
+ :feature:settings:impl[impl]:::android-library
+ end
+ subgraph :feature:foryou
+ direction TB
+ :feature:foryou:api[api]:::android-library
+ :feature:foryou:impl[impl]:::android-library
+ end
+ subgraph :feature:bookmarks
+ direction TB
+ :feature:bookmarks:api[api]:::android-library
+ :feature:bookmarks:impl[impl]:::android-library
+ end
+ subgraph :feature:search
+ direction TB
+ :feature:search:api[api]:::android-library
+ :feature:search:impl[impl]:::android-library
+ end
+ subgraph :feature:interests
+ direction TB
+ :feature:interests:api[api]:::android-library
+ :feature:interests:impl[impl]:::android-library
+ end
+ subgraph :feature:topic
+ direction TB
+ :feature:topic:api[api]:::android-library
+ :feature:topic:impl[impl]:::android-library
+ end
+ end
+ subgraph :sync
+ direction TB
+ :sync:work[work]:::android-library
+ end
subgraph :core
direction TB
:core:analytics[analytics]:::android-library
@@ -27,39 +63,6 @@ graph TB
:core:notifications[notifications]:::android-library
:core:ui[ui]:::android-library
end
- subgraph :feature:interests
- direction TB
- :feature:interests:api[api]:::android-library
- :feature:interests:impl[impl]:::android-library
- end
- subgraph :feature:foryou
- direction TB
- :feature:foryou:api[api]:::android-library
- :feature:foryou:impl[impl]:::android-library
- end
- subgraph :feature:bookmarks
- direction TB
- :feature:bookmarks:api[api]:::android-library
- :feature:bookmarks:impl[impl]:::android-library
- end
- subgraph :feature:topic
- direction TB
- :feature:topic:api[api]:::android-library
- :feature:topic:impl[impl]:::android-library
- end
- subgraph :feature:search
- direction TB
- :feature:search:api[api]:::android-library
- :feature:search:impl[impl]:::android-library
- end
- subgraph :feature:settings
- direction TB
- :feature:settings:impl[impl]:::android-library
- end
- subgraph :sync
- direction TB
- :sync:work[work]:::android-library
- end
:benchmarks[benchmarks]:::android-test
:app[app]:::android-application
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 6ccf01e15..c2bbf2a2a 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -11,6 +11,42 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
+ subgraph :feature
+ direction TB
+ subgraph :feature:settings
+ direction TB
+ :feature:settings:impl[impl]:::android-library
+ end
+ subgraph :feature:foryou
+ direction TB
+ :feature:foryou:api[api]:::android-library
+ :feature:foryou:impl[impl]:::android-library
+ end
+ subgraph :feature:bookmarks
+ direction TB
+ :feature:bookmarks:api[api]:::android-library
+ :feature:bookmarks:impl[impl]:::android-library
+ end
+ subgraph :feature:search
+ direction TB
+ :feature:search:api[api]:::android-library
+ :feature:search:impl[impl]:::android-library
+ end
+ subgraph :feature:interests
+ direction TB
+ :feature:interests:api[api]:::android-library
+ :feature:interests:impl[impl]:::android-library
+ end
+ subgraph :feature:topic
+ direction TB
+ :feature:topic:api[api]:::android-library
+ :feature:topic:impl[impl]:::android-library
+ end
+ end
+ subgraph :sync
+ direction TB
+ :sync:work[work]:::android-library
+ end
subgraph :core
direction TB
:core:analytics[analytics]:::android-library
@@ -27,39 +63,6 @@ graph TB
:core:notifications[notifications]:::android-library
:core:ui[ui]:::android-library
end
- subgraph :feature:interests
- direction TB
- :feature:interests:api[api]:::android-library
- :feature:interests:impl[impl]:::android-library
- end
- subgraph :feature:foryou
- direction TB
- :feature:foryou:api[api]:::android-library
- :feature:foryou:impl[impl]:::android-library
- end
- subgraph :feature:bookmarks
- direction TB
- :feature:bookmarks:api[api]:::android-library
- :feature:bookmarks:impl[impl]:::android-library
- end
- subgraph :feature:topic
- direction TB
- :feature:topic:api[api]:::android-library
- :feature:topic:impl[impl]:::android-library
- end
- subgraph :feature:search
- direction TB
- :feature:search:api[api]:::android-library
- :feature:search:impl[impl]:::android-library
- end
- subgraph :feature:settings
- direction TB
- :feature:settings:impl[impl]:::android-library
- end
- subgraph :sync
- direction TB
- :sync:work[work]:::android-library
- end
:benchmarks[benchmarks]:::android-test
:app[app]:::android-application
diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Graph.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Graph.kt
index 439a50181..80448e2b2 100644
--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Graph.kt
+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Graph.kt
@@ -187,20 +187,46 @@ private abstract class GraphDumpTask : DefaultTask() {
)
// Graph declaration
appendLine("graph TB")
- // Nodes and subgraphs (limited to a single nested layer)
+ // Nodes and subgraphs
val (rootProjects, nestedProjects) = dependencies
.map { listOf(it.project, it.dependency) }.flatten().toSet()
.plus(projectPath.get()) // Special case when this specific module has no other dependency
.groupBy { it.substringBeforeLast(":") }
.entries.partition { it.key.isEmpty() }
- nestedProjects.sortedByDescending { it.value.size }.forEach { (group, projects) ->
- appendLine(" subgraph $group")
- appendLine(" direction TB")
- projects.sorted().forEach {
- appendLine(it.alias(indent = 4, plugins.get().getValue(it)))
+
+ val orderedGroups = nestedProjects.groupBy {
+ if (it.key.count { char -> char == ':' } > 1) it.key.substringBeforeLast(":") else ""
+ }
+
+ orderedGroups.forEach { (outerGroup, innerGroups) ->
+ if (outerGroup.isNotEmpty()) {
+ appendLine(" subgraph $outerGroup")
+ appendLine(" direction TB")
+ }
+ innerGroups.sortedWith(
+ compareBy(
+ { (group, _) ->
+ dependencies.filter { dep ->
+ val toGroup = dep.dependency.substringBeforeLast(":")
+ toGroup == group && dep.project.substringBeforeLast(":") != group
+ }.count()
+ },
+ { -it.value.size },
+ ),
+ ).forEach { (group, projects) ->
+ val indent = if (outerGroup.isNotEmpty()) 4 else 2
+ appendLine(" ".repeat(indent) + "subgraph $group")
+ appendLine(" ".repeat(indent) + " direction TB")
+ projects.sorted().forEach {
+ appendLine(it.alias(indent = indent + 2, plugins.get().getValue(it)))
+ }
+ appendLine(" ".repeat(indent) + "end")
+ }
+ if (outerGroup.isNotEmpty()) {
+ appendLine(" end")
}
- appendLine(" end")
}
+
rootProjects.flatMap { it.value }.sortedDescending().forEach {
appendLine(it.alias(indent = 2, plugins.get().getValue(it)))
}
diff --git a/feature/bookmarks/api/README.md b/feature/bookmarks/api/README.md
index 45caa30ef..7a97f09be 100644
--- a/feature/bookmarks/api/README.md
+++ b/feature/bookmarks/api/README.md
@@ -11,9 +11,12 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
- subgraph :feature:bookmarks
+ subgraph :feature
direction TB
- :feature:bookmarks:api[api]:::android-library
+ subgraph :feature:bookmarks
+ direction TB
+ :feature:bookmarks:api[api]:::android-library
+ end
end
subgraph :core
direction TB
diff --git a/feature/bookmarks/impl/README.md b/feature/bookmarks/impl/README.md
index 9aa9ee59c..123a842f6 100644
--- a/feature/bookmarks/impl/README.md
+++ b/feature/bookmarks/impl/README.md
@@ -11,6 +11,18 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
+ subgraph :feature
+ direction TB
+ subgraph :feature:bookmarks
+ direction TB
+ :feature:bookmarks:api[api]:::android-library
+ :feature:bookmarks:impl[impl]:::android-library
+ end
+ subgraph :feature:topic
+ direction TB
+ :feature:topic:api[api]:::android-library
+ end
+ end
subgraph :core
direction TB
:core:analytics[analytics]:::android-library
@@ -26,15 +38,6 @@ graph TB
:core:notifications[notifications]:::android-library
:core:ui[ui]:::android-library
end
- subgraph :feature:bookmarks
- direction TB
- :feature:bookmarks:api[api]:::android-library
- :feature:bookmarks:impl[impl]:::android-library
- end
- subgraph :feature:topic
- direction TB
- :feature:topic:api[api]:::android-library
- end
:core:data -.-> :core:analytics
:core:data --> :core:common
diff --git a/feature/foryou/api/README.md b/feature/foryou/api/README.md
index d04fe0628..81223ecac 100644
--- a/feature/foryou/api/README.md
+++ b/feature/foryou/api/README.md
@@ -11,9 +11,12 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
- subgraph :feature:foryou
+ subgraph :feature
direction TB
- :feature:foryou:api[api]:::android-library
+ subgraph :feature:foryou
+ direction TB
+ :feature:foryou:api[api]:::android-library
+ end
end
subgraph :core
direction TB
diff --git a/feature/foryou/impl/README.md b/feature/foryou/impl/README.md
index 9468f795f..8c12460f4 100644
--- a/feature/foryou/impl/README.md
+++ b/feature/foryou/impl/README.md
@@ -11,6 +11,18 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
+ subgraph :feature
+ direction TB
+ subgraph :feature:foryou
+ direction TB
+ :feature:foryou:api[api]:::android-library
+ :feature:foryou:impl[impl]:::android-library
+ end
+ subgraph :feature:topic
+ direction TB
+ :feature:topic:api[api]:::android-library
+ end
+ end
subgraph :core
direction TB
:core:analytics[analytics]:::android-library
@@ -27,15 +39,6 @@ graph TB
:core:notifications[notifications]:::android-library
:core:ui[ui]:::android-library
end
- subgraph :feature:foryou
- direction TB
- :feature:foryou:api[api]:::android-library
- :feature:foryou:impl[impl]:::android-library
- end
- subgraph :feature:topic
- direction TB
- :feature:topic:api[api]:::android-library
- end
:core:data -.-> :core:analytics
:core:data --> :core:common
diff --git a/feature/interests/api/README.md b/feature/interests/api/README.md
index 4c920c8ca..ef580df7c 100644
--- a/feature/interests/api/README.md
+++ b/feature/interests/api/README.md
@@ -11,9 +11,12 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
- subgraph :feature:interests
+ subgraph :feature
direction TB
- :feature:interests:api[api]:::android-library
+ subgraph :feature:interests
+ direction TB
+ :feature:interests:api[api]:::android-library
+ end
end
subgraph :core
direction TB
diff --git a/feature/search/api/README.md b/feature/search/api/README.md
index 88460cbe0..a468f649d 100644
--- a/feature/search/api/README.md
+++ b/feature/search/api/README.md
@@ -1,3 +1,84 @@
-# :feature:search:api module
-## Dependency graph
-
+# `:feature:search:api`
+
+## Module dependency graph
+
+
+```mermaid
+---
+config:
+ layout: elk
+ elk:
+ nodePlacementStrategy: SIMPLE
+---
+graph TB
+ subgraph :feature
+ direction TB
+ subgraph :feature:search
+ direction TB
+ :feature:search:api[api]:::android-library
+ end
+ end
+ subgraph :core
+ direction TB
+ :core:analytics[analytics]:::android-library
+ :core:common[common]:::jvm-library
+ :core:data[data]:::android-library
+ :core:database[database]:::android-library
+ :core:datastore[datastore]:::android-library
+ :core:datastore-proto[datastore-proto]:::android-library
+ :core:domain[domain]:::android-library
+ :core:model[model]:::jvm-library
+ :core:navigation[navigation]:::android-library
+ :core:network[network]:::android-library
+ :core:notifications[notifications]:::android-library
+ 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:domain --> :core:data
+ :core:domain --> :core:model
+ :core:network --> :core:common
+ :core:network --> :core:model
+ :core:notifications -.-> :core:common
+ :core:notifications --> :core:model
+ :feature:search:api -.-> :core:domain
+ :feature:search:api --> :core:navigation
+
+classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
+classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
+classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
+classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;
+```
+
+📋 Graph legend
+
+```mermaid
+graph TB
+ application[application]:::android-application
+ feature[feature]:::android-feature
+ library[library]:::android-library
+ jvm[jvm]:::jvm-library
+
+ application -.-> feature
+ library --> jvm
+
+classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
+classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
+classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
+classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;
+```
+
+
+
diff --git a/feature/search/impl/README.md b/feature/search/impl/README.md
index d1304a4d3..04800005c 100644
--- a/feature/search/impl/README.md
+++ b/feature/search/impl/README.md
@@ -1,3 +1,108 @@
-# :feature:search:impl module
-## Dependency graph
-
+# `:feature:search:impl`
+
+## Module dependency graph
+
+
+```mermaid
+---
+config:
+ layout: elk
+ elk:
+ nodePlacementStrategy: SIMPLE
+---
+graph TB
+ subgraph :feature
+ direction TB
+ subgraph :feature:search
+ direction TB
+ :feature:search:api[api]:::android-library
+ :feature:search:impl[impl]:::android-library
+ end
+ subgraph :feature:interests
+ direction TB
+ :feature:interests:api[api]:::android-library
+ end
+ subgraph :feature:topic
+ direction TB
+ :feature:topic:api[api]:::android-library
+ end
+ end
+ subgraph :core
+ direction TB
+ :core:analytics[analytics]:::android-library
+ :core:common[common]:::jvm-library
+ :core:data[data]:::android-library
+ :core:database[database]:::android-library
+ :core:datastore[datastore]:::android-library
+ :core:datastore-proto[datastore-proto]:::android-library
+ :core:designsystem[designsystem]:::android-library
+ :core:domain[domain]:::android-library
+ :core:model[model]:::jvm-library
+ :core:navigation[navigation]:::android-library
+ :core:network[network]:::android-library
+ :core:notifications[notifications]:::android-library
+ :core:ui[ui]:::android-library
+ 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:domain --> :core:data
+ :core:domain --> :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:interests:api --> :core:navigation
+ :feature:search:api -.-> :core:domain
+ :feature:search:api --> :core:navigation
+ :feature:search:impl -.-> :core:designsystem
+ :feature:search:impl -.-> :core:domain
+ :feature:search:impl -.-> :core:ui
+ :feature:search:impl -.-> :feature:interests:api
+ :feature:search:impl -.-> :feature:search:api
+ :feature:search:impl -.-> :feature:topic:api
+ :feature:topic:api -.-> :core:designsystem
+ :feature:topic:api --> :core:navigation
+ :feature:topic:api -.-> :core:ui
+
+classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
+classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
+classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
+classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;
+```
+
+📋 Graph legend
+
+```mermaid
+graph TB
+ application[application]:::android-application
+ feature[feature]:::android-feature
+ library[library]:::android-library
+ jvm[jvm]:::jvm-library
+
+ application -.-> feature
+ library --> jvm
+
+classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
+classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
+classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
+classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
+classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;
+```
+
+
+
diff --git a/feature/settings/impl/README.md b/feature/settings/impl/README.md
index ee6e91e47..88aadd960 100644
--- a/feature/settings/impl/README.md
+++ b/feature/settings/impl/README.md
@@ -11,6 +11,13 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
+ subgraph :feature
+ direction TB
+ subgraph :feature:settings
+ direction TB
+ :feature:settings:impl[impl]:::android-library
+ end
+ end
subgraph :core
direction TB
:core:analytics[analytics]:::android-library
@@ -25,10 +32,6 @@ graph TB
:core:notifications[notifications]:::android-library
:core:ui[ui]:::android-library
end
- subgraph :feature:settings
- direction TB
- :feature:settings:impl[impl]:::android-library
- end
:core:data -.-> :core:analytics
:core:data --> :core:common
diff --git a/sync/sync-test/README.md b/sync/sync-test/README.md
index 69f24aaea..601724ef7 100644
--- a/sync/sync-test/README.md
+++ b/sync/sync-test/README.md
@@ -11,6 +11,11 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
+ subgraph :sync
+ direction TB
+ :sync:sync-test[sync-test]:::android-library
+ :sync:work[work]:::android-library
+ end
subgraph :core
direction TB
:core:analytics[analytics]:::android-library
@@ -23,11 +28,6 @@ graph TB
:core:network[network]:::android-library
:core:notifications[notifications]:::android-library
end
- subgraph :sync
- direction TB
- :sync:sync-test[sync-test]:::android-library
- :sync:work[work]:::android-library
- end
:core:data -.-> :core:analytics
:core:data --> :core:common
diff --git a/sync/work/README.md b/sync/work/README.md
index 91abef4d2..fab74f33c 100644
--- a/sync/work/README.md
+++ b/sync/work/README.md
@@ -11,6 +11,10 @@ config:
nodePlacementStrategy: SIMPLE
---
graph TB
+ subgraph :sync
+ direction TB
+ :sync:work[work]:::android-library
+ end
subgraph :core
direction TB
:core:analytics[analytics]:::android-library
@@ -23,10 +27,6 @@ graph TB
:core:network[network]:::android-library
:core:notifications[notifications]:::android-library
end
- subgraph :sync
- direction TB
- :sync:work[work]:::android-library
- end
:core:data -.-> :core:analytics
:core:data --> :core:common