forked from bschuedzig/dncviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.sh
executable file
·44 lines (31 loc) · 1.1 KB
/
generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
DG_FILE="$DIR/out/graph.dg"
# make sure we are in the directory of the script
cd "$DIR"
mkdir out 2>/dev/null || :
SLN_FILE="${1:-}"
if [[ -z "$SLN_FILE" ]]; then
echo "Please specify the .sln file"
exit 1
fi
DOT_VERSION="${2:-}"
if [[ -z "$DOT_VERSION" ]]; then
echo "Please specify the dotnet version ('netcoreapp3.1' | 'net6.0')"
exit 1
fi
if [[ ! -f "$SLN_FILE" ]]; then
echo "$SLN_FILE does not exist"
exit 1
fi
echo "Generating dependency graph"
dotnet msbuild /t:GenerateRestoreGraphFile /p:RestoreGraphOutputPath="$DG_FILE" "$SLN_FILE"
echo "Transforming to DOT syntax"
yarn start "$DG_FILE" "out/with_test.dot" "$DOT_VERSION"
yarn start "$DG_FILE" "out/without_test.dot" "$DOT_VERSION" "\\.Test"
echo "Invoking graphviz"
dot -Tpng -Kdot out/with_test.dot -o out/output_with_test.png
dot -Tsvg -Kdot out/with_test.dot -o out/output_with_test.svg
dot -Tpng -Kdot out/without_test.dot -o out/output_without_test.png
dot -Tsvg -Kdot out/without_test.dot -o out/output_without_test.svg