Add file existence, and check is blank, and reorder the create README.md.

Change-Id: Ie2a039440143253b347495b46ae53b02d36d1c3d
pull/1505/head
Jaehwa Noh 1 year ago
parent 040c05b96c
commit d3112113bd

@ -105,20 +105,30 @@ echo "$module_paths" | while read -r module_path; do
file_name="dep_graph${module_path//:/_}" # Replace colons with underscores file_name="dep_graph${module_path//:/_}" # Replace colons with underscores
file_name="${file_name//-/_}" # Replace dashes 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 # Generate the .gv file in a temporary location
# </dev/null is used to stop ./gradlew from consuming input which prematurely ends the while loop # </dev/null is used to stop ./gradlew from consuming input which prematurely ends the while loop
./gradlew generateModulesGraphvizText \ ./gradlew generateModulesGraphvizText \
-Pmodules.graph.output.gv="/tmp/${file_name}.gv" \ -Pmodules.graph.output.gv="/tmp/${file_name}.gv" \
-Pmodules.graph.of.module="${module_path}" </dev/null -Pmodules.graph.of.module="${module_path}" </dev/null
# Convert to SVG using dot, remove unnecessary comments, and reformat # Check gv file's existence
dot -Tsvg "/tmp/${file_name}.gv" | if [ -e "/tmp/${file_name}.gv" ]; then
sed -e 's/<!--.*//g' -e 's/-->.*//g' | tr -d '\0' | # Convert to SVG using dot, remove unnecessary comments
xmllint --format - \ svg_cleared=`dot -Tsvg "/tmp/${file_name}.gv" | sed -e 's/<!--.*//g' -e 's/-->.*//g' | tr -d '\0'`
> "docs/images/graphs/${file_name}.svg"
# Remove the temporary .gv file # Check file is empty or not, if not empty run xmllint to reformat
# Save as svg file
if [ -n "$svg_cleared" ]; then
echo $svg_cleared | xmllint --format - > "docs/images/graphs/${file_name}.svg"
else
echo $svg_cleared > "docs/images/graphs/${file_name}.svg"
fi
# Create README.md
check_and_create_readme "$module_path" "$file_name"
# Remove tmp files
rm "/tmp/${file_name}.gv" rm "/tmp/${file_name}.gv"
fi fi
fi
done done

Loading…
Cancel
Save