added post compile patch

This commit is contained in:
partisan 2024-12-11 16:45:34 +01:00
parent bb6e62e569
commit ef936f3aab
3 changed files with 49 additions and 34 deletions

21
main.go
View file

@ -159,19 +159,25 @@ func BuildProcess() {
log.Fatalf("Error resolving source path: %v", err)
}
// Detect the build directory dynamically
buildDir, err := spitfire.ResolveBuildDir(sourcePath)
if err != nil {
log.Fatalf("Error resolving build directory: %v", err)
}
if all {
spitfire.DownloadSource(sourcePath, sourceRepo)
spitfire.DiscardChanges(sourcePath)
spitfire.CleanBuild(sourcePath)
spitfire.UpdateRepo(sourcePath)
// Pass patchesRepo to ApplyPatches
if err := spitfire.ApplyPatches(sourcePath, patchesRepo); err != nil {
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher")); err != nil {
log.Fatalf("Error during patch application: %v", err)
}
spitfire.Configure(sourcePath)
spitfire.Build(sourcePath)
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher")); err != nil {
log.Fatalf("Error during patch application: %v", err)
}
if run {
spitfire.RunProject(sourcePath)
}
@ -185,15 +191,16 @@ func BuildProcess() {
fmt.Println("Mozilla repository updated.")
} else if patches {
spitfire.DownloadSource(sourcePath, sourceRepo)
// Pass patchesRepo to ApplyPatches
if err := spitfire.ApplyPatches(sourcePath, patchesRepo); err != nil {
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher")); err != nil {
log.Fatalf("Error during patch application: %v", err)
}
fmt.Println("Patches updated.")
} else if buildFlag {
spitfire.Configure(sourcePath)
spitfire.Build(sourcePath)
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher")); err != nil {
log.Fatalf("Error during patch application: %v", err)
}
if run {
spitfire.RunProject(sourcePath)
}