-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·38 lines (35 loc) · 950 Bytes
/
build.sh
File metadata and controls
executable file
·38 lines (35 loc) · 950 Bytes
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
#!/usr/bin/env bash
set -ex
git restore --staged bin/jnc lib/jstdlib.o lib/jstdlib.jnh
git restore bin/jnc lib/jstdlib.o lib/jstdlib.jnh
NOW="$(date +%Y%m%d-%H%M%S)"
TAG="build-$NOW"
if git diff --quiet && git diff --staged --quiet; then
# working copy is clean
git tag $TAG
else
# working copy is dirty
git commit -am "for build: $NOW"
git tag $TAG
git reset --soft HEAD^
fi
git branch -f auto-build $TAG
# only keep the last few build tags
git tag --list 'build-*' \
| sort -nr \
| tail +20 \
| xargs git tag -d
make clean test all
rm bin/jnc lib/jstdlib.o lib/jstdlib.jnh
cp jnc/target/bin/jnc bin
cp jstdlib/target/lib/jstdlib.o lib
cp jstdlib/target/lib/jstdlib.jnh lib
if ! make clean test all not_quite_lisp; then
set +x
echo
echo "Failed to re-build"
echo
git restore --staged bin/jnc lib/jstdlib.o lib/jstdlib.jnh
git restore bin/jnc lib/jstdlib.o lib/jstdlib.jnh
exit 1
fi