diff --git a/README.md b/README.md index 37d4e1e..a7afa78 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Run the script `builder.sh` with the following options: - `-c, --clean` : Clean build. - `-u, --update` : Update Mozilla repository. - `-p, --patches` : Update patches. +- `-r, --run` : Run the project after build using mach run in the browser directory - `-h, --help` : Display usage instructions. For example: diff --git a/builder.sh b/builder.sh index b57e30f..5f59e4f 100755 --- a/builder.sh +++ b/builder.sh @@ -66,6 +66,13 @@ configure_and_build() { ./mach build || { echo "Build failed. Exiting."; exit 1; } } +# Function to run the project after build +run_project() { + echo "Running the project..." + cd "$SOURCE_PATH" || { echo "Failed to navigate to browser directory. Exiting."; exit 1; } + ./mach run || { echo "Failed to run the project. Exiting."; exit 1; } +} + # Function to print usage instructions print_help() { echo "Usage: ./builder.sh [options]" @@ -75,6 +82,7 @@ print_help() { echo " -c, --clean : Clean build" echo " -u, --update : Update Mozilla repository" 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 } @@ -98,6 +106,9 @@ while [[ $# -gt 0 ]]; do -p|--patches) patches=true ;; + -r|--run) + run=true + ;; -h|--help) print_help ;; @@ -117,9 +128,15 @@ if [ "$all" = true ]; then update_repo update_patches configure_and_build + if [ "$run" = true ]; then + run_project + fi echo "Spitfire build completed successfully." -if [ "$build" = true ]; then +elif [ "$build" = true ]; then configure_and_build + if [ "$run" = true ]; then + run_project + fi echo "Spitfire build completed successfully." elif [ "$clean" = true ]; then clean_build @@ -132,6 +149,8 @@ elif [ "$patches" = true ]; then download_source update_patches echo "Patches updated." +elif [ "$run" = true ]; then + run_project else print_help fi