mirror of
https://github.com/taigrr/wails.git
synced 2026-04-17 04:05:12 -07:00
Compare commits
4 Commits
v2.0.0-bet
...
v2.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd7c6a3d58 | ||
|
|
cfbeb1efd1 | ||
|
|
3022b0bf3f | ||
|
|
3723c41d15 |
@@ -1,3 +1,3 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
var Version = "v2.0.0-beta.8"
|
var Version = "v2.0.0-beta.9"
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ func GetWailsVersionFromModFile(goModText []byte) (*semver.Version, error) {
|
|||||||
if req.Syntax == nil {
|
if req.Syntax == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(req.Syntax.Token) < 3 {
|
tokenPosition := 0
|
||||||
continue
|
if !req.Syntax.InBlock {
|
||||||
|
tokenPosition = 1
|
||||||
}
|
}
|
||||||
if req.Syntax.Token[1] == "github.com/wailsapp/wails/v2" {
|
if req.Syntax.Token[tokenPosition] == "github.com/wailsapp/wails/v2" {
|
||||||
version := req.Syntax.Token[2]
|
version := req.Syntax.Token[tokenPosition+1]
|
||||||
return semver.NewVersion(version)
|
return semver.NewVersion(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,7 +35,7 @@ func GoModOutOfSync(goModData []byte, currentVersion string) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
result, err := semver.NewVersion(currentVersion)
|
result, err := semver.NewVersion(currentVersion)
|
||||||
if err != nil {
|
if err != nil || result == nil {
|
||||||
return false, fmt.Errorf("Unable to parse Wails version: %s", currentVersion)
|
return false, fmt.Errorf("Unable to parse Wails version: %s", currentVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package gomod
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Masterminds/semver"
|
"github.com/Masterminds/semver"
|
||||||
|
"github.com/matryer/is"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@@ -10,7 +11,7 @@ const basic string = `module changeme
|
|||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require github.com/wailsapp/wails/v2 v2.0.0-beta.8
|
require github.com/wailsapp/wails/v2 v2.0.0-beta.7
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/andybalholm/brotli v1.0.2 // indirect
|
github.com/andybalholm/brotli v1.0.2 // indirect
|
||||||
@@ -44,7 +45,7 @@ require (
|
|||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.8 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.7 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
||||||
`
|
`
|
||||||
|
|
||||||
func TestGetWailsVersion(t *testing.T) {
|
func TestGetWailsVersion(t *testing.T) {
|
||||||
@@ -54,7 +55,7 @@ func TestGetWailsVersion(t *testing.T) {
|
|||||||
want *semver.Version
|
want *semver.Version
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"basic", []byte(basic), semver.MustParse("v2.0.0-beta.8"), false},
|
{"basic", []byte(basic), semver.MustParse("v2.0.0-beta.7"), false},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
@@ -74,7 +75,7 @@ const basicUpdated string = `module changeme
|
|||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require github.com/wailsapp/wails/v2 v2.0.0-beta.8
|
require github.com/wailsapp/wails/v2 v2.0.0-beta.9
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/andybalholm/brotli v1.0.2 // indirect
|
github.com/andybalholm/brotli v1.0.2 // indirect
|
||||||
@@ -108,10 +109,97 @@ require (
|
|||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.8 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.7 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
||||||
|
`
|
||||||
|
|
||||||
|
const multilineRequire = `module changeme
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/wailsapp/wails/v2 v2.0.0-beta.7
|
||||||
|
)
|
||||||
|
require (
|
||||||
|
github.com/andybalholm/brotli v1.0.2 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.3.1 // indirect
|
||||||
|
github.com/go-ole/go-ole v1.2.5 // indirect
|
||||||
|
github.com/gofiber/fiber/v2 v2.17.0 // indirect
|
||||||
|
github.com/gofiber/websocket/v2 v2.0.8 // indirect
|
||||||
|
github.com/google/uuid v1.1.2 // indirect
|
||||||
|
github.com/imdario/mergo v0.3.12 // indirect
|
||||||
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||||
|
github.com/klauspost/compress v1.12.2 // indirect
|
||||||
|
github.com/leaanthony/debme v1.2.1 // indirect
|
||||||
|
github.com/leaanthony/go-ansi-parser v1.0.1 // indirect
|
||||||
|
github.com/leaanthony/go-common-file-dialog v1.0.3 // indirect
|
||||||
|
github.com/leaanthony/go-webview2 v0.0.0-20211007092718-65d2f028ef2d // indirect
|
||||||
|
github.com/leaanthony/gosod v1.0.3 // indirect
|
||||||
|
github.com/leaanthony/slicer v1.5.0 // indirect
|
||||||
|
github.com/leaanthony/typescriptify-golang-structs v0.1.7 // indirect
|
||||||
|
github.com/leaanthony/webview2runtime v1.1.0 // indirect
|
||||||
|
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 // indirect
|
||||||
|
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
github.com/savsgio/gotils v0.0.0-20200117113501-90175b0fbe3f // indirect
|
||||||
|
github.com/tkrajina/go-reflector v0.5.5 // indirect
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
|
github.com/valyala/fasthttp v1.28.0 // indirect
|
||||||
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||||
|
golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
||||||
|
)
|
||||||
|
|
||||||
|
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.7 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
||||||
|
`
|
||||||
|
|
||||||
|
const multilineRequireUpdated = `module changeme
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/wailsapp/wails/v2 v2.0.0-beta.9
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/andybalholm/brotli v1.0.2 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.3.1 // indirect
|
||||||
|
github.com/go-ole/go-ole v1.2.5 // indirect
|
||||||
|
github.com/gofiber/fiber/v2 v2.17.0 // indirect
|
||||||
|
github.com/gofiber/websocket/v2 v2.0.8 // indirect
|
||||||
|
github.com/google/uuid v1.1.2 // indirect
|
||||||
|
github.com/imdario/mergo v0.3.12 // indirect
|
||||||
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||||
|
github.com/klauspost/compress v1.12.2 // indirect
|
||||||
|
github.com/leaanthony/debme v1.2.1 // indirect
|
||||||
|
github.com/leaanthony/go-ansi-parser v1.0.1 // indirect
|
||||||
|
github.com/leaanthony/go-common-file-dialog v1.0.3 // indirect
|
||||||
|
github.com/leaanthony/go-webview2 v0.0.0-20211007092718-65d2f028ef2d // indirect
|
||||||
|
github.com/leaanthony/gosod v1.0.3 // indirect
|
||||||
|
github.com/leaanthony/slicer v1.5.0 // indirect
|
||||||
|
github.com/leaanthony/typescriptify-golang-structs v0.1.7 // indirect
|
||||||
|
github.com/leaanthony/webview2runtime v1.1.0 // indirect
|
||||||
|
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 // indirect
|
||||||
|
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
github.com/savsgio/gotils v0.0.0-20200117113501-90175b0fbe3f // indirect
|
||||||
|
github.com/tkrajina/go-reflector v0.5.5 // indirect
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
|
github.com/valyala/fasthttp v1.28.0 // indirect
|
||||||
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||||
|
golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
||||||
|
)
|
||||||
|
|
||||||
|
//replace github.com/wailsapp/wails/v2 v2.0.0-beta.7 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
||||||
`
|
`
|
||||||
|
|
||||||
func TestUpdateGoModVersion(t *testing.T) {
|
func TestUpdateGoModVersion(t *testing.T) {
|
||||||
|
is2 := is.New(t)
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
goModText []byte
|
goModText []byte
|
||||||
currentVersion string
|
currentVersion string
|
||||||
@@ -122,7 +210,8 @@ func TestUpdateGoModVersion(t *testing.T) {
|
|||||||
want []byte
|
want []byte
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"basic", args{[]byte(basic), "v2.0.0-beta.8"}, []byte(basicUpdated), false},
|
{"basic", args{[]byte(basic), "v2.0.0-beta.9"}, []byte(basicUpdated), false},
|
||||||
|
{"basicmultiline", args{[]byte(multilineRequire), "v2.0.0-beta.9"}, []byte(multilineRequireUpdated), false},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
@@ -131,9 +220,35 @@ func TestUpdateGoModVersion(t *testing.T) {
|
|||||||
t.Errorf("UpdateGoModVersion() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("UpdateGoModVersion() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(got, tt.want) {
|
is2.Equal(got, tt.want)
|
||||||
t.Errorf("UpdateGoModVersion() got = %v, want %v", string(got), string(tt.want))
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGoModOutOfSync(t *testing.T) {
|
||||||
|
is2 := is.New(t)
|
||||||
|
|
||||||
|
type args struct {
|
||||||
|
goModData []byte
|
||||||
|
currentVersion string
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
want bool
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
{"basic", args{[]byte(basic), "v2.0.0-beta.9"}, true, false},
|
||||||
|
{"basicmultiline", args{[]byte(multilineRequire), "v2.0.0-beta.9"}, true, false},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
got, err := GoModOutOfSync(tt.args.goModData, tt.args.currentVersion)
|
||||||
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("GoModOutOfSync() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
is2.Equal(got, tt.want)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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!
|
||||||
|
|||||||
@@ -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 = packedBinaryPath
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ import TabItem from "@theme/TabItem";
|
|||||||
|
|
||||||
## Installing Wails
|
## Installing Wails
|
||||||
|
|
||||||
Run `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.8` to install the Wails CLI.
|
Run `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.9` to install the Wails CLI.
|
||||||
|
|
||||||
## System Check
|
## System Check
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import TabItem from "@theme/TabItem";
|
|||||||
|
|
||||||
## 安装 Wails
|
## 安装 Wails
|
||||||
|
|
||||||
运行 `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.8` 安装 Wails CLI。
|
运行 `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.9` 安装 Wails CLI。
|
||||||
|
|
||||||
## 系统检查
|
## 系统检查
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user