forked from KarthikTunga/impala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildall.sh
executable file
·192 lines (166 loc) · 5.11 KB
/
buildall.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/usr/bin/env bash
# Copyright 2012 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# run buildall.sh -help to see options
ROOT=`dirname "$0"`
ROOT=`cd "$ROOT"; pwd`
export IMPALA_HOME=$ROOT
. "$ROOT"/bin/impala-config.sh
CLEAN_ACTION=1
TESTDATA_ACTION=1
TESTS_ACTION=1
FORMAT_CLUSTER=1
TARGET_BUILD_TYPE=Debug
EXPLORATION_STRATEGY=core
SNAPSHOT_FILE=
# Exit on reference to uninitialized variable
set -u
# Exit on non-zero return value
set -e
# parse command line options
for ARG in $*
do
# Interpret this argument as a snapshot file name
if [ "$SNAPSHOT_FILE" = "UNDEFINED" ]; then
SNAPSHOT_FILE="$ARG"
continue;
fi
case "$ARG" in
-noclean)
CLEAN_ACTION=0
;;
-notestdata)
TESTDATA_ACTION=0
FORMAT_CLUSTER=0
;;
-skiptests)
TESTS_ACTION=0
;;
-noformat)
FORMAT_CLUSTER=0
;;
-codecoverage_debug)
TARGET_BUILD_TYPE=CODE_COVERAGE_DEBUG
;;
-codecoverage_release)
TARGET_BUILD_TYPE=CODE_COVERAGE_RELEASE
;;
-testpairwise)
EXPLORATION_STRATEGY=pairwise
;;
-testexhaustive)
EXPLORATION_STRATEGY=exhaustive
;;
-snapshot_file)
SNAPSHOT_FILE="UNDEFINED"
;;
-help|*)
echo "buildall.sh [-noclean] [-notestdata] [-noformat] [-codecoverage]"\
"[-skiptests] [-testexhaustive]"
echo "[-noclean] : omits cleaning all packages before building"
echo "[-notestdata] : omits recreating the metastore and loading test data"
echo "[-noformat] : prevents formatting the minicluster and metastore db"
echo "[-codecoverage] : build with 'gcov' code coverage instrumentation at the"\
"cost of performance"
echo "[-skiptests] : skips execution of all tests"
echo "[-testpairwise] : run tests in 'pairwise' mode (increases"\
"test execution time)"
echo "[-testexhaustive] : run tests in 'exhaustive' mode (significantly increases"\
"test execution time)"
echo "[-snapshot_file <file name>] : load test data from a snapshot file"
exit 1
;;
esac
done
if [ "$SNAPSHOT_FILE" = "UNDEFINED" ]; then
echo "-snapshot_file flag requires a snapshot filename argument"
exit 1
elif [ "$SNAPSHOT_FILE" != "" ] && [ ! -e $SNAPSHOT_FILE ]; then
echo "Snapshot file: ${SNAPSHOT_FILE} does not exist."
exit 1
fi
# Sanity check that thirdparty is built.
if [ ! -e $IMPALA_HOME/thirdparty/gflags-${IMPALA_GFLAGS_VERSION}/libgflags.la ]
then
echo "Couldn't find thirdparty build files. Building thirdparty."
$IMPALA_HOME/bin/build_thirdparty.sh $*
fi
if [ -e $HADOOP_LZO/build/native/Linux-*-*/lib/libgplcompression.so ]
then
cp $HADOOP_LZO/build/native/Linux-*-*/lib/libgplcompression.* \
$IMPALA_HOME/thirdparty/hadoop-*/lib/native/
else
echo "No hadoop-lzo found"
fi
# option to clean everything first
if [ $CLEAN_ACTION -eq 1 ]
then
# clean selected files from the root
rm -f CMakeCache.txt
# clean fe
# don't use git clean because we need to retain Eclipse conf files
cd $IMPALA_FE_DIR
rm -rf target
rm -f src/test/resources/{core,hbase,hive}-site.xml
rm -rf generated-sources/*
# clean be
cd $IMPALA_HOME/be
# remove everything listed in .gitignore
git clean -Xdf
# clean shell build artifacts
cd $IMPALA_HOME/shell
# remove everything listed in .gitignore
git clean -Xdf
# clean llvm
rm -f $IMPALA_HOME/llvm-ir/impala*.ll
# Cleanup the version.info file so it will be regenerated for the next build.
rm -f $IMPALA_HOME/bin/version.info
fi
# Kill any processes that may be accessing postgres metastore
# TODO: figure out how to make postgres ignore other users
${IMPALA_HOME}/testdata/bin/kill-all.sh
# Generate the Hadoop configs needed by Impala
if [ $FORMAT_CLUSTER -eq 1 ]; then
${IMPALA_HOME}/bin/create-test-configuration.sh -create_metastore
else
${IMPALA_HOME}/bin/create-test-configuration.sh
fi
# build common and backend
cd $IMPALA_HOME
bin/gen_build_version.py
cmake -DCMAKE_BUILD_TYPE=$TARGET_BUILD_TYPE .
cd $IMPALA_HOME/common/function-registry
make
cd $IMPALA_HOME/common/thrift
make
cd $IMPALA_BE_DIR
make -j4
if [ -e $IMPALA_LZO ]
then
(cd $IMPALA_LZO; cmake .; make)
fi
# Get Hadoop dependencies onto the classpath
cd $IMPALA_FE_DIR
mvn dependency:copy-dependencies
# build frontend
# Package first since any test failure will prevent the package phase from completing.
# We need to do this before loading data so that hive can see the trevni input/output
# classes.
mvn package -DskipTests=true
if [ $TESTS_ACTION -eq 1 ]
then
${IMPALA_HOME}/bin/run-all-tests.sh -e $EXPLORATION_STRATEGY
fi
# Generate list of files for Cscope to index
$IMPALA_HOME/bin/gen-cscope.sh