forked from XRPLF/xrpl-dev-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall-target-link-checker.sh
executable file
·80 lines (71 loc) · 1.98 KB
/
all-target-link-checker.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
#!/bin/bash
mkdir -p out
rm -r out
# Pass forward dactyl "vars" arg if provided
if [ "$1" == "--vars" ] && [ -n "$2" ];
then
dactyl_vars=$2
shift 2
fi
linkerrors=0
builderrors=0
# Build language-based targets all together first
langs=(en ja)
for lang in ${langs[*]}; do
echo "======================================="
echo "Building language: en"
if [ "$lang" == "en" ]; then
if [ -n "$dactyl_vars" ]; then
dactyl_build -q -t "$lang" --vars "$dactyl_vars"
else
dactyl_build -q -t "$lang"
fi
else
if [ -n "$dactyl_vars" ]; then
dactyl_build -q -t "$lang" -o "out/$lang" --vars "$dactyl_vars"
else
dactyl_build -q -t "$lang" -o "out/$lang"
fi
fi
buildresult=$?
if [ $buildresult -ne 0 ]; then
builderrors=$(($buildresult + $builderrors))
echo "Error building this target; link checker may miss things."
fi
done
# Check language targets all at once
dactyl_link_checker -q "$@"
linkerrors=$(($? + $linkerrors))
# Build & check other targets individually afterwords
other_targets=`dactyl_build -lq | awk '/^(en|ja) / {next;} {print $1}'`
while read -r line; do
echo ""
echo "======================================="
echo "Checking Target: $line"
rm -r out
if [ -n "$dactyl_vars" ]; then
dactyl_build -q -t "$line" --vars "$dactyl_vars"
else
dactyl_build -q -t "$line"
fi
buildresult=$?
if [ $buildresult -eq 0 ]
then
dactyl_link_checker -q "$@"
linkerrors=$(($? + $linkerrors))
else
builderrors=$(($buildresult + $builderrors))
echo "Error building this target; skipping link checker."
fi
done <<< "$other_targets"
totalerrors=$(($builderrors + $linkerrors))
echo ""
echo "======================================="
echo "======================================="
echo "All-target summary:"
echo "• $builderrors build errors"
echo "• $linkerrors link errors"
echo "-----------------------------"
echo " $totalerrors total errors"
echo ""
exit $totalerrors