From 1778336ea1a83d310a07976c19f9b64a3e560966 Mon Sep 17 00:00:00 2001 From: partisan Date: Thu, 18 Jul 2024 14:48:06 +0200 Subject: [PATCH] added debug echos --- builder.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/builder.sh b/builder.sh index 45c685f..09913e0 100755 --- a/builder.sh +++ b/builder.sh @@ -6,8 +6,8 @@ PATCHES_DIR="$SOURCE_PATH/Spitfire" SOURCE_REPO="https://hg.mozilla.org/mozilla-central" PATCHES_REPO="https://weforgecode.xyz/Spitfire/Browser.git" -SOURCE_PATH=$(realpath "$SOURCE_PATH") -PATCHES_DIR=$(realpath "$PATCHES_DIR") +SOURCE_PATH=$(realpath "$SOURCE_PATH") || { echo "Failed to resolve SOURCE_PATH. Exiting."; exit 1; } +PATCHES_DIR=$(realpath "$PATCHES_DIR") || { echo "Failed to resolve PATCHES_DIR. Exiting."; exit 1; } # Function to download Mozilla source if not present download_source() { @@ -22,14 +22,14 @@ download_source() { # Function to discard uncommitted changes discard_changes() { echo "Discarding uncommitted changes..." - hg revert --all --no-backup -R "$SOURCE_PATH" + hg revert --all --no-backup -R "$SOURCE_PATH" || { echo "Failed to revert changes in Mozilla repository. Exiting."; exit 1; } } # Function to clean build clean_build() { echo "Cleaning build..." cd "$SOURCE_PATH" || { echo "Failed to navigate to source directory. Exiting."; exit 1; } - hg revert --all --no-backup || { echo "Failed to reverse cahnges in Mozilla repository. Exiting."; exit 1; } + hg revert --all --no-backup || { echo "Failed to revert changes in Mozilla repository. Exiting."; exit 1; } ./mach clobber || { echo "Failed to clean build. Exiting."; exit 1; } } @@ -57,13 +57,17 @@ update_patches() { rsync -av --exclude='.git' "$PATCHES_DIR/" "$SOURCE_PATH/" || { echo "Failed to copy files. Exiting."; exit 1; } } -# Function to configure and build Spitfire -configure_and_build() { +# Function to configure Spitfire +configure() { echo "Configuring Spitfire..." cd "$SOURCE_PATH" || { echo "Failed to navigate to source directory. Exiting."; exit 1; } ./mach configure || { echo "Configuration failed. Exiting."; exit 1; } +} +# Function to build Spitfire +build() { echo "Building Spitfire..." + cd "$SOURCE_PATH" || { echo "Failed to navigate to source directory. Exiting."; exit 1; } ./mach build || { echo "Build failed. Exiting."; exit 1; } } @@ -85,7 +89,7 @@ print_help() { echo " -p, --patches : Update patches" echo " -r, --run : Run the project after build using mach run in the browser directory" echo " -h, --help : Display this help message" - exit 1 + exit 0 } # Parse command line arguments @@ -128,13 +132,15 @@ if [ "$all" = true ]; then clean_build update_repo update_patches - configure_and_build + configure + build if [ "$run" = true ]; then run_project fi echo "Spitfire build completed successfully." elif [ "$build" = true ]; then - configure_and_build + configure + build if [ "$run" = true ]; then run_project fi