added debug echos

This commit is contained in:
partisan 2024-07-18 14:48:06 +02:00
parent 541b5ba395
commit 1778336ea1

View file

@ -6,8 +6,8 @@ PATCHES_DIR="$SOURCE_PATH/Spitfire"
SOURCE_REPO="https://hg.mozilla.org/mozilla-central" SOURCE_REPO="https://hg.mozilla.org/mozilla-central"
PATCHES_REPO="https://weforgecode.xyz/Spitfire/Browser.git" PATCHES_REPO="https://weforgecode.xyz/Spitfire/Browser.git"
SOURCE_PATH=$(realpath "$SOURCE_PATH") SOURCE_PATH=$(realpath "$SOURCE_PATH") || { echo "Failed to resolve SOURCE_PATH. Exiting."; exit 1; }
PATCHES_DIR=$(realpath "$PATCHES_DIR") PATCHES_DIR=$(realpath "$PATCHES_DIR") || { echo "Failed to resolve PATCHES_DIR. Exiting."; exit 1; }
# Function to download Mozilla source if not present # Function to download Mozilla source if not present
download_source() { download_source() {
@ -22,14 +22,14 @@ download_source() {
# Function to discard uncommitted changes # Function to discard uncommitted changes
discard_changes() { discard_changes() {
echo "Discarding uncommitted 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 # Function to clean build
clean_build() { clean_build() {
echo "Cleaning build..." echo "Cleaning build..."
cd "$SOURCE_PATH" || { echo "Failed to navigate to source directory. Exiting."; exit 1; } 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; } ./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; } rsync -av --exclude='.git' "$PATCHES_DIR/" "$SOURCE_PATH/" || { echo "Failed to copy files. Exiting."; exit 1; }
} }
# Function to configure and build Spitfire # Function to configure Spitfire
configure_and_build() { configure() {
echo "Configuring Spitfire..." echo "Configuring Spitfire..."
cd "$SOURCE_PATH" || { echo "Failed to navigate to source directory. Exiting."; exit 1; } cd "$SOURCE_PATH" || { echo "Failed to navigate to source directory. Exiting."; exit 1; }
./mach configure || { echo "Configuration failed. Exiting."; exit 1; } ./mach configure || { echo "Configuration failed. Exiting."; exit 1; }
}
# Function to build Spitfire
build() {
echo "Building Spitfire..." echo "Building Spitfire..."
cd "$SOURCE_PATH" || { echo "Failed to navigate to source directory. Exiting."; exit 1; }
./mach build || { echo "Build failed. Exiting."; exit 1; } ./mach build || { echo "Build failed. Exiting."; exit 1; }
} }
@ -85,7 +89,7 @@ print_help() {
echo " -p, --patches : Update patches" echo " -p, --patches : Update patches"
echo " -r, --run : Run the project after build using mach run in the browser directory" echo " -r, --run : Run the project after build using mach run in the browser directory"
echo " -h, --help : Display this help message" echo " -h, --help : Display this help message"
exit 1 exit 0
} }
# Parse command line arguments # Parse command line arguments
@ -128,13 +132,15 @@ if [ "$all" = true ]; then
clean_build clean_build
update_repo update_repo
update_patches update_patches
configure_and_build configure
build
if [ "$run" = true ]; then if [ "$run" = true ]; then
run_project run_project
fi fi
echo "Spitfire build completed successfully." echo "Spitfire build completed successfully."
elif [ "$build" = true ]; then elif [ "$build" = true ]; then
configure_and_build configure
build
if [ "$run" = true ]; then if [ "$run" = true ]; then
run_project run_project
fi fi