Created
November 17, 2024 22:20
-
-
Save msdousti/3cdd9e4d008606f4cc213e4ca7762236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo 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 | |
# Parse options | |
while [[ "$#" -gt 0 ]]; do | |
case $1 in | |
--compile|-c) COMPILE=true ;; | |
--no-test-install|-i) NO_TEST_INSTALL=true ;; | |
-ci|-ic) COMPILE=true; NO_TEST_INSTALL=true ;; | |
*) echo "Unknown option: $1"; exit 1 ;; | |
esac | |
shift | |
done | |
# Execute commands based on the flags | |
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; then | |
echo "Running default commands..." | |
eval "$PACKAGE_CMD" | |
eval "$VERIFY_CMD" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment