Skip to content

Commit

Permalink
[mac] Fix binary path in build. Remove apple identity
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Oct 9, 2021
1 parent 2729081 commit 3723c41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 33 deletions.
9 changes: 4 additions & 5 deletions v2/pkg/commands/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
31 changes: 3 additions & 28 deletions v2/pkg/commands/build/packager_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}

0 comments on commit 3723c41

Please sign in to comment.