Version v0.3.19 - Completed modularization project
This commit is contained in:
43
build.sh
43
build.sh
@@ -16,18 +16,31 @@ print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
# Global variable for commit message
|
||||
COMMIT_MESSAGE=""
|
||||
|
||||
# Parse command line arguments for -m flag
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-m|--message)
|
||||
COMMIT_MESSAGE="$2"
|
||||
shift 2
|
||||
# Parse command line arguments - check if first arg is a command, otherwise treat as commit message
|
||||
COMMAND=""
|
||||
if [[ $# -gt 0 ]]; then
|
||||
case "$1" in
|
||||
build|clean|install|uninstall)
|
||||
COMMAND="$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# Keep other arguments for main logic
|
||||
break
|
||||
# First argument is not a command, so default to build and treat all args as commit message
|
||||
COMMAND="build"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# No arguments, default to build
|
||||
COMMAND="build"
|
||||
fi
|
||||
|
||||
# Any remaining arguments become the commit message
|
||||
for arg in "$@"; do
|
||||
if [[ -z "$COMMIT_MESSAGE" ]]; then
|
||||
COMMIT_MESSAGE="$arg"
|
||||
else
|
||||
COMMIT_MESSAGE="$COMMIT_MESSAGE $arg"
|
||||
fi
|
||||
done
|
||||
|
||||
# Function to automatically increment version
|
||||
@@ -321,7 +334,7 @@ uninstall_project() {
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
case "${1:-build}" in
|
||||
case "$COMMAND" in
|
||||
build)
|
||||
build_project
|
||||
;;
|
||||
@@ -336,10 +349,11 @@ case "${1:-build}" in
|
||||
;;
|
||||
*)
|
||||
echo "OTP Cipher Build Script"
|
||||
echo "Usage: $0 [-m \"commit message\"] {build|clean|install|uninstall}"
|
||||
echo "Usage: $0 [command] [commit message]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -m, --message \"text\" - Specify commit message (skips interactive prompt)"
|
||||
echo "Arguments:"
|
||||
echo " command - {build|clean|install|uninstall} (default: build)"
|
||||
echo " commit message - Text to use as commit message (optional, skips interactive prompt)"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " build - Cross-compile for x86_64 and ARM64/AArch64 with automatic version increment (default)"
|
||||
@@ -357,8 +371,9 @@ case "${1:-build}" in
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0"
|
||||
echo " $0 -m \"Fixed checksum parsing bug\""
|
||||
echo " $0 --message \"Added new feature\" build"
|
||||
echo " $0 \"Fixed checksum parsing bug\""
|
||||
echo " $0 build \"Added new feature\""
|
||||
echo " $0 clean"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user