-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtypecheck
executable file
·49 lines (47 loc) · 1.35 KB
/
typecheck
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
#!/bin/bash
# Configuration files:
# ====================
#
# * For a single program (say "program.links"), create the file
# "program.config" in the same directory that will contain the Links
# configuation to run that program.
#
# * For multiple programs in the same directory, you can also use a
# default config: "_default.config" - this is the fallback if there
# is no "program.config".
#
# * If none of these are present, Links will run with the default
# configuration.
FAILURES=0
for p in $(find -P . -path ./_opam -prune -false -o -name "*.links"); do
printf "%s..." $p
grep "^$p" "ignorelist" > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
printf " IGNORED\n"
else
dirname=$(dirname "$p")
basename=$(basename "$p")
filename=${basename%.*}
# Find an applicable config file if it exists
if [[ -f "$dirname/$filename.config" ]]; then
config="$dirname/$filename.config"
elif [[ -f "$dirname/_default.config" ]]; then
config="$dirname/_default.config"
else
config=""
fi
# Run Links, possibly with the config
if [[ -n $config ]]; then
linx --config=$config --set=typecheck_only=true $p
else
linx --set=typecheck_only=true $p
fi
if [[ $? -eq 0 ]]; then
printf " SUCCESS\n"
else
printf " FAILURE\n"
FAILURES=$((FAILURES+1))
fi
fi
done
exit $FAILURES