added automatic clobber when nesessary
This commit is contained in:
parent
0384dbfc37
commit
733af5d582
1 changed files with 18 additions and 2 deletions
|
@ -92,8 +92,22 @@ func CleanBuild(sourcePath string, fullClean bool) {
|
||||||
errors = append(errors, "Failed to revert changes in Mozilla repository.")
|
errors = append(errors, "Failed to revert changes in Mozilla repository.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if fullClean {
|
// Paths for CLOBBER file and last build timestamp
|
||||||
// Perform full clean if specified
|
clobberFile := filepath.Join(sourcePath, "obj-x86_64-pc-windows-msvc", "CLOBBER")
|
||||||
|
buildTimestampFile := filepath.Join(sourcePath, "obj-x86_64-pc-windows-msvc", ".last_build_timestamp")
|
||||||
|
|
||||||
|
// Check if a clobber is required
|
||||||
|
clobberRequired := false
|
||||||
|
if _, err := os.Stat(clobberFile); err == nil {
|
||||||
|
clobberFileInfo, _ := os.Stat(clobberFile)
|
||||||
|
if buildInfo, err := os.Stat(buildTimestampFile); err != nil || clobberFileInfo.ModTime().After(buildInfo.ModTime()) {
|
||||||
|
clobberRequired = true
|
||||||
|
fmt.Println("CLOBBER file has been updated. Clobber is required.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if fullClean || clobberRequired {
|
||||||
|
// Perform full clean or clobber if necessary
|
||||||
var machCmd string
|
var machCmd string
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
machCmd = ".\\mach"
|
machCmd = ".\\mach"
|
||||||
|
@ -103,6 +117,8 @@ func CleanBuild(sourcePath string, fullClean bool) {
|
||||||
|
|
||||||
if err := runCommand(machCmd, "clobber"); err != nil {
|
if err := runCommand(machCmd, "clobber"); err != nil {
|
||||||
errors = append(errors, "Failed to clean build.")
|
errors = append(errors, "Failed to clean build.")
|
||||||
|
} else {
|
||||||
|
fmt.Println("Build artifacts cleaned successfully.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Skipping full clean. Build artifacts remain intact.")
|
fmt.Println("Skipping full clean. Build artifacts remain intact.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue