mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[windows-x] Huge updates to devmode, runtime, build command.
This commit is contained in:
@@ -201,7 +201,7 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
|
||||
commands := slicer.String([]string{"build"})
|
||||
|
||||
// Add better debugging flags
|
||||
if options.Mode == Debug {
|
||||
if options.Mode == Dev {
|
||||
commands.Add("-gcflags")
|
||||
commands.Add(`"all=-N -l"`)
|
||||
}
|
||||
@@ -222,9 +222,6 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
|
||||
tags.Add(options.WebView2Strategy)
|
||||
}
|
||||
|
||||
if options.Mode == Debug {
|
||||
tags.Add("debug")
|
||||
}
|
||||
tags.Deduplicate()
|
||||
|
||||
// Add the output type build tag
|
||||
@@ -517,7 +514,8 @@ func (b *BaseBuilder) BuildFrontend(outputLogger *clilogger.CLILogger) error {
|
||||
func (b *BaseBuilder) ExtractAssets() (*html.AssetBundle, error) {
|
||||
|
||||
// Read in html
|
||||
return html.NewAssetBundle(b.projectData.HTML)
|
||||
//return html.NewAssetBundle(b.projectData.HTML)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func upsertEnv(env []string, key string, update func(v string) string) []string {
|
||||
|
||||
@@ -19,8 +19,8 @@ import (
|
||||
type Mode int
|
||||
|
||||
const (
|
||||
// Debug mode
|
||||
Debug Mode = iota
|
||||
// Dev mode
|
||||
Dev Mode = iota
|
||||
// Production mode
|
||||
Production
|
||||
)
|
||||
@@ -31,7 +31,7 @@ type Options struct {
|
||||
UserTags []string // Tags to pass to the Go compiler
|
||||
Logger *clilogger.CLILogger // All output to the logger
|
||||
OutputType string // EG: desktop, server....
|
||||
Mode Mode // release or debug or dev
|
||||
Mode Mode // release or dev
|
||||
ProjectData *project.Project // The project data
|
||||
Pack bool // Create a package for the app after building
|
||||
Platform string // The platform to build for
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package mac
|
||||
|
||||
import "github.com/wailsapp/wails/v2/pkg/menu"
|
||||
|
||||
type ActivationPolicy int
|
||||
|
||||
const (
|
||||
@@ -16,9 +14,6 @@ type Options struct {
|
||||
Appearance AppearanceType
|
||||
WebviewIsTransparent bool
|
||||
WindowBackgroundIsTranslucent bool
|
||||
Menu *menu.Menu
|
||||
TrayMenus []*menu.TrayMenu
|
||||
ContextMenus []*menu.ContextMenu
|
||||
ActivationPolicy ActivationPolicy
|
||||
URLHandlers map[string]func(string)
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@ package options
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
"embed"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
||||
|
||||
@@ -29,16 +28,18 @@ type App struct {
|
||||
StartHidden bool
|
||||
HideWindowOnClose bool
|
||||
RGBA int
|
||||
ContextMenus []*menu.ContextMenu
|
||||
TrayMenus []*menu.TrayMenu
|
||||
Assets *embed.FS
|
||||
Menu *menu.Menu
|
||||
Windows *windows.Options
|
||||
Mac *mac.Options
|
||||
Logger logger.Logger `json:"-"`
|
||||
LogLevel logger.LogLevel
|
||||
Startup func(ctx context.Context) `json:"-"`
|
||||
Shutdown func() `json:"-"`
|
||||
Bind []interface{}
|
||||
|
||||
//ContextMenus []*menu.ContextMenu
|
||||
//TrayMenus []*menu.TrayMenu
|
||||
Windows *windows.Options
|
||||
Mac *mac.Options
|
||||
}
|
||||
|
||||
// MergeDefaults will set the minimum default values for an application
|
||||
@@ -74,76 +75,3 @@ func MergeDefaults(appoptions *App) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func GetTrayMenus(appoptions *App) []*menu.TrayMenu {
|
||||
var result []*menu.TrayMenu
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
if appoptions.Mac != nil {
|
||||
result = appoptions.Mac.TrayMenus
|
||||
}
|
||||
//case "linux":
|
||||
// if appoptions.Linux != nil {
|
||||
// result = appoptions.Linux.TrayMenu
|
||||
// }
|
||||
//case "windows":
|
||||
// if appoptions.Windows != nil {
|
||||
// result = appoptions.Windows.TrayMenu
|
||||
// }
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
result = appoptions.TrayMenus
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func GetApplicationMenu(appoptions *App) *menu.Menu {
|
||||
var result *menu.Menu
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
if appoptions.Mac != nil {
|
||||
result = appoptions.Mac.Menu
|
||||
}
|
||||
//case "linux":
|
||||
// if appoptions.Linux != nil {
|
||||
// result = appoptions.Linux.TrayMenu
|
||||
// }
|
||||
case "windows":
|
||||
if appoptions.Windows != nil {
|
||||
result = appoptions.Windows.Menu
|
||||
}
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
result = appoptions.Menu
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func GetContextMenus(appoptions *App) []*menu.ContextMenu {
|
||||
var result []*menu.ContextMenu
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
if appoptions.Mac != nil {
|
||||
result = appoptions.Mac.ContextMenus
|
||||
}
|
||||
//case "linux":
|
||||
// if appoptions.Linux != nil {
|
||||
// result = appoptions.Linux.TrayMenu
|
||||
// }
|
||||
//case "windows":
|
||||
// if appoptions.Windows != nil {
|
||||
// result = appoptions.Windows.TrayMenu
|
||||
// }
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
result = appoptions.ContextMenus
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
package windows
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
||||
)
|
||||
|
||||
// Options are options specific to Windows
|
||||
type Options struct {
|
||||
WebviewIsTransparent bool
|
||||
WindowBackgroundIsTranslucent bool
|
||||
DisableWindowIcon bool
|
||||
Menu *menu.Menu
|
||||
Assets *embed.FS
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user