-
Notifications
You must be signed in to change notification settings - Fork 807
/
buildall.sh
executable file
·147 lines (124 loc) · 3.63 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
#!/usr/bin/env bash
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# run buildall.sh -help to see options
root=`dirname "$0"`
root=`cd "$root"; pwd`
export IMPALA_HOME=$root
export METASTORE_DB=`basename $root | sed -e "s/\\./_/g" | sed -e "s/[.-]/_/g"`
export CURRENT_USER=`whoami`
. "$root"/bin/impala-config.sh
clean_action=1
testdata_action=1
tests_action=1
metastore_is_derby=0
FORMAT_CLUSTER=1
TARGET_BUILD_TYPE=Debug
TEST_EXECUTION_MODE=reduced
if [[ ${METASTORE_IS_DERBY} ]]; then
metastore_is_derby=1
fi
# Exit on reference to uninitialized variable
set -u
# parse command line options
for ARG in $*
do
case "$ARG" in
-noclean)
clean_action=0
;;
-notestdata)
testdata_action=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
;;
-testexhaustive)
TEST_EXECUTION_MODE=exhaustive
;;
-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 the minicluster from formatting its data directories,"\
"and skips the data load step"
echo "[-codecoverage] : build with 'gcov' code coverage instrumentation at the"\
"cost of performance"
echo "[-skiptests] : skips execution of all tests"
echo "[-testexhaustive] : run tests in 'exhaustive' mode (significantly increases"\
"test execution time)"
exit 1
;;
esac
done
# 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/hbase-site.xml
rm -f src/test/resources/hive-site.xml
rm -rf src/generated-sources/*
rm -f derby.log
# clean be
cd $IMPALA_HOME/be
# remove everything listed in .gitignore
git clean -Xdf
# clean llvm
rm $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
# cleanup FE process
$IMPALA_HOME/bin/clean-fe-processes.py
# 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
# 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
cd $IMPALA_FE_DIR
if [ $metastore_is_derby -eq 1 ]
then
echo "Cleaning up locks from previous test runs for derby for metastore"
ls target/test_metastore_db/*.lck
rm -f target/test_metastore_db/{db,dbex}.lck
fi
mvn exec:java -Dexec.mainClass=com.cloudera.impala.testutil.PlanService \
-Dexec.classpathScope=test &
PID=$!
${IMPALA_HOME}/bin/run-backend-tests.sh
kill $PID
fi
# Build the shell tarball
echo "Creating shell tarball"
${IMPALA_HOME}/shell/make_shell_tarball.sh
# Generate list of files for Cscope to index
$IMPALA_HOME/bin/gen-cscope.sh