-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate_graph.sh
executable file
·88 lines (72 loc) · 1.75 KB
/
generate_graph.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
source "$(readlink -f $0 | xargs dirname)/_shared.sh"
function help {
echo "OVERVIEW: Generates dependency graph for the workspace."
echo ""
echo "USAGE: $(basename $(readlink -f $0)) [options]"
echo ""
echo "OPTIONS:"
echo " -o, --open Open the graph after generation."
echo " -h, --help Show help information."
}
OPEN=0
for arg in "$@"; do
case "$arg" in
-o|--open)
OPEN=1;;
-h|--help)
help
exit 0;;
*)
echo "Unknown argument: $arg"
echo ""
help
exit 1;;
esac
done
setup_tuist
OUTPUT_DIR="$ROOT_DIR/web/assets"
OUTPUT_PATH="$OUTPUT_DIR/graph.png"
OUTPUT_TESTS_PATH="$OUTPUT_DIR/graph-tests.png"
OUTPUT_EXTERNAL_PATH="$OUTPUT_DIR/graph-external.png"
echo "==> Generate graph..."
stopwatch start
tuist graph \
--no-skip-test-targets \
--skip-external-dependencies \
--format png \
--no-open \
--algorithm dot \
--path "$ROOT_DIR" \
--output-path "$OUTPUT_DIR" \
|| exit $?
mv -f "$OUTPUT_PATH" "$OUTPUT_TESTS_PATH" || exit $?
echo "Generated: $OUTPUT_TESTS_PATH"
tuist graph \
--skip-test-targets \
--no-skip-external-dependencies \
--format png \
--no-open \
--algorithm dot \
--path "$ROOT_DIR" \
--output-path "$OUTPUT_DIR" \
|| exit $?
mv -f "$OUTPUT_PATH" "$OUTPUT_EXTERNAL_PATH" || exit $?
echo "Generated: $OUTPUT_EXTERNAL_PATH"
tuist graph \
--skip-test-targets \
--skip-external-dependencies \
--format png \
--no-open \
--algorithm dot \
--path "$ROOT_DIR" \
--output-path "$OUTPUT_DIR" \
|| exit $?
echo "Generated: $OUTPUT_PATH"
if [[ $OPEN == 1 ]]; then
open "$OUTPUT_EXTERNAL_PATH"
open "$OUTPUT_TESTS_PATH"
open "$OUTPUT_PATH"
fi
echo "==> \"Generate graph\" finished in $(stopwatch print)"
stopwatch stop