diff --git a/app-nia-catalog/README.md b/app-nia-catalog/README.md
index edbbb5e46..724f1effe 100644
--- a/app-nia-catalog/README.md
+++ b/app-nia-catalog/README.md
@@ -1,3 +1,3 @@
# :app-nia-catalog module
-![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.png)
+![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.svg)
diff --git a/app/README.md b/app/README.md
index 9f151c245..bbadc7330 100644
--- a/app/README.md
+++ b/app/README.md
@@ -1,3 +1,3 @@
# :app module
-![Dependency graph](../docs/images/graphs/dep_graph_app.png)
+![Dependency graph](../docs/images/graphs/dep_graph_app.svg)
diff --git a/build.gradle.kts b/build.gradle.kts
index 6fe9b829e..1790cd202 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -27,9 +27,10 @@ buildscript {
exclude(group = "com.google.protobuf")
}
}
+
}
-// Lists all plugins used throughout the project without applying them.
+// Lists all plugins used throughout the project
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
@@ -46,4 +47,15 @@ plugins {
alias(libs.plugins.roborazzi) apply false
alias(libs.plugins.secrets) apply false
alias(libs.plugins.room) apply false
+ alias(libs.plugins.module.graph) apply true // Plugin applied to allow module graph generation
}
+
+// Task to print all the module paths in the project e.g. :core:data
+// Used by module graph generator script
+tasks.register("printModulePaths") {
+ subprojects {
+ if (subprojects.size == 0) {
+ println(this.path)
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/analytics/README.md b/core/analytics/README.md
new file mode 100644
index 000000000..c451cc838
--- /dev/null
+++ b/core/analytics/README.md
@@ -0,0 +1,3 @@
+# :core:analytics module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_core_analytics.svg)
diff --git a/core/common/README.md b/core/common/README.md
index ade22c076..2fbc5a329 100644
--- a/core/common/README.md
+++ b/core/common/README.md
@@ -1,3 +1,3 @@
# :core:common module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_common.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_common.svg)
diff --git a/core/data-test/README.md b/core/data-test/README.md
index 4f623e629..43804eeec 100644
--- a/core/data-test/README.md
+++ b/core/data-test/README.md
@@ -1,3 +1,3 @@
# :core:data-test module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_data_test.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_data_test.svg)
diff --git a/core/data/README.md b/core/data/README.md
index 905d74615..a5a05870c 100644
--- a/core/data/README.md
+++ b/core/data/README.md
@@ -1,3 +1,3 @@
# :core:data module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_data.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_data.svg)
diff --git a/core/database/README.md b/core/database/README.md
index 5cf339aed..524cb5c48 100644
--- a/core/database/README.md
+++ b/core/database/README.md
@@ -1,3 +1,3 @@
# :core:database module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_database.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_database.svg)
diff --git a/core/datastore-proto/README.md b/core/datastore-proto/README.md
new file mode 100644
index 000000000..0b115b981
--- /dev/null
+++ b/core/datastore-proto/README.md
@@ -0,0 +1,3 @@
+# :core:datastore-proto module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_core_datastore_proto.svg)
diff --git a/core/datastore-test/README.md b/core/datastore-test/README.md
index 45cc51a48..f59e9353d 100644
--- a/core/datastore-test/README.md
+++ b/core/datastore-test/README.md
@@ -1,3 +1,3 @@
# :core:datastore-test module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_datastore_test.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_datastore_test.svg)
diff --git a/core/datastore/README.md b/core/datastore/README.md
index 56699a483..e05e2ff72 100644
--- a/core/datastore/README.md
+++ b/core/datastore/README.md
@@ -1,3 +1,3 @@
# :core:datastore module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_datastore.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_datastore.svg)
diff --git a/core/designsystem/README.md b/core/designsystem/README.md
index 52a793821..59f8cf803 100644
--- a/core/designsystem/README.md
+++ b/core/designsystem/README.md
@@ -1,3 +1,3 @@
# :core:designsystem module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_designsystem.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_designsystem.svg)
diff --git a/core/domain/README.md b/core/domain/README.md
new file mode 100644
index 000000000..f86422435
--- /dev/null
+++ b/core/domain/README.md
@@ -0,0 +1,3 @@
+# :core:domain module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_core_domain.svg)
diff --git a/core/model/README.md b/core/model/README.md
index 5279064f2..c740370ac 100644
--- a/core/model/README.md
+++ b/core/model/README.md
@@ -1,3 +1,3 @@
# :core:model module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_model.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_model.svg)
diff --git a/core/network/README.md b/core/network/README.md
index cfd9fd369..4106f0dde 100644
--- a/core/network/README.md
+++ b/core/network/README.md
@@ -1,3 +1,3 @@
# :core:network module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_network.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_network.svg)
diff --git a/core/notifications/README.md b/core/notifications/README.md
new file mode 100644
index 000000000..7d509913f
--- /dev/null
+++ b/core/notifications/README.md
@@ -0,0 +1,3 @@
+# :core:notifications module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_core_notifications.svg)
diff --git a/core/testing/README.md b/core/testing/README.md
index 8eea64ac9..a7d40abcd 100644
--- a/core/testing/README.md
+++ b/core/testing/README.md
@@ -1,3 +1,3 @@
# :core:testing module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_testing.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_testing.svg)
diff --git a/core/ui/README.md b/core/ui/README.md
index 88c3561f1..e41b50bd5 100644
--- a/core/ui/README.md
+++ b/core/ui/README.md
@@ -1,3 +1,3 @@
# :core:ui module
-![Dependency graph](../../docs/images/graphs/dep_graph_core_ui.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_core_ui.svg)
diff --git a/docs/images/graphs/dep_graph_app.svg b/docs/images/graphs/dep_graph_app.svg
new file mode 100644
index 000000000..f305eff13
--- /dev/null
+++ b/docs/images/graphs/dep_graph_app.svg
@@ -0,0 +1,481 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_app_nia_catalog.svg b/docs/images/graphs/dep_graph_app_nia_catalog.svg
new file mode 100644
index 000000000..b58415cef
--- /dev/null
+++ b/docs/images/graphs/dep_graph_app_nia_catalog.svg
@@ -0,0 +1,73 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_analytics.svg b/docs/images/graphs/dep_graph_core_analytics.svg
new file mode 100644
index 000000000..ac21c0707
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_analytics.svg
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_common.svg b/docs/images/graphs/dep_graph_core_common.svg
new file mode 100644
index 000000000..c91f33853
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_common.svg
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_data.svg b/docs/images/graphs/dep_graph_core_data.svg
new file mode 100644
index 000000000..cacf03a1f
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_data.svg
@@ -0,0 +1,151 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_data_test.svg b/docs/images/graphs/dep_graph_core_data_test.svg
new file mode 100644
index 000000000..162c83f10
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_data_test.svg
@@ -0,0 +1,163 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_database.svg b/docs/images/graphs/dep_graph_core_database.svg
new file mode 100644
index 000000000..9e907b96f
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_database.svg
@@ -0,0 +1,31 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_datastore.svg b/docs/images/graphs/dep_graph_core_datastore.svg
new file mode 100644
index 000000000..cfcf78db2
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_datastore.svg
@@ -0,0 +1,55 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_datastore_proto.svg b/docs/images/graphs/dep_graph_core_datastore_proto.svg
new file mode 100644
index 000000000..d572d0ea7
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_datastore_proto.svg
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_datastore_test.svg b/docs/images/graphs/dep_graph_core_datastore_test.svg
new file mode 100644
index 000000000..ca8d3f84b
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_datastore_test.svg
@@ -0,0 +1,73 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_designsystem.svg b/docs/images/graphs/dep_graph_core_designsystem.svg
new file mode 100644
index 000000000..f46f075f0
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_designsystem.svg
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_domain.svg b/docs/images/graphs/dep_graph_core_domain.svg
new file mode 100644
index 000000000..1c97b64e8
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_domain.svg
@@ -0,0 +1,169 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_model.svg b/docs/images/graphs/dep_graph_core_model.svg
new file mode 100644
index 000000000..290457d6c
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_model.svg
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_network.svg b/docs/images/graphs/dep_graph_core_network.svg
new file mode 100644
index 000000000..ea804bcff
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_network.svg
@@ -0,0 +1,43 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_notifications.svg b/docs/images/graphs/dep_graph_core_notifications.svg
new file mode 100644
index 000000000..cf25ca32e
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_notifications.svg
@@ -0,0 +1,43 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_testing.svg b/docs/images/graphs/dep_graph_core_testing.svg
new file mode 100644
index 000000000..29d367e4b
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_testing.svg
@@ -0,0 +1,199 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_core_ui.svg b/docs/images/graphs/dep_graph_core_ui.svg
new file mode 100644
index 000000000..2eba46866
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_ui.svg
@@ -0,0 +1,55 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_feature_bookmarks.svg b/docs/images/graphs/dep_graph_feature_bookmarks.svg
new file mode 100644
index 000000000..cfbb86412
--- /dev/null
+++ b/docs/images/graphs/dep_graph_feature_bookmarks.svg
@@ -0,0 +1,205 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_feature_foryou.svg b/docs/images/graphs/dep_graph_feature_foryou.svg
new file mode 100644
index 000000000..e196bc7da
--- /dev/null
+++ b/docs/images/graphs/dep_graph_feature_foryou.svg
@@ -0,0 +1,229 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_feature_interests.svg b/docs/images/graphs/dep_graph_feature_interests.svg
new file mode 100644
index 000000000..3728cb4f6
--- /dev/null
+++ b/docs/images/graphs/dep_graph_feature_interests.svg
@@ -0,0 +1,229 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_feature_search.svg b/docs/images/graphs/dep_graph_feature_search.svg
new file mode 100644
index 000000000..b9a3c36c4
--- /dev/null
+++ b/docs/images/graphs/dep_graph_feature_search.svg
@@ -0,0 +1,331 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_feature_settings.svg b/docs/images/graphs/dep_graph_feature_settings.svg
new file mode 100644
index 000000000..93826715a
--- /dev/null
+++ b/docs/images/graphs/dep_graph_feature_settings.svg
@@ -0,0 +1,205 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_feature_topic.svg b/docs/images/graphs/dep_graph_feature_topic.svg
new file mode 100644
index 000000000..cbda3c225
--- /dev/null
+++ b/docs/images/graphs/dep_graph_feature_topic.svg
@@ -0,0 +1,205 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_sync_sync_test.svg b/docs/images/graphs/dep_graph_sync_sync_test.svg
new file mode 100644
index 000000000..1e0753393
--- /dev/null
+++ b/docs/images/graphs/dep_graph_sync_sync_test.svg
@@ -0,0 +1,187 @@
+
+
+
+
+
diff --git a/docs/images/graphs/dep_graph_sync_work.svg b/docs/images/graphs/dep_graph_sync_work.svg
new file mode 100644
index 000000000..6901b5761
--- /dev/null
+++ b/docs/images/graphs/dep_graph_sync_work.svg
@@ -0,0 +1,169 @@
+
+
+
+
+
diff --git a/feature/bookmarks/README.md b/feature/bookmarks/README.md
index e2b8c65ac..1af65fd92 100644
--- a/feature/bookmarks/README.md
+++ b/feature/bookmarks/README.md
@@ -1,3 +1,3 @@
# :feature:bookmarks module
-![Dependency graph](../../docs/images/graphs/dep_graph_feature_bookmarks.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_feature_bookmarks.svg)
diff --git a/feature/foryou/README.md b/feature/foryou/README.md
index 1ca599859..fd864fbfa 100644
--- a/feature/foryou/README.md
+++ b/feature/foryou/README.md
@@ -1,3 +1,3 @@
# :feature:foryou module
-![Dependency graph](../../docs/images/graphs/dep_graph_feature_foryou.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_feature_foryou.svg)
diff --git a/feature/interests/README.md b/feature/interests/README.md
index b7601ecbc..be94111d8 100644
--- a/feature/interests/README.md
+++ b/feature/interests/README.md
@@ -1,3 +1,3 @@
# :feature:interests module
-![Dependency graph](../../docs/images/graphs/dep_graph_feature_interests.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_feature_interests.svg)
diff --git a/feature/search/README.md b/feature/search/README.md
new file mode 100644
index 000000000..c793d1543
--- /dev/null
+++ b/feature/search/README.md
@@ -0,0 +1,3 @@
+# :feature:search module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_feature_search.svg)
diff --git a/feature/settings/README.md b/feature/settings/README.md
new file mode 100644
index 000000000..8620a2dcd
--- /dev/null
+++ b/feature/settings/README.md
@@ -0,0 +1,3 @@
+# :feature:settings module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_feature_settings.svg)
diff --git a/feature/topic/README.md b/feature/topic/README.md
index d74517e63..199a9cb55 100644
--- a/feature/topic/README.md
+++ b/feature/topic/README.md
@@ -1,3 +1,3 @@
# :feature:topic module
-![Dependency graph](../../docs/images/graphs/dep_graph_feature_topic.png)
+![Dependency graph](../../docs/images/graphs/dep_graph_feature_topic.svg)
diff --git a/generateModuleGraphs.sh b/generateModuleGraphs.sh
new file mode 100755
index 000000000..c759fea30
--- /dev/null
+++ b/generateModuleGraphs.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+#
+# Copyright 2024 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Script to generate dependency graphs for each of the modules
+# Usage: generateModuleGraphs.sh --exclude-module :benchmarks --exclude-module :lint
+
+# Echo each command so the caller knows what's going on
+set -e
+
+# Check if the dot command is available
+if ! command -v dot &> /dev/null
+then
+ echo "The 'dot' command is not found. This is required to generate SVGs from the Graphviz files."
+ echo "On macOS, you can install it using Homebrew: 'brew install graphviz'"
+ exit 1
+fi
+
+# Initialize an array to store excluded modules
+excluded_modules=()
+
+# Parse command-line arguments for excluded modules
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --exclude-module)
+ excluded_modules+=("$2")
+ shift # Past argument
+ shift # Past value
+ ;;
+ *)
+ echo "Unknown parameter passed: $1"
+ exit 1
+ ;;
+ esac
+done
+
+# Function to check and create README.md
+check_and_create_readme() {
+ local module_path="$1"
+ local file_name="$2"
+
+ local readme_path="${module_path:1}" # Remove leading colon
+ readme_path=$(echo "$readme_path" | sed 's/:/\//g') # Replace colons with slashes using sed
+ readme_path="${readme_path}/README.md"
+
+ # Check if README.md exists and create it if not
+ if [[ ! -f "$readme_path" ]]; then
+ echo "Creating README.md for ${module_path}"
+ # Calculate the correct relative path to the image
+ local relative_image_path="../../docs/images/graphs/${file_name}.svg"
+ echo "# ${module_path} module" > "$readme_path"
+ echo "" >> "$readme_path"
+ echo "![Dependency graph](${relative_image_path})" >> "$readme_path"
+ fi
+}
+
+# Get the module paths
+module_paths=$(./gradlew -q printModulePaths --no-configuration-cache)
+
+# Loop through each module path
+echo "$module_paths" | while read -r module_path; do
+ # Check if the module is in the excluded list
+ if [[ ! " ${excluded_modules[@]} " =~ " ${module_path} " ]]; then
+ # Derive the filename from the module path
+ file_name="dep_graph${module_path//:/_}" # Replace colons with underscores
+ file_name="${file_name//-/_}" # Replace dashes with underscores
+
+ check_and_create_readme "$module_path" "$file_name"
+
+ # Generate the .gv file in a temporary location
+ # "docs/images/graphs/${file_name}.svg"
+ # Remove the temporary .gv file
+ rm "/tmp/${file_name}.gv"
+ fi
+done
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 7b1318c7a..f62f5d492 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -45,6 +45,7 @@ kotlinxCoroutines = "1.7.3"
kotlinxDatetime = "0.5.0"
kotlinxSerializationJson = "1.6.0"
ksp = "1.9.22-1.0.18"
+moduleGraph = "2.5.0"
okhttp = "4.12.0"
protobuf = "3.25.2"
protobufPlugin = "0.9.4"
@@ -158,6 +159,7 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
+module-graph = { id = "com.jraska.module.graph.assertion", version.ref = "moduleGraph" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }
roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }
room = { id = "androidx.room", version.ref = "room" }
diff --git a/lint/README.md b/lint/README.md
deleted file mode 100644
index 3eceb434b..000000000
--- a/lint/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# :lint module
-
-![Dependency graph](../docs/images/graphs/dep_graph_lint.png)
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 949dbfdd1..d4b6654b1 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -63,3 +63,4 @@ include(":lint")
include(":sync:work")
include(":sync:sync-test")
include(":ui-test-hilt-manifest")
+
diff --git a/sync/README.md b/sync/README.md
deleted file mode 100644
index b100e27ad..000000000
--- a/sync/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# :sync module
-
-![Dependency graph](../docs/images/graphs/dep_graph_sync.png)
diff --git a/sync/sync-test/README.md b/sync/sync-test/README.md
new file mode 100644
index 000000000..34ce5066a
--- /dev/null
+++ b/sync/sync-test/README.md
@@ -0,0 +1,3 @@
+# :sync:sync-test module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_sync_sync_test.svg)
diff --git a/sync/work/README.md b/sync/work/README.md
new file mode 100644
index 000000000..f31359e9f
--- /dev/null
+++ b/sync/work/README.md
@@ -0,0 +1,3 @@
+# :sync:work module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_sync_work.svg)