Improved build script.
This commit is contained in:
parent
613d3891be
commit
3740992dd1
1 changed files with 16 additions and 98 deletions
106
build.sh
106
build.sh
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
function help
|
||||
{
|
||||
echo "StatoolInfos build script."
|
||||
echo "Kiss4web build script."
|
||||
echo "Usage: build.sh [ -h | -help | --help | -snapshot | -local | -full ]"
|
||||
echo " -h, -help, --help display this help."
|
||||
echo " -snapshot, --snapshot build a snapshot."
|
||||
|
@ -15,93 +15,9 @@ function help
|
|||
}
|
||||
|
||||
#
|
||||
# Build snapshot.
|
||||
# Check env.
|
||||
#
|
||||
function build_snapshot
|
||||
{
|
||||
okCount=0
|
||||
|
||||
# Ant check.
|
||||
antCheck=`which ant`
|
||||
if [[ "$antCheck" =~ ^/.* ]]; then
|
||||
echo "Ant requirement................ OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Ant requirement................ MISSING"
|
||||
fi
|
||||
|
||||
# Javac check.
|
||||
javacCheck=`which javac`
|
||||
if [[ "$javacCheck" =~ ^/.* ]]; then
|
||||
echo "Javac requirement.............. OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Javac requirement.............. MISSING"
|
||||
fi
|
||||
|
||||
# Java version check.
|
||||
javaVersionCheck=`javac -version 2>&1`
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
|
||||
echo "Java 11 version requirement..... OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Java 11 version requirement..... MISSING"
|
||||
fi
|
||||
|
||||
if [ "$okCount" == 3 ]; then
|
||||
echo "Requirement OK"
|
||||
ant -f build-snapshot.xml
|
||||
else
|
||||
echo "Requirement MISSING, build abort"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Build local.
|
||||
#
|
||||
function build_local
|
||||
{
|
||||
okCount=0
|
||||
|
||||
# Ant check.
|
||||
antCheck=`which ant`
|
||||
if [[ "$antCheck" =~ ^/.* ]]; then
|
||||
echo "Ant requirement................ OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Ant requirement................ MISSING"
|
||||
fi
|
||||
|
||||
# Javac check.
|
||||
javacCheck=`which javac`
|
||||
if [[ "$javacCheck" =~ ^/.* ]]; then
|
||||
echo "Javac requirement.............. OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Javac requirement.............. MISSING"
|
||||
fi
|
||||
|
||||
# Java version check.
|
||||
javaVersionCheck=`javac -version 2>&1`
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
|
||||
echo "Java 11 version requirement..... OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Java 11 version requirement..... MISSING"
|
||||
fi
|
||||
|
||||
if [ "$okCount" == 3 ]; then
|
||||
echo "Requirement OK"
|
||||
ant -f build-local.xml
|
||||
else
|
||||
echo "Requirement MISSING, build abort"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Build tagandpush.
|
||||
#
|
||||
function build_tagandpush
|
||||
function check_env
|
||||
{
|
||||
okCount=0
|
||||
|
||||
|
@ -143,26 +59,28 @@ function build_tagandpush
|
|||
|
||||
if [ "$okCount" == 4 ]; then
|
||||
echo "Requirement OK"
|
||||
ant -f build-tagandpush.xml
|
||||
else
|
||||
echo "Requirement MISSING, build abort"
|
||||
exit -1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Main.
|
||||
#
|
||||
if [ "$#" -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then
|
||||
help
|
||||
elif [ "$1" == "-snapshot" ] || [ "$1" == "--snapshot" ] ; then
|
||||
build_snapshot
|
||||
else
|
||||
check_env
|
||||
if [ "$1" == "-snapshot" ] || [ "$1" == "--snapshot" ] ; then
|
||||
ant -f build-snapshot.xml
|
||||
elif [ "$1" == "-local" ] || [ "$1" == "--local" ] ; then
|
||||
build_local
|
||||
ant -f build-local.xml
|
||||
elif [ "$1" == "-tagandpush" ] || [ "$1" == "--tagandpush" ] ; then
|
||||
build_tagandpush
|
||||
ant -f build-tagandpush.xml
|
||||
else
|
||||
echo "Invalid parameters."
|
||||
help
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue