removed '--patches' flag, added '--pre-patch', '--post-patch', '--skip-patch-update'
This commit is contained in:
parent
f497ac9999
commit
ad7f7bf778
2 changed files with 65 additions and 32 deletions
74
main.go
74
main.go
|
@ -15,29 +15,31 @@ import (
|
|||
|
||||
var (
|
||||
// Define all flags as package-level variables
|
||||
all bool
|
||||
buildFlag bool
|
||||
clean bool
|
||||
update bool
|
||||
patches bool
|
||||
run bool
|
||||
compress bool
|
||||
buildPath string
|
||||
target string
|
||||
version string
|
||||
component string
|
||||
arch string
|
||||
release string
|
||||
platform string
|
||||
upload bool
|
||||
uploadPath string
|
||||
sourceRepo = "https://hg.mozilla.org/mozilla-central"
|
||||
patchesRepo = "https://weforge.xyz/Spitfire/Browser.git"
|
||||
url = "https://spitfirebrowser.xyz/"
|
||||
licence = "AGPL-3.0"
|
||||
name = "Spitfire"
|
||||
maintainer = "Internet Addict"
|
||||
initialDir string
|
||||
all bool
|
||||
buildFlag bool
|
||||
clean bool
|
||||
update bool
|
||||
prePatch bool
|
||||
postPatch bool
|
||||
skipPatchUpdate bool
|
||||
run bool
|
||||
compress bool
|
||||
buildPath string
|
||||
target string
|
||||
version string
|
||||
component string
|
||||
arch string
|
||||
release string
|
||||
platform string
|
||||
upload bool
|
||||
uploadPath string
|
||||
sourceRepo = "https://hg.mozilla.org/mozilla-central"
|
||||
patchesRepo = "https://weforge.xyz/Spitfire/Browser.git"
|
||||
url = "https://spitfirebrowser.xyz/"
|
||||
licence = "AGPL-3.0"
|
||||
name = "Spitfire"
|
||||
maintainer = "Internet Addict"
|
||||
initialDir string
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -53,7 +55,9 @@ func init() {
|
|||
flag.BoolVar(&buildFlag, "b", false, "Build Spitfire")
|
||||
flag.BoolVar(&clean, "clean", false, "Clean build")
|
||||
flag.BoolVar(&update, "u", false, "Update Mozilla repository")
|
||||
flag.BoolVar(&patches, "patches", false, "Update patches")
|
||||
flag.BoolVar(&prePatch, "pre-patch", false, "Apply pre-build patches")
|
||||
flag.BoolVar(&postPatch, "post-patch", false, "Apply post-build patches")
|
||||
flag.BoolVar(&skipPatchUpdate, "skip-patch-update", false, "Skip updating the patches repository")
|
||||
flag.BoolVar(&run, "r", false, "Run the project after build")
|
||||
flag.BoolVar(&upload, "upload", false, "Upload the compressed build file to SourceForge")
|
||||
flag.StringVar(&uploadPath, "upload-path", "", "Path to the file to upload if no build present")
|
||||
|
@ -141,7 +145,7 @@ func main() {
|
|||
fmt.Printf("Resolved uploadPath: %s\n", uploadPath)
|
||||
}
|
||||
|
||||
if all || buildFlag || patches || clean || update {
|
||||
if all || buildFlag || prePatch || postPatch || clean || update {
|
||||
BuildProcess()
|
||||
}
|
||||
|
||||
|
@ -170,12 +174,12 @@ func BuildProcess() {
|
|||
spitfire.DiscardChanges(sourcePath)
|
||||
spitfire.CleanBuild(sourcePath)
|
||||
spitfire.UpdateRepo(sourcePath)
|
||||
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher")); err != nil {
|
||||
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); 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 {
|
||||
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
||||
log.Fatalf("Error during patch application: %v", err)
|
||||
}
|
||||
if run {
|
||||
|
@ -189,17 +193,25 @@ func BuildProcess() {
|
|||
spitfire.DownloadSource(sourcePath, sourceRepo)
|
||||
spitfire.UpdateRepo(sourcePath)
|
||||
fmt.Println("Mozilla repository updated.")
|
||||
} else if patches {
|
||||
} else if prePatch {
|
||||
spitfire.DownloadSource(sourcePath, sourceRepo)
|
||||
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher")); err != nil {
|
||||
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
||||
log.Fatalf("Error during patch application: %v", err)
|
||||
}
|
||||
fmt.Println("Patches updated.")
|
||||
} else if postPatch {
|
||||
if _, err := os.Stat(buildDir); err == nil {
|
||||
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
||||
log.Fatalf("Error during patch application: %v", err)
|
||||
}
|
||||
}
|
||||
} 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 postPatch {
|
||||
if err := spitfire.ApplyPatches(buildDir, patchesRepo, "post-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
|
||||
log.Fatalf("Error during patch application: %v", err)
|
||||
}
|
||||
}
|
||||
if run {
|
||||
spitfire.RunProject(sourcePath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue