Skip to content

Commit e5008c6

Browse files
authored
Merge pull request #1460 from android/dt/tidy-graph-script
Remove the printModulePaths task and read modules direct from settings
2 parents b85cf7d + 2ec9408 commit e5008c6

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

build.gradle.kts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,3 @@ plugins {
4949
alias(libs.plugins.room) apply false
5050
alias(libs.plugins.module.graph) apply true // Plugin applied to allow module graph generation
5151
}
52-
53-
// Task to print all the module paths in the project e.g. :core:data
54-
// Used by module graph generator script
55-
tasks.register("printModulePaths") {
56-
subprojects {
57-
if (subprojects.size == 0) {
58-
println(this.path)
59-
}
60-
}
61-
}

generateModuleGraphs.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ then
3131
exit 1
3232
fi
3333

34+
# Check for a version of grep which supports Perl regex.
35+
# On MacOS the OS installed grep doesn't support Perl regex so check for the existence of the
36+
# GNU version instead which is prefixed with 'g' to distinguish it from the OS installed version.
37+
if grep -P "" /dev/null > /dev/null 2>&1; then
38+
GREP_COMMAND=grep
39+
elif command -v ggrep &> /dev/null; then
40+
GREP_COMMAND=ggrep
41+
else
42+
echo "You don't have a version of 'grep' installed which supports Perl regular expressions."
43+
echo "On MacOS you can install one using Homebrew with the command: 'brew install grep'"
44+
exit 1
45+
fi
46+
3447
# Initialize an array to store excluded modules
3548
excluded_modules=()
3649

@@ -50,7 +63,7 @@ while [[ $# -gt 0 ]]; do
5063
done
5164

5265
# Get the module paths
53-
module_paths=$(./gradlew -q printModulePaths --no-configuration-cache)
66+
module_paths=$(${GREP_COMMAND} -oP 'include\("\K[^"]+' settings.gradle.kts)
5467

5568
# Ensure the output directory exists
5669
mkdir -p docs/images/graphs/

0 commit comments

Comments
 (0)