Fixed issue with module graphs not generating on Linux

pull/1486/head
Neïl Rahmouni 1 year ago
parent 85129e4660
commit 00f75dcc81

@ -26,15 +26,15 @@ if ! command -v dot &> /dev/null
then then
echo "The 'dot' command is not found. This is required to generate SVGs from the Graphviz files." echo "The 'dot' command is not found. This is required to generate SVGs from the Graphviz files."
echo "Installation instructions:" echo "Installation instructions:"
echo " - On macOS: You can install Graphviz using Homebrew with the command: 'brew install graphviz'"
echo " - On Ubuntu: You can install Graphviz using APT with the command: 'sudo apt-get install graphviz'" echo " - On Ubuntu: You can install Graphviz using APT with the command: 'sudo apt-get install graphviz'"
echo " - On macOS: You can install Graphviz using Homebrew with the command: 'brew install graphviz'"
exit 1 exit 1
fi fi
# Check for a version of grep which supports Perl regex. # Check for a version of grep which supports Perl regex.
# On MacOS the OS installed grep doesn't support Perl regex so check for the existence of the # On MacOS the OS installed grep doesn't support Perl regex so check for the existence of the
# GNU version instead which is prefixed with 'g' to distinguish it from the OS installed version. # GNU version instead which is prefixed with 'g' to distinguish it from the OS installed version.
if grep -P "" /dev/null > /dev/null 2>&1; then if echo "" | grep -P "" > /dev/null 2>&1; then
GREP_COMMAND=grep GREP_COMMAND=grep
elif command -v ggrep &> /dev/null; then elif command -v ggrep &> /dev/null; then
GREP_COMMAND=ggrep GREP_COMMAND=ggrep
@ -114,10 +114,10 @@ echo "$module_paths" | while read -r module_path; do
-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 # Convert to SVG using dot, remove unnecessary comments, and reformat
dot -Tsvg "/tmp/${file_name}.gv" | dot -Tsvg "/tmp/${file_name}.gv" |
sed 's/<!--/\x0<!--/g;s/-->/-->\x0/g' | grep -zv '^<!--' | tr -d '\0' | sed 's/<!--/\x0<!--/g;s/-->/-->\x0/g' | grep -zv '^<!--' | tr -d '\0' |
xmllint --format - \ xmllint --format - \
> "docs/images/graphs/${file_name}.svg" > "docs/images/graphs/${file_name}.svg"
# Remove the temporary .gv file # Remove the temporary .gv file
rm "/tmp/${file_name}.gv" rm "/tmp/${file_name}.gv"
fi fi

Loading…
Cancel
Save