Compare commits

...

8 Commits

Author SHA1 Message Date
Lea Anthony
02bd44f772 Merge branch 'develop' into feature/gopath 2020-09-15 20:16:42 +10:00
Ilgıt Yıldırım
a84f43d959 fixed return 2020-09-15 19:13:49 +10:00
Ilgıt Yıldırım
b48da620b3 added Get method 2020-09-15 19:13:49 +10:00
Lea Anthony
ed8884a581 v1.8.1-pre1 2020-09-15 17:52:39 +10:00
Lea Anthony
05d27dda64 Remove incorrect build flag 2020-09-15 17:51:14 +10:00
Travis McLane
bd0c9dbc43 use wailsapp/xgo:1.0.1 for cross-compiling 2020-09-14 19:05:00 -05:00
Travis McLane
1c813622c0 update messages to output xgo version
TODO: allow image override
2020-09-13 08:51:54 -05:00
Travis McLane
76ba7d56ec implement gopath handling during cross compilation 2020-09-13 08:47:29 -05:00
5 changed files with 29 additions and 15 deletions

View File

@@ -18,6 +18,8 @@ import (
"github.com/leaanthony/spinner" "github.com/leaanthony/spinner"
) )
const xgoVersion = "1.0.1"
var fs = NewFSHelper() var fs = NewFSHelper()
// ValidateFrontendConfig checks if the frontend config is valid // ValidateFrontendConfig checks if the frontend config is valid
@@ -90,16 +92,17 @@ func InitializeCrossCompilation(verbose bool) error {
} }
var packSpinner *spinner.Spinner var packSpinner *spinner.Spinner
msg := fmt.Sprintf("Pulling wailsapp/xgo:%s docker image... (may take a while)", xgoVersion)
if !verbose { if !verbose {
packSpinner = spinner.New("Pulling wailsapp/xgo:latest docker image... (may take a while)") packSpinner = spinner.New(msg)
packSpinner.SetSpinSpeed(50) packSpinner.SetSpinSpeed(50)
packSpinner.Start() packSpinner.Start()
} else { } else {
println("Pulling wailsapp/xgo:latest docker image... (may take a while)") println(msg)
} }
err := NewProgramHelper(verbose).RunCommandArray([]string{"docker", err := NewProgramHelper(verbose).RunCommandArray([]string{"docker",
"pull", "wailsapp/xgo:latest"}) "pull", fmt.Sprintf("wailsapp/xgo:%s", xgoVersion)})
if err != nil { if err != nil {
if packSpinner != nil { if packSpinner != nil {
@@ -114,7 +117,7 @@ func InitializeCrossCompilation(verbose bool) error {
return nil 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 { func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOptions) error {
var packSpinner *spinner.Spinner var packSpinner *spinner.Spinner
if buildMode == BuildModeBridge { if buildMode == BuildModeBridge {
@@ -146,18 +149,24 @@ func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOpt
"-e", "FLAG_RACE=false", "-e", "FLAG_RACE=false",
"-e", "FLAG_BUILDMODE=default", "-e", "FLAG_BUILDMODE=default",
"-e", "FLAG_TRIMPATH=false", "-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", "GOPROXY=",
"-e", "GO111MODULE=on", "-e", "GO111MODULE=on",
"wailsapp/xgo:latest",
".",
} { } {
buildCommand.Add(arg) 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( compileMessage := fmt.Sprintf(
"Packing + Compiling project for %s/%s using docker image wailsapp/xgo:latest", "Packing + Compiling project for %s/%s using docker image wailsapp/xgo:%s",
projectOptions.Platform, projectOptions.Architecture) projectOptions.Platform, projectOptions.Architecture, xgoVersion)
if buildMode == BuildModeDebug { if buildMode == BuildModeDebug {
compileMessage += " (Debug Mode)" compileMessage += " (Debug Mode)"
@@ -216,10 +225,6 @@ func BuildNative(binaryName string, forceRebuild bool, buildMode string, project
buildCommand.Add("go") buildCommand.Add("go")
buildCommand.Add("build") buildCommand.Add("build")
if buildMode == BuildModeBridge {
// Ignore errors
buildCommand.Add("-i")
}
if binaryName != "" { if binaryName != "" {
// Alter binary name based on OS // Alter binary name based on OS

View File

@@ -162,6 +162,7 @@ type ProjectOptions struct {
Platform string Platform string
Architecture string Architecture string
LdFlags string LdFlags string
GoPath string
} }
// Defaults sets the default project template // Defaults sets the default project template

View File

@@ -1,4 +1,4 @@
package cmd package cmd
// Version - Wails version // Version - Wails version
const Version = "v1.8.0" const Version = "v1.8.1-pre1"

View File

@@ -26,6 +26,7 @@ func init() {
var packageApp = false var packageApp = false
var forceRebuild = false var forceRebuild = false
var debugMode = false var debugMode = false
var gopath = ""
var typescriptFilename = "" var typescriptFilename = ""
var verbose = false var verbose = false
var platform = "" var platform = ""
@@ -42,7 +43,8 @@ func init() {
BoolFlag("d", "Build in Debug mode", &debugMode). BoolFlag("d", "Build in Debug mode", &debugMode).
BoolFlag("verbose", "Verbose output", &verbose). BoolFlag("verbose", "Verbose output", &verbose).
StringFlag("t", "Generate Typescript definitions to given file (at runtime)", &typescriptFilename). 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 var b strings.Builder
for _, plat := range getSupportedPlatforms() { for _, plat := range getSupportedPlatforms() {
@@ -97,6 +99,7 @@ func init() {
// Add ldflags // Add ldflags
projectOptions.LdFlags = ldflags projectOptions.LdFlags = ldflags
projectOptions.GoPath = gopath
// Validate config // Validate config
// Check if we have a frontend // Check if we have a frontend

View File

@@ -291,3 +291,8 @@ func (s *Store) Update(updater interface{}) {
s.errorHandler(err) s.errorHandler(err)
} }
} }
// Get returns the value of the data that's kept in the current state / Store
func (s *Store) Get() interface{} {
return s.data.Interface()
}