mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Merge branch 'master' into bugfix/4109_restore_minimized_window
This commit is contained in:
commit
8dc509f49b
10 changed files with 64 additions and 40 deletions
|
|
@ -85,6 +85,7 @@ func buildApplication(f *flags.Build) error {
|
|||
GarbleArgs: f.GarbleArgs,
|
||||
SkipBindings: f.SkipBindings,
|
||||
ProjectData: projectOptions,
|
||||
SkipEmbedCreate: f.SkipEmbedCreate,
|
||||
}
|
||||
|
||||
tableData := pterm.TableData{
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
package flags
|
||||
|
||||
type BuildCommon struct {
|
||||
LdFlags string `description:"Additional ldflags to pass to the compiler"`
|
||||
Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"`
|
||||
SkipBindings bool `description:"Skips generation of bindings"`
|
||||
RaceDetector bool `name:"race" description:"Build with Go's race detector"`
|
||||
SkipFrontend bool `name:"s" description:"Skips building the frontend"`
|
||||
Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"`
|
||||
Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"`
|
||||
NoSyncGoMod bool `description:"Don't sync go.mod"`
|
||||
SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"`
|
||||
LdFlags string `description:"Additional ldflags to pass to the compiler"`
|
||||
Compiler string `description:"Use a different go compiler to build, eg go1.15beta1"`
|
||||
SkipBindings bool `description:"Skips generation of bindings"`
|
||||
RaceDetector bool `name:"race" description:"Build with Go's race detector"`
|
||||
SkipFrontend bool `name:"s" description:"Skips building the frontend"`
|
||||
Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"`
|
||||
Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"`
|
||||
NoSyncGoMod bool `description:"Don't sync go.mod"`
|
||||
SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"`
|
||||
SkipEmbedCreate bool `description:"Skips creation of embed files"`
|
||||
}
|
||||
|
||||
func (c BuildCommon) Default() BuildCommon {
|
||||
|
|
|
|||
|
|
@ -117,21 +117,22 @@ func (d *Dev) loadAndMergeProjectConfig() error {
|
|||
// GenerateBuildOptions creates a build.Options using the flags
|
||||
func (d *Dev) GenerateBuildOptions() *build.Options {
|
||||
result := &build.Options{
|
||||
OutputType: "dev",
|
||||
Mode: build.Dev,
|
||||
Devtools: true,
|
||||
Arch: runtime.GOARCH,
|
||||
Pack: true,
|
||||
Platform: runtime.GOOS,
|
||||
LDFlags: d.LdFlags,
|
||||
Compiler: d.Compiler,
|
||||
ForceBuild: d.ForceBuild,
|
||||
IgnoreFrontend: d.SkipFrontend,
|
||||
SkipBindings: d.SkipBindings,
|
||||
Verbosity: d.Verbosity,
|
||||
WailsJSDir: d.WailsJSDir,
|
||||
RaceDetector: d.RaceDetector,
|
||||
ProjectData: d.projectConfig,
|
||||
OutputType: "dev",
|
||||
Mode: build.Dev,
|
||||
Devtools: true,
|
||||
Arch: runtime.GOARCH,
|
||||
Pack: true,
|
||||
Platform: runtime.GOOS,
|
||||
LDFlags: d.LdFlags,
|
||||
Compiler: d.Compiler,
|
||||
ForceBuild: d.ForceBuild,
|
||||
IgnoreFrontend: d.SkipFrontend,
|
||||
SkipBindings: d.SkipBindings,
|
||||
Verbosity: d.Verbosity,
|
||||
WailsJSDir: d.WailsJSDir,
|
||||
RaceDetector: d.RaceDetector,
|
||||
ProjectData: d.projectConfig,
|
||||
SkipEmbedCreate: d.SkipEmbedCreate,
|
||||
}
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -46,7 +46,12 @@ func CreateApp(appoptions *options.App) (*App, error) {
|
|||
ctx = context.WithValue(ctx, "debug", true)
|
||||
ctx = context.WithValue(ctx, "devtoolsEnabled", true)
|
||||
|
||||
// Set up logger
|
||||
// Set up logger if the appoptions.LogLevel is an invalid value, set it to the default log level
|
||||
appoptions.LogLevel, err = pkglogger.StringToLogLevel(appoptions.LogLevel.String())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
myLogger := logger.New(appoptions.Logger)
|
||||
myLogger.SetLogLevel(appoptions.LogLevel)
|
||||
|
||||
|
|
@ -91,15 +96,8 @@ func CreateApp(appoptions *options.App) (*App, error) {
|
|||
if frontendDevServerURLFlag != nil {
|
||||
frontendDevServerURL = *frontendDevServerURLFlag
|
||||
}
|
||||
// Only override LogLevel if the flag was explicitly set
|
||||
if loglevelFlag != nil && devFlags.Lookup("loglevel").Value.String() != appoptions.LogLevel.String() {
|
||||
loggerLevel, err := pkglogger.StringToLogLevel(*loglevelFlag)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if loggerLevel != appoptions.LogLevel {
|
||||
myLogger.SetLogLevel(loggerLevel)
|
||||
}
|
||||
if loglevelFlag != nil {
|
||||
loglevel = *loglevelFlag
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,6 +174,17 @@ func CreateApp(appoptions *options.App) (*App, error) {
|
|||
ctx = context.WithValue(ctx, "devserver", devServer)
|
||||
}
|
||||
|
||||
if loglevel != "" {
|
||||
level, err := pkglogger.StringToLogLevel(loglevel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Only set the log level if it's different from the appoptions.LogLevel
|
||||
if level != appoptions.LogLevel {
|
||||
myLogger.SetLogLevel(level)
|
||||
}
|
||||
}
|
||||
|
||||
// Attach logger to context
|
||||
ctx = context.WithValue(ctx, "logger", myLogger)
|
||||
ctx = context.WithValue(ctx, "buildtype", "dev")
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ type Options struct {
|
|||
Obfuscated bool // Indicates that bound methods should be obfuscated
|
||||
GarbleArgs string // The arguments for Garble
|
||||
SkipBindings bool // Skip binding generation
|
||||
SkipEmbedCreate bool // Skip creation of embed files
|
||||
}
|
||||
|
||||
// Build the project!
|
||||
|
|
@ -120,8 +121,10 @@ func Build(options *Options) (string, error) {
|
|||
}
|
||||
|
||||
// Create embed directories if they don't exist
|
||||
if err := CreateEmbedDirectories(cwd, options); err != nil {
|
||||
return "", err
|
||||
if !options.SkipEmbedCreate {
|
||||
if err := CreateEmbedDirectories(cwd, options); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
// Generate bindings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue