From 160089d3fffeb788464e23b36bc476a3e0cde183 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Mon, 25 Mar 2024 23:28:50 +0100 Subject: [PATCH] Add script to generate module diagram (#7028) --- scripts/generateModuleDiagram.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/generateModuleDiagram.sh diff --git a/scripts/generateModuleDiagram.sh b/scripts/generateModuleDiagram.sh new file mode 100644 index 000000000..20b5077a1 --- /dev/null +++ b/scripts/generateModuleDiagram.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +echo "digraph modules {" | tee /tmp/antennapod-modules.dot +modules=$(find . -name "build.gradle") +for modulePath in $modules; do + name=$(echo $modulePath | sed -E 's/\.\/?(.*)\/build\.gradle/:\1/g' | sed -E 's/\//:/g') + dependencies=$(cat $modulePath | sed -nE "s/[ ]*implementation project\\(['\"](.*)['\"]\\)/\\1/p") + for dependency in $dependencies; do + echo "\"$name\" -> \"$dependency\";" | tee --append /tmp/antennapod-modules.dot + done +done +echo "}" | tee --append /tmp/antennapod-modules.dot + +tred /tmp/antennapod-modules.dot | dot -Tpng > moduleDiagram.png +rm /tmp/antennapod-modules.dot +echo "Wrote to moduleDiagram.png"