5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 19:51:15 +08:00

[mac] Fix binary path in build. Remove apple identity

This commit is contained in:
Lea Anthony 2021-10-09 17:39:51 +11:00
parent 2729081f2c
commit 3723c41d15
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
2 changed files with 7 additions and 33 deletions

View File

@ -46,11 +46,10 @@ type Options struct {
Verbosity int // Verbosity level (0 - silent, 1 - default, 2 - verbose) Verbosity int // Verbosity level (0 - silent, 1 - default, 2 - verbose)
Compress bool // Compress the final binary Compress bool // Compress the final binary
CompressFlags string // Flags to pass to UPX CompressFlags string // Flags to pass to UPX
AppleIdentity string WebView2Strategy string // WebView2 installer strategy
WebView2Strategy string // WebView2 installer strategy RunDelve bool // Indicates if we should run delve after the build
RunDelve bool // Indicates if we should run delve after the build WailsJSDir string // Directory to generate the wailsjs module
WailsJSDir string // Directory to generate the wailsjs module ForceBuild bool // Force
ForceBuild bool // Force
} }
// Build the project! // Build the project!

View File

@ -2,17 +2,16 @@ package build
import ( import (
"bytes" "bytes"
"fmt"
"github.com/wailsapp/wails/v2/pkg/buildassets"
"image" "image"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec"
"path" "path"
"path/filepath" "path/filepath"
"strings" "strings"
"text/template" "text/template"
"github.com/wailsapp/wails/v2/pkg/buildassets"
"github.com/jackmordaunt/icns" "github.com/jackmordaunt/icns"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/wailsapp/wails/v2/internal/fs" "github.com/wailsapp/wails/v2/internal/fs"
@ -55,13 +54,7 @@ func packageApplication(options *Options) error {
return err return err
} }
// Sign app if needed options.CompiledBinary = filepath.Join(options.BuildDirectory, bundlename)
if options.AppleIdentity != "" {
err = signApplication(options)
if err != nil {
return err
}
}
return nil return nil
} }
@ -186,21 +179,3 @@ func processApplicationIcon(resourceDir string, iconsDir string) (err error) {
}() }()
return icns.Encode(dest, srcImg) 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
}