Repository navigation
Expand file tree
/
Copy pathauron-build.sh
More file actions
executable file
·242 lines (229 loc) · 7.4 KB
/
Copy pathauron-build.sh
File metadata and controls
executable file
·242 lines (229 loc) · 7.4 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
# Function to display script usage
print_help() {
echo "Usage: $0 [OPTIONS] <maven build options>"
echo "Build Auron project with specified Maven profiles"
echo
echo "Options:"
echo " --docker <true|false> Build in Docker with CentOS7 (default: false)"
echo " --pre Activate pre-release profile"
echo " --release Activate release profile"
echo " --sparkver <VERSION> Specify Spark version (e.g. 3.0/3.1/3.2/3.3/3.4/3.5)"
echo " --scalaver <VERSION> Specify Scala version (e.g. 2.12/2.13)"
echo " --celeborn <VERSION> Specify Celeborn version (e.g. 0.5/0.6)"
echo " --uniffle <VERSION> Specify Uniffle version (e.g. 0.9)"
echo " --paimon <VERSION> Specify Paimon version (e.g. 1.2)"
echo " --clean <true|false> Clean before build (default: true)"
echo " --skiptests <true|false> Skip unit tests (default: true)"
echo " -h, --help Show this help message"
echo
echo "Examples:"
echo " $0 --pre --sparkver 3.5 --scalaver 2.12 -DskipBuildNative"
echo " $0 --docker true --clean true --skiptests true --release --sparkver 3.5 --scalaver 2.12 --celeborn 0.5 --uniffle 0.9 --paimon 1.2"
exit 0
}
MVN_CMD="$(dirname "$0")/build/mvn"
# Initialize variables
USE_DOCKER=false
PRE_PROFILE=false
RELEASE_PROFILE=false
CLEAN=true
SKIP_TESTS=true
SPARK_VER=""
SCALA_VER=""
CELEBORN_VER=""
UNIFFLE_VER=""
PAIMON_VER=""
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--pre)
PRE_PROFILE=true
shift
;;
--release)
RELEASE_PROFILE=true
shift
;;
--docker)
if [[ -n "$2" && "$2" =~ ^(true|false)$ ]]; then
USE_DOCKER="$2"
shift 2
else
echo "ERROR: --docker requires true/false" >&2
exit 1
fi
;;
--clean)
if [[ -n "$2" && "$2" =~ ^(true|false)$ ]]; then
CLEAN="$2"
shift 2
else
echo "ERROR: --clean requires true/false" >&2
exit 1
fi
;;
--skiptests)
if [[ -n "$2" && "$2" =~ ^(true|false)$ ]]; then
SKIP_TESTS="$2"
shift 2
else
echo "ERROR: --skiptests requires true/false" >&2
exit 1
fi
;;
--sparkver)
if [[ -n "$2" && "$2" != -* ]]; then
SPARK_VER="$2"
shift 2
else
echo "ERROR: --sparkver requires version argument" >&2
exit 1
fi
;;
--scalaver)
if [[ -n "$2" && "$2" != -* ]]; then
SCALA_VER="$2"
shift 2
else
echo "ERROR: --scalaver requires version argument" >&2
exit 1
fi
;;
--celeborn)
if [[ -n "$2" && "$2" != -* ]]; then
CELEBORN_VER="$2"
shift 2
else
echo "ERROR: --celeborn requires version argument" >&2
exit 1
fi
;;
--uniffle)
if [[ -n "$2" && "$2" != -* ]]; then
UNIFFLE_VER="$2"
shift 2
else
echo "ERROR: --uniffle requires version argument" >&2
exit 1
fi
;;
--paimon)
if [[ -n "$2" && "$2" != -* ]]; then
PAIMON_VER="$2"
shift 2
else
echo "ERROR: --paimon requires version argument" >&2
exit 1
fi
;;
-h|--help)
print_help
;;
--*)
echo "ERROR: Unknown option '$1'" >&2
echo "Use '$0 --help' for usage information" >&2
exit 1
;;
-*)
break
;;
*)
echo "ERROR: $1 is not supported" >&2
echo "Use '$0 --help' for usage information" >&2
exit 1
;;
esac
done
# Validate required options
MISSING_REQUIREMENTS=()
if [[ "$PRE_PROFILE" == false && "$RELEASE_PROFILE" == false ]]; then
MISSING_REQUIREMENTS+=("--pre or --release must be specified")
fi
if [[ -z "$SPARK_VER" ]]; then
MISSING_REQUIREMENTS+=("--sparkver must be specified")
fi
if [[ -z "$SCALA_VER" ]]; then
MISSING_REQUIREMENTS+=("--scalaver must be specified")
fi
if [[ "${#MISSING_REQUIREMENTS[@]}" -gt 0 ]]; then
echo "ERROR: Missing required arguments:" >&2
for req in "${MISSING_REQUIREMENTS[@]}"; do
echo " * $req" >&2
done
echo
echo "Use '$0 --help' for usage information" >&2
exit 1
fi
if [[ "$PRE_PROFILE" == true && "$RELEASE_PROFILE" == true ]]; then
echo "ERROR: Cannot use both --pre and --release simultaneously" >&2
exit 1
fi
# Compose build args
CLEAN_ARGS=()
if [[ "$CLEAN" == true ]]; then
CLEAN_ARGS+=("clean")
fi
BUILD_ARGS=()
if [[ "$SKIP_TESTS" == true ]]; then
BUILD_ARGS+=("package" "-DskipTests")
else
BUILD_ARGS+=("package")
fi
if [[ "$PRE_PROFILE" == true ]]; then
BUILD_ARGS+=("-Ppre")
fi
if [[ "$RELEASE_PROFILE" == true ]]; then
BUILD_ARGS+=("-Prelease")
fi
if [[ -n "$SPARK_VER" ]]; then
BUILD_ARGS+=("-Pspark-$SPARK_VER")
fi
if [[ -n "$SCALA_VER" ]]; then
BUILD_ARGS+=("-Pscala-$SCALA_VER")
fi
if [[ -n "$CELEBORN_VER" ]]; then
BUILD_ARGS+=("-Pceleborn,celeborn-$CELEBORN_VER")
fi
if [[ -n "$UNIFFLE_VER" ]]; then
BUILD_ARGS+=("-Puniffle,uniffle-$UNIFFLE_VER")
fi
if [[ -n "$PAIMON_VER" ]]; then
BUILD_ARGS+=("-Ppaimon,paimon-$PAIMON_VER")
fi
MVN_ARGS=("${CLEAN_ARGS[@]}" "${BUILD_ARGS[@]}")
# Execute Maven command
if [[ "$USE_DOCKER" == true ]]; then
# In Docker mode, use multi-threaded Maven build with -T8 for faster compilation
BUILD_ARGS+=("-T8")
if [[ "$CLEAN" == true ]]; then
# Clean the host-side directory that is mounted into the Docker container.
# This avoids "device or resource busy" errors when running `mvn clean` inside the container.
echo "[INFO] Docker mode: manually cleaning target-docker contents..."
rm -rf ./target-docker/* || echo "[WARN] Failed to clean target-docker/*"
fi
echo "[INFO] Compiling inside Docker container..."
export AURON_BUILD_ARGS="${BUILD_ARGS[*]}"
exec docker-compose -f dev/docker-build/docker-compose.yml up --abort-on-container-exit
else
echo "[INFO] Compiling locally with maven args: $MVN_CMD ${MVN_ARGS[@]} $@"
"$MVN_CMD" "${MVN_ARGS[@]}" "$@"
fi