-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathbuild.sh
executable file
·115 lines (102 loc) · 2.73 KB
/
build.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
#!/usr/bin/env bash
# Usage: ./build.sh
# MAX_WORKERS=6 SKIP_TESTS=true ./build.sh
set -euo pipefail
# Shell Colour constants for use in 'echo -e'
# e.g. echo -e "My message ${GREEN}with just this text in green${NC}"
# shellcheck disable=SC2034
{
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
NC='\033[0m' # No Colour
}
# -Dorg.gradle.caching=true
GRADLE_ARGS=(
"-Dorg.gradle.daemon=true"
"-Dorg.gradle.parallel=true"
"-Dorg.gradle.workers.max=${MAX_WORKERS:-24}"
"-Dorg.gradle.configureondemand=true"
)
GWT_ARGS=(
"-PgwtCompilerWorkers=5"
"-PgwtCompilerMinHeap=50M"
"-PgwtCompilerMaxHeap=4G"
)
main() {
echo -e "${GREEN}Clean${NC}"
./gradlew \
"${GRADLE_ARGS[@]}" \
clean
if [[ "${SKIP_TESTS:-false}" = true ]]; then
echo -e "${YELLOW}Skipping tests${NC}"
test_args=( "-x" "test" )
else
test_args=( "test" )
fi
# Do the gradle build
# Use custom gwt compile jvm settings to avoid blowing the ram limit in
# travis. At time of writing a sudo VM in travis has 7.5gb ram.
# Each work will chew up the maxHeap value and we have to allow for
# our docker services as well.
# Don't clean as this is a fresh clone and clean will wipe the cached
# content pack zips
echo -e "${GREEN}Do the basic java build${NC}"
./gradlew \
"${GRADLE_ARGS[@]}" \
--scan \
--stacktrace \
-PdumpFailedTestXml=true \
-Pversion="${TRAVIS_TAG:-SNAPSHOT}" \
build \
"${test_args[@]}" \
-x shadowJar \
-x resolve \
-x copyFilesForStroomDockerBuild \
-x copyFilesForProxyDockerBuild \
-x buildDistribution
echo -e "${GREEN}Do the UI build${NC}"
./gradlew \
"${GRADLE_ARGS[@]}" \
--scan \
--stacktrace \
"${GWT_ARGS[@]}" \
stroom-app-gwt:gwtCompile \
stroom-dashboard-gwt:gwtCompile
## Compile the application GWT UI
#echo -e "${GREEN}Do the GWT app compile${NC}"
#./gradlew \
# "${GRADLE_ARGS[@]}" \
# --scan \
# --stacktrace \
# "${GWT_ARGS[@]}" \
# stroom-app-gwt:gwtCompile
#
## Compile the dashboard GWT UI
#echo -e "${GREEN}Do the GWT dashboard compile${NC}"
#./gradlew \
# "${GRADLE_ARGS[@]}" \
# --scan \
# --stacktrace \
# "${GWT_ARGS[@]}" \
# stroom-dashboard-gwt:gwtCompile
# Make the distribution.
echo -e "${GREEN}Build the distribution${NC}"
./gradlew \
"${GRADLE_ARGS[@]}" \
--scan \
--stacktrace \
-PdumpFailedTestXml=true \
-Pversion="${TRAVIS_TAG:-SNAPSHOT}" \
shadowJar \
buildDistribution \
copyFilesForStroomDockerBuild \
copyFilesForProxyDockerBuild \
-x test \
-x stroom-app-gwt:gwtCompile \
-x stroom-dashboard-gwt:gwtCompile
echo -e "${GREEN}Done${NC}"
}
# Get a time for the whole build
time main "$@"