forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 62
/
build
executable file
·119 lines (110 loc) · 3.46 KB
/
build
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
#!/bin/sh
#
# 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.
#
set -eu
cd "$(dirname "$0")"
export MAVEN_OPTS="\
-Xms2g \
-Xmx2g \
-XX:+UseG1GC \
-XX:InitiatingHeapOccupancyPercent=45 \
-XX:+UseStringDeduplication \
-XX:-TieredCompilation \
-XX:TieredStopAtLevel=1 \
-Dmaven.build.cache.enabled=true \
-Dmaven.build.cache.lazyRestore=true \
-Dmaven.compiler.useIncrementalCompilation=false \
-Dmaven.test.skip=true \
-Dcheckstyle.skip=true \
-Dcheckstyle_unix.skip=true \
-Drat.skip=true \
-Dmaven.javadoc.skip=true
"
CMD="./mvnw -e --batch-mode --no-snapshot-updates --fail-fast -T 2C"
ARGS=""
MODULES=""
PROFILES="sources,skip-spotless"
DEFAULT_MODULES="dubbo-distribution/dubbo-all,dubbo-spring-boot/dubbo-spring-boot-starter"
print_help() {
echo "Usage: $0 [options]"
echo "Fast local compilation with incremental build and caching"
echo "Options:"
echo " -c Execute clean goal (removes build artifacts)"
echo " -p Execute compile goal (compiles the source code)"
echo " -i Execute install goal (builds and installs the project)"
echo " -t Execute test goal (runs the tests)"
echo " -s Execute spotless:apply (format the code)"
echo " -d Execute dependency:tree (displays the dependency tree)"
echo " -m Specify modules, default is $DEFAULT_MODULES"
echo " -f Specify profiles, default is $PROFILES"
echo " -h Display this help message"
echo ""
echo "Examples:"
echo " $0 Execute install goal compilation"
echo " $0 -m Execute a minimal compilation"
echo " $0 -ci Execute clean, install goals compilation"
echo " $0 -s Execute spotless:apply"
echo " $0 -d Display the dependency tree"
echo " $0 -t -m dubbo-config Execute test goal for dubbo-config module"
echo " $0 -cp -m dubbo-common Execute clean, compile the dubbo-common module"
exit 0
}
while getopts ":cpitstdm:f:h" opt; do
case $opt in
c)
ARGS="$ARGS clean"
;;
p)
ARGS="$ARGS compile"
;;
i)
ARGS="$ARGS install"
;;
t)
ARGS="$ARGS test"
export MAVEN_OPTS=$(echo "$MAVEN_OPTS" | sed 's/-Dmaven\.test\.skip=true/-Dmaven.test.skip=false/')
;;
s)
ARGS="$ARGS spotless:apply"
PROFILES="sources"
;;
d)
ARGS="$ARGS dependency:tree"
;;
m)
MODULES=" -pl $OPTARG -am"
;;
f)
PROFILES="$OPTARG"
;;
h)
print_help
;;
*)
if [ "$OPTARG" = "m" ]; then
MODULES=" -pl $DEFAULT_MODULES -am"
else
ARGS="$ARGS $@"
fi
;;
esac
done
if [ -z "$ARGS" ] ; then
ARGS=" install"
fi
set -x
$CMD$ARGS$MODULES -P $PROFILES