-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·61 lines (51 loc) · 1.27 KB
/
build.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
#!/bin/bash
echo_blue(){ echo -e "\033[0;36m$*\033[0m"; }
show_usage(){
echo 'Usage: '$0' [test|package|install|deploy]'
echo
exit 1
}
check_stepup_utility(){
if ! type stepup &> /dev/null; then
echo 'StepUp command-line utility not found, please install it to continue'
echo
echo ' $ sudo gem install step-up'
echo
exit 1
fi
}
die() {
echo $1 && exit 1
}
set_project_version(){
mvn versions:set -DnewVersion="$1" --quiet
}
build(){
check_stepup_utility
local VERSION=`stepup --format mvn-snapshot`
local PROPS='-Dprop.engine.version.describe='$(git describe 2>/dev/null)
local propfile=".mvn$1"
if [ -f $propfile ]; then
if echo $VERSION | grep SNAPSHOT &> /dev/null; then
PROPS=$PROPS' '$(cat $propfile | grep -v '#release' | cut -d'#' -f1 | xargs echo)
else
PROPS=$PROPS' '$(cat $propfile | grep -v '#snapshot' | cut -d'#' -f1 | xargs echo)
fi
fi
echo
echo "+ Building all modules with version \"$VERSION\""
echo '----------'
echo_blue mvn clean $1 $PROPS
sleep .5
set_project_version $VERSION
mvn clean $1 $PROPS && mvn versions:revert --quiet && git checkout -- pom.xml
# find . -name \*.diff | xargs rm -f
}
case $1 in
test|package|install|deploy)
build $1
;;
*)
show_usage
;;
esac