From 3723c41d1598406a5533e97e41cc8e1b5da6376f Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 9 Oct 2021 17:39:51 +1100 Subject: [PATCH] [mac] Fix binary path in build. Remove apple identity --- v2/pkg/commands/build/build.go | 9 +++---- v2/pkg/commands/build/packager_darwin.go | 31 +++--------------------- 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go index 3401d5cd7fa..9e2798a1b72 100644 --- a/v2/pkg/commands/build/build.go +++ b/v2/pkg/commands/build/build.go @@ -46,11 +46,10 @@ type Options struct { Verbosity int // Verbosity level (0 - silent, 1 - default, 2 - verbose) Compress bool // Compress the final binary CompressFlags string // Flags to pass to UPX - AppleIdentity string - WebView2Strategy string // WebView2 installer strategy - RunDelve bool // Indicates if we should run delve after the build - WailsJSDir string // Directory to generate the wailsjs module - ForceBuild bool // Force + WebView2Strategy string // WebView2 installer strategy + RunDelve bool // Indicates if we should run delve after the build + WailsJSDir string // Directory to generate the wailsjs module + ForceBuild bool // Force } // Build the project! diff --git a/v2/pkg/commands/build/packager_darwin.go b/v2/pkg/commands/build/packager_darwin.go index 88e03298083..79396d2beed 100644 --- a/v2/pkg/commands/build/packager_darwin.go +++ b/v2/pkg/commands/build/packager_darwin.go @@ -2,17 +2,16 @@ package build import ( "bytes" - "fmt" - "github.com/wailsapp/wails/v2/pkg/buildassets" "image" "io/ioutil" "os" - "os/exec" "path" "path/filepath" "strings" "text/template" + "github.com/wailsapp/wails/v2/pkg/buildassets" + "github.com/jackmordaunt/icns" "github.com/pkg/errors" "github.com/wailsapp/wails/v2/internal/fs" @@ -55,13 +54,7 @@ func packageApplication(options *Options) error { return err } - // Sign app if needed - if options.AppleIdentity != "" { - err = signApplication(options) - if err != nil { - return err - } - } + options.CompiledBinary = filepath.Join(options.BuildDirectory, bundlename) return nil } @@ -186,21 +179,3 @@ func processApplicationIcon(resourceDir string, iconsDir string) (err error) { }() return icns.Encode(dest, srcImg) } - -func signApplication(options *Options) error { - bundlename := filepath.Join(options.BuildDirectory, options.ProjectData.Name+".app") - identity := fmt.Sprintf(`"%s"`, options.AppleIdentity) - cmd := exec.Command("codesign", "--sign", identity, "--deep", "--force", "--verbose", "--timestamp", "--options", "runtime", bundlename) - var stdo, stde bytes.Buffer - cmd.Stdout = &stdo - cmd.Stderr = &stde - - // Run command - err := cmd.Run() - - // Format error if we have one - if err != nil { - return fmt.Errorf("%s\n%s", err, string(stde.Bytes())) - } - return nil -}