-
Notifications
You must be signed in to change notification settings - Fork 8
/
fullBuild.sh
executable file
·111 lines (94 loc) · 3.09 KB
/
fullBuild.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
#!/usr/bin/env bash
set -e
arg_len=$#
all_args="$@"
args=""
skip_tools=n
remove_shadow="-x shadowJar"
shadow=${shadow:-$remove_shadow}
main_args="-Dxapi.composite=true -Pxapi.changing=true --parallel --build-cache -Pxapi.debug=false $shadow"
while (( arg_len > 0 )); do
arg_ind=$(( 1 + $# - arg_len ))
arg="${!arg_ind}"
case "$arg" in
--forcePublish|-fP)
echo "Forcing publishing"
all_args="${all_args/$arg}"
main_args="$main_args -PxapiForcePublish=true"
;;
--shadow|-s)
echo "Allowing shadow jar"
all_args="${all_args/$arg}"
main_args="${main_args/$remove_shadow}"
;;
--debug|-d)
set -o xtrace
;;
--main|-m)
if (( arg_ind == $# )); then
echo "Must provide an argument after --main"
exit 123
fi
next_arg=$(( arg_ind + 1 ))
to_main="${!next_arg}"
echo "Adding $to_main to main_args"
main_args="$main_args $to_main"
arg_len=$(( arg_len - 1 ))
;;
--no-tool|-nT)
echo "Skipping tool build"
skip_tools=y
;;
--java11|--jdk11|-j11)
echo "Java11 requested, skipping select incompatible groovy tasks"
main_args="$main_args -x :xapi-lang-test:compileTestGroovy -x :xapi-lang-test:compileGroovy"
# Hm... should really make this something portable
if [ -d /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64 ]; then
export JAVA_HOME=/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64
export PATH="$JAVA_HOME/bin:$(echo "$PATH" | sed -e "s/[^:]*adoptopenjdk[^:]*://g")"
fi
;;
*)
echo "Found pass-thru argument $arg"
args="$args $arg"
# Some special flags will cause us to erase some main_args
[[ "--no-build-cache" == "$arg" ]] && main_args="${main_args/ --build-cache}" || true
[[ "-Dxapi.composite=false" == "$arg" ]] && main_args="${main_args/-Dxapi.composite=true/-Dxapi.composite=false}" || true
;;
esac
arg_len=$(( arg_len - 1 ))
done
# Check if there are any more user-supplied arguments that we didn't handle, and insert default task list:
function has_args() {
if [[ -z "$args" ]]; then
return 1
fi
return 0
}
has_args || args="build xapiPublish testClasses -x test -x check"
echo "Running all builds' gradlew $args"
echo "Running main build w/ arguments: $main_args $args"
function do_it() {
if [ "$skip_tools" == n ]; then
pushd net.wti.core > /dev/null
echo "invoking ./gradlew $args in $(pwd)"
./gradlew $args
popd > /dev/null
pushd net.wti.gradle.modern > /dev/null
echo "invoking ./gradlew $args in $(pwd)"
./gradlew $args
popd > /dev/null
pushd net.wti.gradle.tools > /dev/null
# the tools will install themselves to local repo whenever we build them.
echo "invoking ./gradlew $args in $(pwd)"
./gradlew $args
popd > /dev/null
pushd net.wti.gradle > /dev/null
echo "invoking ./gradlew $args in $(pwd)"
./gradlew $args
popd > /dev/null
fi
./gradlew $main_args $args
}
TIMEFORMAT='Full build time: %3Rs'
time do_it