From bc8a62666b7bf68de42754ad56a01f9dd0ec5048 Mon Sep 17 00:00:00 2001 From: partisan Date: Sat, 21 Dec 2024 22:02:29 +0100 Subject: [PATCH] removed need for '-p' flag --- README.md | 14 ++++++++++---- main.go | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6f3f331..ff19e26 100644 --- a/README.md +++ b/README.md @@ -37,15 +37,21 @@ Below is a detailed description of all the flags supported by the Spitfire Build ### **Build Process Flags** - **`-a`**: - Perform all steps of the build process, including cleaning, updating the repository, building, and applying patches. + Perform all steps of the build process, including cleaning, updating the repository, building, and applying patches. (Without uploading) - **`-b`**: Compiles the source code without cleaning or updating. - **`--clean`**: Cleans the build directory by removing temporary or cached files. +- **`--full-clean`**: + Performs a full clean by removing all build artifacts (clobber). - **`-u`**: Updates the Mozilla source repository to the latest revision using Mercurial (`hg pull`). -- **`--patches`**: - Applies custom patches to the source code. +- **`--pre-patch`**: + Applies pre-build patches to the source code. +- **`--post-patch`**: + Applies post-build patches to the built output. +- **`--skip-patch-update`**: + Skips updating the patches repository. - **`-r`**: Runs the built project after the build process completes successfully. @@ -61,7 +67,7 @@ Below is a detailed description of all the flags supported by the Spitfire Build ### **Customization Flags** - **`-p=`**: - Specifies the build directory path. If not provided, the default path is used. + Specifies the build directory path for uploads. If not provided, the script dynamically detects the build directory. - **`-t=`**: Sets the target format for the build output. The format follows `component-arch-release-platform`. - **`-v=`**: diff --git a/main.go b/main.go index 357fa4b..4b9a617 100644 --- a/main.go +++ b/main.go @@ -130,8 +130,21 @@ func main() { } fmt.Printf("Initial working directory: %s\n", initialDir) - // Convert buildPath and uploadPath to absolute paths - if buildPath != "" { + // Determine buildPath dynamically if not provided + if buildPath == "" { + sourcePath, err := spitfire.ResolvePath("./mozilla-central") + if err != nil { + log.Fatalf("Error resolving source path: %v", err) + } + + resolvedBuildPath, err := spitfire.ResolveBuildDir(sourcePath) + if err != nil { + log.Fatalf("Failed to detect build directory dynamically: %v", err) + } + buildPath = resolvedBuildPath + fmt.Printf("Automatically detected buildPath: %s\n", buildPath) + } else { + // Convert buildPath to absolute path buildPath, err2 = spitfire.ResolvePath(buildPath) if err2 != nil { log.Fatalf("Failed to convert buildPath to absolute path: %v", err2)