Add script to generate module diagram (#7028)

This commit is contained in:
ByteHamster 2024-03-25 23:28:50 +01:00 committed by GitHub
parent 69b24699a3
commit 160089d3ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -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"