improving windows compatability

This commit is contained in:
partisan 2025-01-11 23:11:11 +01:00
parent 921540d5a4
commit 8de4db960a
6 changed files with 73 additions and 107 deletions

View file

@ -82,33 +82,12 @@ func DiscardChanges(sourcePath string) {
func CleanBuild(sourcePath string, fullClean bool) {
fmt.Println("Cleaning build...")
// Resolve the build directory dynamically
buildDir, err := ResolveBuildDir(sourcePath)
if err != nil {
errors = append(errors, fmt.Sprintf("Failed to resolve build directory: %v", err))
return
}
// Revert uncommitted changes
if err := runCommand("hg", "revert", "--all", "--no-backup"); err != nil {
errors = append(errors, "Failed to revert changes in Mozilla repository.")
}
// Paths for CLOBBER file and last build timestamp
clobberFile := filepath.Join(buildDir, "CLOBBER")
buildTimestampFile := filepath.Join(buildDir, ".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 {
if fullClean {
// Perform full clean or clobber if necessary
var machCmd string
if runtime.GOOS == "windows" {
@ -181,7 +160,7 @@ func UpdatePatches(patchesDir, patchesRepo, sourcePath string) {
// Handle platform-specific rsync command
fmt.Println("Copying files from patches directory to Firefox source directory...")
if runtime.GOOS == "windows" {
if runtime.GOOS == "windows" || !isMsys2() {
// Use robocopy for Windows
if err := runCommand("robocopy", patchesDir, sourcePath, "*", "/S", "/XF", ".git", "/XD", ".git"); err != nil {
errors = append(errors, "Failed to copy files (Windows robocopy).")