mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 04:42:00 +08:00
Refactor recent mac updates (#2419)
This commit is contained in:
parent
9b35926789
commit
76371fcb27
@ -262,57 +262,60 @@ func execBuildApplication(builder Builder, options *Options) (string, error) {
|
|||||||
|
|
||||||
// Compile the application
|
// Compile the application
|
||||||
printBulletPoint("Compiling application: ")
|
printBulletPoint("Compiling application: ")
|
||||||
outputFile := builder.OutputFilename(options)
|
|
||||||
options.ProjectData.OutputFilename = outputFile
|
|
||||||
options.ProjectData.Name = outputFile
|
|
||||||
options.ProjectData.Info.ProductName = outputFile
|
|
||||||
|
|
||||||
if options.Platform == "darwin" && options.Arch == "universal" {
|
if options.Platform == "darwin" {
|
||||||
amd64Filename := outputFile + "-amd64"
|
outputFile := builder.OutputFilename(options)
|
||||||
arm64Filename := outputFile + "-arm64"
|
if options.Arch == "universal" {
|
||||||
|
amd64Filename := outputFile + "-amd64"
|
||||||
|
arm64Filename := outputFile + "-arm64"
|
||||||
|
|
||||||
// Build amd64 first
|
// Build amd64 first
|
||||||
options.Arch = "amd64"
|
options.Arch = "amd64"
|
||||||
options.OutputFile = amd64Filename
|
options.OutputFile = amd64Filename
|
||||||
options.CleanBinDirectory = false
|
options.CleanBinDirectory = false
|
||||||
if options.Verbosity == VERBOSE {
|
if options.Verbosity == VERBOSE {
|
||||||
pterm.Println("Building AMD64 Target: " + filepath.Join(options.BinDirectory, options.OutputFile))
|
pterm.Println("Building AMD64 Target: " + filepath.Join(options.BinDirectory, options.OutputFile))
|
||||||
}
|
}
|
||||||
err := builder.CompileProject(options)
|
err := builder.CompileProject(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
// Build arm64
|
// Build arm64
|
||||||
options.Arch = "arm64"
|
options.Arch = "arm64"
|
||||||
options.OutputFile = arm64Filename
|
options.OutputFile = arm64Filename
|
||||||
options.CleanBinDirectory = false
|
options.CleanBinDirectory = false
|
||||||
if options.Verbosity == VERBOSE {
|
if options.Verbosity == VERBOSE {
|
||||||
pterm.Println("Building ARM64 Target: " + filepath.Join(options.BinDirectory, options.OutputFile))
|
pterm.Println("Building ARM64 Target: " + filepath.Join(options.BinDirectory, options.OutputFile))
|
||||||
}
|
}
|
||||||
err = builder.CompileProject(options)
|
err = builder.CompileProject(options)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
}
|
||||||
|
// Run lipo
|
||||||
|
if options.Verbosity == VERBOSE {
|
||||||
|
pterm.Println(fmt.Sprintf("Running lipo: lipo -create -output %s %s %s", outputFile, amd64Filename, arm64Filename))
|
||||||
|
}
|
||||||
|
_, stderr, err := shell.RunCommand(options.BinDirectory, "lipo", "-create", "-output", outputFile, amd64Filename, arm64Filename)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("%s - %s", err.Error(), stderr)
|
||||||
|
}
|
||||||
|
// Remove temp binaries
|
||||||
|
err = fs.DeleteFile(filepath.Join(options.BinDirectory, amd64Filename))
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
err = fs.DeleteFile(filepath.Join(options.BinDirectory, arm64Filename))
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
options.ProjectData.OutputFilename = outputFile
|
||||||
|
options.CompiledBinary = filepath.Join(options.BinDirectory, outputFile)
|
||||||
|
} else {
|
||||||
|
options.ProjectData.OutputFilename = outputFile
|
||||||
|
options.ProjectData.Name = outputFile
|
||||||
|
options.ProjectData.Info.ProductName = outputFile
|
||||||
}
|
}
|
||||||
// Run lipo
|
|
||||||
if options.Verbosity == VERBOSE {
|
|
||||||
pterm.Println(fmt.Sprintf("Running lipo: lipo -create -output %s %s %s", outputFile, amd64Filename, arm64Filename))
|
|
||||||
}
|
|
||||||
_, stderr, err := shell.RunCommand(options.BinDirectory, "lipo", "-create", "-output", outputFile, amd64Filename, arm64Filename)
|
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("%s - %s", err.Error(), stderr)
|
|
||||||
}
|
|
||||||
// Remove temp binaries
|
|
||||||
err = fs.DeleteFile(filepath.Join(options.BinDirectory, amd64Filename))
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
err = fs.DeleteFile(filepath.Join(options.BinDirectory, arm64Filename))
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
options.ProjectData.OutputFilename = outputFile
|
|
||||||
options.CompiledBinary = filepath.Join(options.BinDirectory, outputFile)
|
|
||||||
} else {
|
} else {
|
||||||
err := builder.CompileProject(options)
|
err := builder.CompileProject(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user