-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sh
executable file
·67 lines (58 loc) · 1.88 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
USAGE="
Usage:
./build.sh [build option]
Build options:
ol: If used, it customizes the stack for deployments that use the Open Liberty runtime.
wl: If used, it customizes the stack for deployments that use the WebSphere Liberty runtime.
all: If used, it customizes the stack for deployments that use both Open Liberty and WebSphere Liberty runtimes. This is the default if no argument is specified.
help: Displays usage information.
Example:
# Customize the stack for both Open Liberty and WebSphere Liberty deployments.
./build.sh
./buid.sh all
# Customize the stack for Open Liberty deployments.
./build.sh ol
# Customize the stack for WebSphere Liberty deployments.
./build.sh wl
# Display usage information.
./build.sh help
"
# main serves as the entry point for stack customization.
main() {
local runtimeType="$1"
local argCount="$#"
# Validate the input.
if [ "$argCount" -eq 0 ]; then
runtimeType="all"
elif [ "$argCount" -gt 1 ]; then
echo "ERROR: An invalid number of arguments were specified."
echo "$USAGE"
exit 1
fi
# Apply customizations and modify the stack artifacts based on the Liberty runtime type.
case "$runtimeType" in
ol)
source "$PWD"/customize-ol.env
. "$PWD"/tools/build/scripts/customize.sh ol
;;
wl)
source "$PWD"/customize-wl.env
. "$PWD"/tools/build/scripts/customize.sh wl
;;
all)
source "$PWD"/customize-ol.env
. "$PWD"/tools/build/scripts/customize.sh ol
source "$PWD"/customize-wl.env
. "$PWD"/tools/build/scripts/customize.sh wl
;;
help)
echo "$USAGE"
;;
*)
echo "ERROR: An invalid argument was specified: $runtimeType"
echo "$USAGE"
exit 1
;;
esac
}
main "$@"