added '--full-clean' flag
This commit is contained in:
parent
a21ff16308
commit
993bf58ecd
2 changed files with 22 additions and 15 deletions
|
@ -79,28 +79,33 @@ func DiscardChanges(sourcePath string) {
|
|||
}
|
||||
|
||||
// Function to clean build
|
||||
func CleanBuild(sourcePath string) {
|
||||
func CleanBuild(sourcePath string, fullClean bool) {
|
||||
fmt.Println("Cleaning build...")
|
||||
|
||||
if err := os.Chdir(sourcePath); err != nil {
|
||||
errors = append(errors, "Failed to navigate to source directory.")
|
||||
return
|
||||
}
|
||||
|
||||
// Use the appropriate mach command for Windows or Unix-like systems
|
||||
var machCmd string
|
||||
if runtime.GOOS == "windows" {
|
||||
machCmd = ".\\mach"
|
||||
} else {
|
||||
machCmd = "./mach"
|
||||
}
|
||||
|
||||
// Revert uncommitted changes
|
||||
if err := runCommand("hg", "revert", "--all", "--no-backup"); err != nil {
|
||||
errors = append(errors, "Failed to revert changes in Mozilla repository.")
|
||||
}
|
||||
// Clean the build
|
||||
if err := runCommand(machCmd, "clobber"); err != nil {
|
||||
errors = append(errors, "Failed to clean build.")
|
||||
|
||||
if fullClean {
|
||||
// Perform full clean if specified
|
||||
var machCmd string
|
||||
if runtime.GOOS == "windows" {
|
||||
machCmd = ".\\mach"
|
||||
} else {
|
||||
machCmd = "./mach"
|
||||
}
|
||||
|
||||
if err := runCommand(machCmd, "clobber"); err != nil {
|
||||
errors = append(errors, "Failed to clean build.")
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Skipping full clean. Build artifacts remain intact.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue