-
Notifications
You must be signed in to change notification settings - Fork 264
/
Copy pathbuild.sh
executable file
·49 lines (42 loc) · 1.16 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
#!/usr/bin/env bash
set -euxo pipefail
# Define default commands
COMPILE_CMD="./mvnw compile"
PACKAGE_CMD="./mvnw package -DskipTests -pl logbook-servlet -am"
VERIFY_CMD="./mvnw verify -B"
INSTALL_CMD="./mvnw install -DskipTests -Djacoco.skip=true"
# Flags to track selected options
COMPILE=false
NO_TEST_INSTALL=false
PACKAGE=false
# Parse options
while [[ "$#" -gt 0 ]]; do
case $1 in
--package|-p) PACKAGE=true ;;
--compile|-c) COMPILE=true ;;
--no-test-install|-i) NO_TEST_INSTALL=true ;;
-ci|-ic) COMPILE=true; NO_TEST_INSTALL=true ;;
-cp|-pc) PACKAGE=true; COMPILE=true ;;
-ip|-pi) PACKAGE=true; NO_TEST_INSTALL=true ;;
*) echo "Unknown option: $1"; exit 1 ;;
esac
shift
done
# Execute commands based on the flags
if $PACKAGE; then
echo "Running package..."
eval "$PACKAGE_CMD"
fi
if $COMPILE; then
echo "Running compile..."
eval "$COMPILE_CMD"
fi
if $NO_TEST_INSTALL; then
echo "Running install without tests..."
eval "$INSTALL_CMD"
fi
if ! $COMPILE && ! $NO_TEST_INSTALL && ! $PACKAGE; then
echo "Running default commands..."
eval "$PACKAGE_CMD"
eval "$VERIFY_CMD"
fi