-
Notifications
You must be signed in to change notification settings - Fork 0
/
runme.sh
74 lines (62 loc) · 1.61 KB
/
runme.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
#!/bin/sh
dirty=$(git clean -n -d)
if [ ! -z "$dirty" ]; then
echo "This script will use git clean to remove these files."
echo $dirty
echo "Press Ctrl-C to abort; enter to continue"
read ok
fi
log () {
echo "=== $name: $@"
}
info () {
echo " ... $@"
}
verifyrename () {
if jar tf $jarfile | fgrep B.class > /dev/null; then
log "Post-rename build unexpectedly found B.class in $jarfile."
return 1
fi
log "Post-rename build correct"
return 0
}
verifydelete () {
# A failed build is all we ask
if [ $? = 0 ]; then
log "Post-delete build unexpectedly succeeded!"
return 1
fi
log "Delete build correct"
return 0
}
runtest () {
local action=$1
local name=$2
local build=$3
local jarfile=$4
info Pre-cleaning with git...
git clean -f -d > /dev/null
info Building...
$build > $name-pre$action.log 2>&1 || return 1
# This should simply succeed
info Testing $action and incremental building...
git checkout -q ${action}file
$build > $name-post$action.log 2>&1
eval verify${action}
status=$?
git checkout -q master
return $status
}
runtests () {
local name=$1
local build=$2
local jarfile=$3
if type -a $name > /dev/null; then
log "Testing $name ..."
runtest rename $name "$build" $jarfile
runtest delete $name "$build" $jarfile
fi
}
runtests mvn "mvn package" "target/java-build-test-1.0.0.jar"
runtests gradle "gradle build" "build/libs/java-build-test-1.0.0.jar"
runtests buildr "buildr package" "target/java-build-test-1.0.0.jar"