-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathbuild.sh
executable file
·115 lines (97 loc) · 2.3 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
#################
#
# Show help and exit
#
#################
function show_help {
echo "Usage: $0 [-d] [-s] [-q] [-h]"
echo "-d - enable maven debugging"
echo "-s - skip test execution"
echo "-q - skip integration test execution"
echo ""
echo "To passthrough additional arguments straight to maven, enter '--' followed by the extra arguments"
exit 1
}
#
# This script should be executed from the directory
# it is located in. Try and stop alternatives
#
SCRIPT=`basename "$0"`
if [ ! -f $SCRIPT ]; then
echo "This script must be executed from the same directory it is located in"
exit 1
fi
#
# We must be in the same directory as the script so work
# out the root directory and find its absolute path
#
SCRIPT_DIR=`pwd`
echo "Script directory = $SCRIPT_DIR"
#
# Set root directory to be its parent since we are downloading
# lots of stuff and the relative path to the parent pom is
# ../build/parent/pom.xml
#
ROOT_DIR="$SCRIPT_DIR/.."
#
# By default debug is turned off
#
DEBUG=0
#
# Determine the command line options
#
while getopts ":dhsq" opt;
do
case $opt in
d) DEBUG=1 ;;
h) show_help ;;
s) SKIP=1 ;;
q) INT_SKIP=1 ;;
esac
done
shift "$(expr $OPTIND - 1)"
EXTRA_ARGS="$@"
#
# Source directory containing komodo codebase
# Should be the same directory as the build script location
#
SRC_DIR="${SCRIPT_DIR}"
#
# Maven repository to use.
# Ensure it only contains komodo related artifacts and
# does not clutter up user's existing $HOME/.m2 repository
#
#LOCAL_REPO="${ROOT_DIR}/m2-repository"
LOCAL_REPO="${HOME}/.m2/repository"
#
# Maven command
#
MVN="mvn clean install"
#
# Turn on dedugging if required
#
if [ "${DEBUG}" == "1" ]; then
MVN_FLAGS="-e -X -U"
fi
#
# Skip tests
#
if [ "${SKIP}" == "1" ]; then
SKIP_FLAG="-DskipTests"
INTEGRATION_SKIP_FLAG="-Dintegration.skipTests=true"
fi
if [ "${INT_SKIP}" == "1" ]; then
INTEGRATION_SKIP_FLAG="-Dintegration.skipTests=true"
fi
#
# Maven options
# -D maven.repo.local : Assign the $LOCAL_REPO as the target repository
#
MVN_FLAGS="${MVN_FLAGS} -s settings.xml -Dmaven.repo.local=${LOCAL_REPO} ${SKIP_FLAG} ${INTEGRATION_SKIP_FLAG}"
echo "==============="
# Build and test the komodo codebase
echo "Build and install the komodo plugins"
cd "${SRC_DIR}"
echo "Executing ${MVN} ${MVN_FLAGS} ${EXTRA_ARGS}"
${MVN} ${MVN_FLAGS} ${EXTRA_ARGS}