mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 13:19:00 -07:00
Compare commits
4 Commits
feature/v2
...
feature/go
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02bd44f772 | ||
|
|
bd0c9dbc43 | ||
|
|
1c813622c0 | ||
|
|
76ba7d56ec |
@@ -18,6 +18,8 @@ import (
|
||||
"github.com/leaanthony/spinner"
|
||||
)
|
||||
|
||||
const xgoVersion = "1.0.1"
|
||||
|
||||
var fs = NewFSHelper()
|
||||
|
||||
// ValidateFrontendConfig checks if the frontend config is valid
|
||||
@@ -90,16 +92,17 @@ func InitializeCrossCompilation(verbose bool) error {
|
||||
}
|
||||
|
||||
var packSpinner *spinner.Spinner
|
||||
msg := fmt.Sprintf("Pulling wailsapp/xgo:%s docker image... (may take a while)", xgoVersion)
|
||||
if !verbose {
|
||||
packSpinner = spinner.New("Pulling wailsapp/xgo:latest docker image... (may take a while)")
|
||||
packSpinner = spinner.New(msg)
|
||||
packSpinner.SetSpinSpeed(50)
|
||||
packSpinner.Start()
|
||||
} else {
|
||||
println("Pulling wailsapp/xgo:latest docker image... (may take a while)")
|
||||
println(msg)
|
||||
}
|
||||
|
||||
err := NewProgramHelper(verbose).RunCommandArray([]string{"docker",
|
||||
"pull", "wailsapp/xgo:latest"})
|
||||
"pull", fmt.Sprintf("wailsapp/xgo:%s", xgoVersion)})
|
||||
|
||||
if err != nil {
|
||||
if packSpinner != nil {
|
||||
@@ -114,7 +117,7 @@ func InitializeCrossCompilation(verbose bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// BuildDocker builds the project using the cross compiling wailsapp/xgo:latest container
|
||||
// BuildDocker builds the project using the cross compiling wailsapp/xgo:<xgoVersion> container
|
||||
func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOptions) error {
|
||||
var packSpinner *spinner.Spinner
|
||||
if buildMode == BuildModeBridge {
|
||||
@@ -146,18 +149,24 @@ func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOpt
|
||||
"-e", "FLAG_RACE=false",
|
||||
"-e", "FLAG_BUILDMODE=default",
|
||||
"-e", "FLAG_TRIMPATH=false",
|
||||
"-e", fmt.Sprintf("TARGETS=%s", projectOptions.Platform+"/"+projectOptions.Architecture),
|
||||
"-e", fmt.Sprintf("TARGETS=%s/%s", projectOptions.Platform, projectOptions.Architecture),
|
||||
"-e", "GOPROXY=",
|
||||
"-e", "GO111MODULE=on",
|
||||
"wailsapp/xgo:latest",
|
||||
".",
|
||||
} {
|
||||
buildCommand.Add(arg)
|
||||
}
|
||||
|
||||
if projectOptions.GoPath != "" {
|
||||
buildCommand.Add("-v")
|
||||
buildCommand.Add(fmt.Sprintf("%s:/go", projectOptions.GoPath))
|
||||
}
|
||||
|
||||
buildCommand.Add(fmt.Sprintf("wailsapp/xgo:%s", xgoVersion))
|
||||
buildCommand.Add(".")
|
||||
|
||||
compileMessage := fmt.Sprintf(
|
||||
"Packing + Compiling project for %s/%s using docker image wailsapp/xgo:latest",
|
||||
projectOptions.Platform, projectOptions.Architecture)
|
||||
"Packing + Compiling project for %s/%s using docker image wailsapp/xgo:%s",
|
||||
projectOptions.Platform, projectOptions.Architecture, xgoVersion)
|
||||
|
||||
if buildMode == BuildModeDebug {
|
||||
compileMessage += " (Debug Mode)"
|
||||
|
||||
@@ -162,6 +162,7 @@ type ProjectOptions struct {
|
||||
Platform string
|
||||
Architecture string
|
||||
LdFlags string
|
||||
GoPath string
|
||||
}
|
||||
|
||||
// Defaults sets the default project template
|
||||
|
||||
@@ -26,6 +26,7 @@ func init() {
|
||||
var packageApp = false
|
||||
var forceRebuild = false
|
||||
var debugMode = false
|
||||
var gopath = ""
|
||||
var typescriptFilename = ""
|
||||
var verbose = false
|
||||
var platform = ""
|
||||
@@ -42,7 +43,8 @@ func init() {
|
||||
BoolFlag("d", "Build in Debug mode", &debugMode).
|
||||
BoolFlag("verbose", "Verbose output", &verbose).
|
||||
StringFlag("t", "Generate Typescript definitions to given file (at runtime)", &typescriptFilename).
|
||||
StringFlag("ldflags", "Extra options for -ldflags", &ldflags)
|
||||
StringFlag("ldflags", "Extra options for -ldflags", &ldflags).
|
||||
StringFlag("gopath", "Specify your GOPATH location. Mounted to /go during cross-compilation.", &gopath)
|
||||
|
||||
var b strings.Builder
|
||||
for _, plat := range getSupportedPlatforms() {
|
||||
@@ -97,6 +99,7 @@ func init() {
|
||||
|
||||
// Add ldflags
|
||||
projectOptions.LdFlags = ldflags
|
||||
projectOptions.GoPath = gopath
|
||||
|
||||
// Validate config
|
||||
// Check if we have a frontend
|
||||
|
||||
Reference in New Issue
Block a user