Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Add graph for screenshot testing module, minor update to script

Don Turnerc4642cea61f4
diff --git a/core/screenshot-testing/README.md b/core/screenshot-testing/README.md
new file mode 100644
index 000000000..bab2e1a10
--- /dev/null
+++ b/core/screenshot-testing/README.md
@@ -0,0 +1,3 @@
+# :core:screenshot-testing module
+
+![Dependency graph](../../docs/images/graphs/dep_graph_core_screenshot_testing.svg)
diff --git a/docs/images/graphs/dep_graph_core_screenshot_testing.svg b/docs/images/graphs/dep_graph_core_screenshot_testing.svg
new file mode 100644
index 000000000..e9fc6d48a
--- /dev/null
+++ b/docs/images/graphs/dep_graph_core_screenshot_testing.svg
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 9.0.0 (20230911.1827)
+ -->
+<!-- Title: G Pages: 1 -->
+<svg width="320pt" height="116pt"
+ viewBox="0.00 0.00 320.23 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
+<title>G</title>
+<polygon fill="white" stroke="none" points="-4,4 -4,-112 316.23,-112 316.23,4 -4,4"/>
+<!-- :core:screenshot&#45;testing -->
+<g id="node1" class="node">
+<title>:core:screenshot&#45;testing</title>
+<ellipse fill="none" stroke="black" cx="147.17" cy="-90" rx="98.44" ry="18"/>
+<text text-anchor="middle" x="147.17" y="-84.95" font-family="Times,serif" font-size="14.00">:core:screenshot&#45;testing</text>
+</g>
+<!-- :core:common -->
+<g id="node2" class="node">
+<title>:core:common</title>
+<ellipse fill="none" stroke="black" cx="65.17" cy="-18" rx="65.17" ry="18"/>
+<text text-anchor="middle" x="65.17" y="-12.95" font-family="Times,serif" font-size="14.00">:core:common</text>
+</g>
+<!-- :core:screenshot&#45;testing&#45;&gt;:core:common -->
+<g id="edge1" class="edge">
+<title>:core:screenshot&#45;testing&#45;&gt;:core:common</title>
+<path fill="none" stroke="red" stroke-width="2" d="M127.32,-72.05C117.07,-63.31 104.4,-52.49 93.17,-42.9"/>
+<polygon fill="red" stroke="red" stroke-width="2" points="96.73,-41.34 86.86,-37.51 92.19,-46.67 96.73,-41.34"/>
+</g>
+<!-- :core:designsystem -->
+<g id="node3" class="node">
+<title>:core:designsystem</title>
+<ellipse fill="none" stroke="black" cx="230.17" cy="-18" rx="82.06" ry="18"/>
+<text text-anchor="middle" x="230.17" y="-12.95" font-family="Times,serif" font-size="14.00">:core:designsystem</text>
+</g>
+<!-- :core:screenshot&#45;testing&#45;&gt;:core:designsystem -->
+<g id="edge2" class="edge">
+<title>:core:screenshot&#45;testing&#45;&gt;:core:designsystem</title>
+<path fill="none" stroke="black" d="M167.26,-72.05C177.56,-63.37 190.28,-52.64 201.58,-43.11"/>
+<polygon fill="black" stroke="black" points="203.72,-45.89 209.11,-36.76 199.21,-40.54 203.72,-45.89"/>
+</g>
+</g>
+</svg>
diff --git a/generateModuleGraphs.sh b/generateModuleGraphs.sh
index c759fea30..f69339502 100755
--- a/generateModuleGraphs.sh
+++ b/generateModuleGraphs.sh
@@ -14,12 +14,12 @@
# 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
+#
+# Script to generate dependency graphs for each of the modules. The --exclude-module parameter can
+# be used to exclude modules which are not part of the root dependency graph (and which, if included
+# would cause the script to fail.
+#
+# Usage: generateModuleGraphs.sh --exclude-module :benchmarks --exclude-module :lint --exclude-module :ui-test-hilt-manifest
# Check if the dot command is available
if ! command -v dot &> /dev/null
@@ -47,14 +47,17 @@ while [[ $# -gt 0 ]]; do
esac
done
-# Function to check and create README.md
+# Get the module paths
+module_paths=$(./gradlew -q printModulePaths --no-configuration-cache)
+
+# Function to check and create a README.md for modules which don't have one.
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"
+ readme_path="${readme_path}/README.md" #Append the filename
# Check if README.md exists and create it if not
if [[ ! -f "$readme_path" ]]; then
@@ -67,9 +70,6 @@ check_and_create_readme() {
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
@@ -83,6 +83,7 @@ echo "$module_paths" | while read -r module_path; do
# Generate the .gv file in a temporary location
# </dev/null is used to stop ./gradlew from consuming input which prematurely ends the while loop
./gradlew generateModulesGraphvizText -Pmodules.graph.output.gv="/tmp/${file_name}.gv" -Pmodules.graph.of.module="${module_path}" </dev/null
+
# Convert to SVG using dot
dot -Tsvg "/tmp/${file_name}.gv" > "docs/images/graphs/${file_name}.svg"
# Remove the temporary .gv file