diff --git a/generateModuleGraphs.sh b/generateModuleGraphs.sh index a503a1c00..fc2676cab 100755 --- a/generateModuleGraphs.sh +++ b/generateModuleGraphs.sh @@ -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="${file_name//-/_}" # Replace dashes with underscores - check_and_create_readme "$module_path" "$file_name" - # Generate the .gv file in a temporary location # .*//g' | tr -d '\0' | - xmllint --format - \ - > "docs/images/graphs/${file_name}.svg" - # Remove the temporary .gv file - rm "/tmp/${file_name}.gv" + # Check gv file's existence + if [ -e "/tmp/${file_name}.gv" ]; then + # Convert to SVG using dot, remove unnecessary comments + svg_cleared=`dot -Tsvg "/tmp/${file_name}.gv" | sed -e 's/.*//g' | tr -d '\0'` + + # 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" + fi fi done