Merge pull request #1288 from android/dt/fix-dependency-graphs

Make path to module graph image dynamic. Fixes #1286
pull/1276/head
Don Turner 10 months ago committed by GitHub
commit 0fce45c47a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,3 +1,3 @@
# :app-nia-catalog module
## Dependency graph
![Dependency graph](../../docs/images/graphs/dep_graph_app_nia_catalog.svg)
![Dependency graph](../docs/images/graphs/dep_graph_app_nia_catalog.svg)

@ -1,3 +1,3 @@
# :app module
## Dependency graph
![Dependency graph](../../docs/images/graphs/dep_graph_app.svg)
![Dependency graph](../docs/images/graphs/dep_graph_app.svg)

@ -56,14 +56,23 @@ check_and_create_readme() {
local file_name="$2"
local readme_path="${module_path:1}" # Remove leading colon
readme_path=${readme_path//:/\/} # Replace colons with slashes using sed
readme_path=${readme_path//:/\/} # Replace colons with slashes
readme_path="${readme_path}/README.md" #Append the filename
# 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"
# Determine the depth of the module based on the number of colons
local depth=$(awk -F: '{print NF-1}' <<< "${module_path}")
# Construct the relative image path with the correct number of "../"
local relative_image_path="../"
for ((i=1; i<$depth; i++)); do
relative_image_path+="../"
done
relative_image_path+="docs/images/graphs/${file_name}.svg"
echo "# ${module_path} module" > "$readme_path"
echo "## Dependency graph" >> "$readme_path"
echo "![Dependency graph](${relative_image_path})" >> "$readme_path"

Loading…
Cancel
Save