forked from gradle/oreilly-gradle-book-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-all-builds.bsh
executable file
·57 lines (50 loc) · 1.62 KB
/
test-all-builds.bsh
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
#!/bin/bash
echo "############################################################"
echo "# GRADLE BOOK EXAMPLES TEST HARNESS"
echo ""
echo "# Option flag usage:"
echo "# --neverfail"
echo "# Don't stop the build if a project returns an error code."
echo "#"
echo "# --clean"
echo "# Run 'gradle clean' instead of the run-example.bsh"
echo "# script in each project."
echo "############################################################"
echo ""
sleep 2
for i in `find . ! -iname ".gradle" ! -iname ".git" -type d -depth 1`
do
pushd $i
if test "$1" == "--clean"
then
gradle clean
else
run-example.bsh
# Test for failure
BUILD_RESULT="$?"
echo ""
echo " +++++++++++++++++++++++++++++++++++++"
echo " SCRIPTED BUILD RESULT: $BUILD_RESULT"
echo " +++++++++++++++++++++++++++++++++++++"
echo ""
if test "$BUILD_RESULT" != "0"
then
echo "**********************************************************************"
echo "* A sub-build in:"
echo "* $PWD"
echo "* has FAILED."
if test "$1" == "--neverfail"
then
echo "* Build is CONTINUING anyway per the -neverfail flag."
echo "**********************************************************************"
echo ""
sleep 4
else
echo "* Build has been halted."
echo "**********************************************************************"
exit 1
fi
fi
fi
popd
done