-
Notifications
You must be signed in to change notification settings - Fork 67
/
run.sh
executable file
·37 lines (30 loc) · 951 Bytes
/
run.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
#!/usr/bin/env bash
build() {
go clean
rm -f core/a_*.go # In case switching from a gen-code branch or similar (any existing files might break the build here)
go generate ./...
(cd core; go fmt a_*.go > /dev/null)
go vet ./...
go build
}
set -e # Exit on error.
build
if [ "$1" == "-v" ]; then
./joker -e '(print "\nLibraries available in this build:\n ") (loaded-libs) (println)'
fi
SUM256="$(go run tools/sum256dir/main.go std)"
OUT="$(cd std; ../joker generate-std.joke 2>&1 | grep -v 'WARNING:.*already refers' | grep '.')" || : # grep returns non-zero if no lines match
if [ -n "$OUT" ]; then
echo "$OUT"
echo >&2 "Unable to generate fresh library files; exiting."
exit 2
fi
(cd std; go fmt ./... > /dev/null)
NEW_SUM256="$(go run tools/sum256dir/main.go std)"
if [ "$SUM256" != "$NEW_SUM256" ]; then
echo 'std has changed, rebuilding...'
build
fi
if [ "$1" != "--build-only" ]; then
./joker "$@"
fi