From ba6538da7c356b0deb1aaa879d2d3dfa5b88ef79 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 10 Oct 2020 13:57:32 +1100 Subject: [PATCH] Made go runtime package public. Using loglevel store to keep loglevel in sync --- v2/internal/app/desktop.go | 12 ++++- v2/internal/binding/boundMethod.go | 2 +- v2/internal/ffenestri/ffenestri.go | 3 +- v2/internal/ffenestri/ffenestri.h | 2 +- v2/internal/ffenestri/ffenestri_darwin.c | 14 ++++-- v2/internal/runtime/js/core/main.js | 1 + v2/internal/subsystem/binding.go | 6 +-- v2/internal/subsystem/call.go | 11 ++--- v2/internal/subsystem/log.go | 18 +++++-- v2/internal/subsystem/runtime.go | 8 ++-- v2/pkg/options/default.go | 8 ++-- .../goruntime => pkg/runtime}/browser.go | 2 +- .../goruntime => pkg/runtime}/browser_test.go | 2 +- .../goruntime => pkg/runtime}/dialog.go | 2 +- .../goruntime => pkg/runtime}/events.go | 2 +- .../runtime/goruntime => pkg/runtime}/log.go | 2 +- .../goruntime => pkg/runtime}/runtime.go | 7 ++- .../goruntime => pkg/runtime}/store.go | 8 ++-- .../goruntime => pkg/runtime}/system.go | 2 +- .../goruntime => pkg/runtime}/window.go | 2 +- v2/test/kitchensink/go.mod | 1 + v2/test/kitchensink/go.sum | 48 +++++++++++++++++++ v2/wails.go | 6 +-- 23 files changed, 125 insertions(+), 44 deletions(-) rename v2/{internal/runtime/goruntime => pkg/runtime}/browser.go (97%) rename v2/{internal/runtime/goruntime => pkg/runtime}/browser_test.go (94%) rename v2/{internal/runtime/goruntime => pkg/runtime}/dialog.go (99%) rename v2/{internal/runtime/goruntime => pkg/runtime}/events.go (99%) rename v2/{internal/runtime/goruntime => pkg/runtime}/log.go (98%) rename v2/{internal/runtime/goruntime => pkg/runtime}/runtime.go (86%) rename v2/{internal/runtime/goruntime => pkg/runtime}/store.go (96%) rename v2/{internal/runtime/goruntime => pkg/runtime}/system.go (98%) rename v2/{internal/runtime/goruntime => pkg/runtime}/window.go (99%) diff --git a/v2/internal/app/desktop.go b/v2/internal/app/desktop.go index 1eb512ab7..47f935435 100644 --- a/v2/internal/app/desktop.go +++ b/v2/internal/app/desktop.go @@ -11,6 +11,7 @@ import ( "github.com/wailsapp/wails/v2/internal/signal" "github.com/wailsapp/wails/v2/internal/subsystem" "github.com/wailsapp/wails/v2/pkg/options" + "github.com/wailsapp/wails/v2/pkg/runtime" ) // App defines a Wails application structure @@ -19,6 +20,7 @@ type App struct { servicebus *servicebus.ServiceBus logger *logger.Logger signal *signal.Manager + options *options.App // Subsystems log *subsystem.Log @@ -33,6 +35,9 @@ type App struct { // This is our binding DB bindings *binding.Bindings + + // LogLevel Store + loglevelStore *runtime.Store } // Create App @@ -54,6 +59,8 @@ func CreateApp(options *options.App) *App { bindings: binding.NewBindings(myLogger), } + result.options = options + // Initialise the app result.Init() @@ -84,6 +91,9 @@ func (a *App) Run() error { a.runtime = runtime a.runtime.Start() + // Application Stores + a.loglevelStore = a.runtime.GoRuntime().Store.New("loglevel", a.options.LogLevel) + // Start the binding subsystem binding, err := subsystem.NewBinding(a.servicebus, a.logger, a.bindings, a.runtime.GoRuntime()) if err != nil { @@ -93,7 +103,7 @@ func (a *App) Run() error { a.binding.Start() // Start the logging subsystem - log, err := subsystem.NewLog(a.servicebus, a.logger) + log, err := subsystem.NewLog(a.servicebus, a.logger, a.loglevelStore) if err != nil { return err } diff --git a/v2/internal/binding/boundMethod.go b/v2/internal/binding/boundMethod.go index cdb192a53..e77867349 100644 --- a/v2/internal/binding/boundMethod.go +++ b/v2/internal/binding/boundMethod.go @@ -34,7 +34,7 @@ func (b *BoundMethod) VerifyWailsInit() error { } // Check input type - if !b.Inputs[0].IsType("*goruntime.Runtime") { + if !b.Inputs[0].IsType("*runtime.Runtime") { return fmt.Errorf("invalid method signature for %s: expected `WailsInit(*wails.Runtime) error`", b.Name) } diff --git a/v2/internal/ffenestri/ffenestri.go b/v2/internal/ffenestri/ffenestri.go index 41b213c95..0a0cfef96 100644 --- a/v2/internal/ffenestri/ffenestri.go +++ b/v2/internal/ffenestri/ffenestri.go @@ -116,7 +116,8 @@ func (a *Application) Run(incomingDispatcher Dispatcher, bindings string) error devtools := a.bool2Cint(a.config.DevTools) fullscreen := a.bool2Cint(a.config.Fullscreen) startHidden := a.bool2Cint(a.config.StartHidden) - app := C.NewApplication(title, width, height, resizable, devtools, fullscreen, startHidden) + logLevel := C.int(a.config.LogLevel) + app := C.NewApplication(title, width, height, resizable, devtools, fullscreen, startHidden, logLevel) // Save app reference a.app = unsafe.Pointer(app) diff --git a/v2/internal/ffenestri/ffenestri.h b/v2/internal/ffenestri/ffenestri.h index 52b3e83ae..cc16a8d88 100644 --- a/v2/internal/ffenestri/ffenestri.h +++ b/v2/internal/ffenestri/ffenestri.h @@ -3,7 +3,7 @@ #include -extern void *NewApplication(const char *title, int width, int height, int resizable, int devtools, int fullscreen, int startHidden); +extern void *NewApplication(const char *title, int width, int height, int resizable, int devtools, int fullscreen, int startHidden, int logLevel); extern void SetMinWindowSize(void *app, int minWidth, int minHeight); extern void SetMaxWindowSize(void *app, int maxWidth, int maxHeight); extern void Run(void *app, int argc, char **argv); diff --git a/v2/internal/ffenestri/ffenestri_darwin.c b/v2/internal/ffenestri/ffenestri_darwin.c index 5ae36f918..e051cc3e4 100644 --- a/v2/internal/ffenestri/ffenestri_darwin.c +++ b/v2/internal/ffenestri/ffenestri_darwin.c @@ -139,6 +139,7 @@ struct Application { const char *appearance; int decorations; bool dragging; + int logLevel; // Features int frame; @@ -325,7 +326,7 @@ void themeChanged(id self, SEL cmd, id sender) { // Debug(app, "willFinishLaunching called!"); // } -void* NewApplication(const char *title, int width, int height, int resizable, int devtools, int fullscreen, int startHidden) { +void* NewApplication(const char *title, int width, int height, int resizable, int devtools, int fullscreen, int startHidden, int logLevel) { // Setup main application struct struct Application *result = malloc(sizeof(struct Application)); result->title = title; @@ -343,6 +344,7 @@ void* NewApplication(const char *title, int width, int height, int resizable, in result->minimised = 0; result->startHidden = startHidden; result->decorations = 0; + result->logLevel = logLevel; result->mainWindow = NULL; result->mouseEvent = NULL; @@ -869,11 +871,17 @@ void createMainWindow(struct Application *app) { } const char* getInitialState(struct Application *app) { + const char *result = ""; if( isDarkMode(app) ) { - return "window.wails.System.IsDarkMode.set(true);"; + result = "window.wails.System.IsDarkMode.set(true);"; } else { - return "window.wails.System.IsDarkMode.set(false);"; + result = "window.wails.System.IsDarkMode.set(false);"; } + char buffer[999]; + snprintf(&buffer[0], sizeof(buffer), "window.wails.System.LogLevel.set(%d);", app->logLevel); + result = concat(result, &buffer[0]); + Debug(app, "initialstate = %s", result); + return result; } void Run(struct Application *app, int argc, char **argv) { diff --git a/v2/internal/runtime/js/core/main.js b/v2/internal/runtime/js/core/main.js index 2a9b57790..fea985628 100644 --- a/v2/internal/runtime/js/core/main.js +++ b/v2/internal/runtime/js/core/main.js @@ -49,6 +49,7 @@ export function Init() { // Setup system window.wails.System.IsDarkMode = Store.New('isdarkmode'); + window.wails.System.LogLevel = Store.New('loglevel'); // Do platform specific Init Platform.Init(); diff --git a/v2/internal/subsystem/binding.go b/v2/internal/subsystem/binding.go index 55c712b75..7cbbe71ce 100644 --- a/v2/internal/subsystem/binding.go +++ b/v2/internal/subsystem/binding.go @@ -3,8 +3,8 @@ package subsystem import ( "github.com/wailsapp/wails/v2/internal/binding" "github.com/wailsapp/wails/v2/internal/logger" - "github.com/wailsapp/wails/v2/internal/runtime/goruntime" "github.com/wailsapp/wails/v2/internal/servicebus" + "github.com/wailsapp/wails/v2/pkg/runtime" ) // Binding is the Binding subsystem. It manages all service bus messages @@ -21,11 +21,11 @@ type Binding struct { logger logger.CustomLogger // runtime - runtime *goruntime.Runtime + runtime *runtime.Runtime } // NewBinding creates a new binding subsystem. Uses the given bindings db for reference. -func NewBinding(bus *servicebus.ServiceBus, logger *logger.Logger, bindings *binding.Bindings, runtime *goruntime.Runtime) (*Binding, error) { +func NewBinding(bus *servicebus.ServiceBus, logger *logger.Logger, bindings *binding.Bindings, runtime *runtime.Runtime) (*Binding, error) { // Register quit channel quitChannel, err := bus.Subscribe("quit") diff --git a/v2/internal/subsystem/call.go b/v2/internal/subsystem/call.go index 544071174..28c598225 100644 --- a/v2/internal/subsystem/call.go +++ b/v2/internal/subsystem/call.go @@ -9,8 +9,7 @@ import ( "github.com/wailsapp/wails/v2/internal/logger" "github.com/wailsapp/wails/v2/internal/messagedispatcher/message" "github.com/wailsapp/wails/v2/internal/servicebus" - "github.com/wailsapp/wails/v2/internal/runtime/goruntime" - + "github.com/wailsapp/wails/v2/pkg/runtime" ) // Call is the Call subsystem. It manages all service bus messages @@ -30,11 +29,11 @@ type Call struct { logger logger.CustomLogger // runtime - runtime *goruntime.Runtime + runtime *runtime.Runtime } // NewCall creates a new call subsystem -func NewCall(bus *servicebus.ServiceBus, logger *logger.Logger, DB *binding.DB, runtime *goruntime.Runtime) (*Call, error) { +func NewCall(bus *servicebus.ServiceBus, logger *logger.Logger, DB *binding.DB, runtime *runtime.Runtime) (*Call, error) { // Register quit channel quitChannel, err := bus.Subscribe("quit") @@ -54,7 +53,7 @@ func NewCall(bus *servicebus.ServiceBus, logger *logger.Logger, DB *binding.DB, logger: logger.CustomLogger("Call Subsystem"), DB: DB, bus: bus, - runtime: runtime, + runtime: runtime, } return result, nil @@ -122,7 +121,7 @@ func (c *Call) processSystemCall(payload *message.CallMessage, clientID string) c.logger.Trace("Got internal System call: %+v", payload) callName := strings.TrimPrefix(payload.Name, ".wails.") switch callName { - case "IsDarkMode": + case "IsDarkMode": darkModeEnabled := c.runtime.System.IsDarkMode() c.sendResult(darkModeEnabled, payload, clientID) } diff --git a/v2/internal/subsystem/log.go b/v2/internal/subsystem/log.go index 1472cc345..ccb8dde4a 100644 --- a/v2/internal/subsystem/log.go +++ b/v2/internal/subsystem/log.go @@ -6,6 +6,7 @@ import ( "github.com/wailsapp/wails/v2/internal/logger" "github.com/wailsapp/wails/v2/internal/servicebus" + "github.com/wailsapp/wails/v2/pkg/runtime" ) // Log is the Logging subsystem. It handles messages with topics starting @@ -17,10 +18,13 @@ type Log struct { // Logger! logger *logger.Logger + + // Loglevel store + logLevelStore *runtime.Store } // NewLog creates a new log subsystem -func NewLog(bus *servicebus.ServiceBus, logger *logger.Logger) (*Log, error) { +func NewLog(bus *servicebus.ServiceBus, logger *logger.Logger, logLevelStore *runtime.Store) (*Log, error) { // Subscribe to log messages logChannel, err := bus.Subscribe("log") @@ -35,9 +39,10 @@ func NewLog(bus *servicebus.ServiceBus, logger *logger.Logger) (*Log, error) { } result := &Log{ - logChannel: logChannel, - quitChannel: quitChannel, - logger: logger, + logChannel: logChannel, + quitChannel: quitChannel, + logger: logger, + logLevelStore: logLevelStore, } return result, nil @@ -76,13 +81,16 @@ func (l *Log) Start() error { switch inLevel := logMessage.Data().(type) { case logger.LogLevel: l.logger.SetLogLevel(inLevel) + l.logLevelStore.Set(inLevel) case string: uint64level, err := strconv.ParseUint(inLevel, 10, 8) if err != nil { l.logger.Error("Error parsing log level: %+v", inLevel) continue } - l.logger.SetLogLevel(logger.LogLevel(uint64level)) + level := logger.LogLevel(uint64level) + l.logLevelStore.Set(level) + l.logger.SetLogLevel(level) } default: diff --git a/v2/internal/subsystem/runtime.go b/v2/internal/subsystem/runtime.go index 5ebc66963..08d1ddbaa 100644 --- a/v2/internal/subsystem/runtime.go +++ b/v2/internal/subsystem/runtime.go @@ -5,8 +5,8 @@ import ( "strings" "github.com/wailsapp/wails/v2/internal/logger" - "github.com/wailsapp/wails/v2/internal/runtime/goruntime" "github.com/wailsapp/wails/v2/internal/servicebus" + "github.com/wailsapp/wails/v2/pkg/runtime" ) // Runtime is the Runtime subsystem. It handles messages with topics starting @@ -19,7 +19,7 @@ type Runtime struct { logger logger.CustomLogger // Runtime library - runtime *goruntime.Runtime + runtime *runtime.Runtime } // NewRuntime creates a new runtime subsystem @@ -41,7 +41,7 @@ func NewRuntime(bus *servicebus.ServiceBus, logger *logger.Logger) (*Runtime, er quitChannel: quitChannel, runtimeChannel: runtimeChannel, logger: logger.CustomLogger("Runtime Subsystem"), - runtime: goruntime.New(bus), + runtime: runtime.New(bus), } return result, nil @@ -93,7 +93,7 @@ func (r *Runtime) Start() error { } // GoRuntime returns the Go Runtime object -func (r *Runtime) GoRuntime() *goruntime.Runtime { +func (r *Runtime) GoRuntime() *runtime.Runtime { return r.runtime } diff --git a/v2/pkg/options/default.go b/v2/pkg/options/default.go index 53bb2b4fc..90f11ce01 100644 --- a/v2/pkg/options/default.go +++ b/v2/pkg/options/default.go @@ -1,9 +1,10 @@ package options -import ( - "github.com/wailsapp/wails/v2/pkg/options/mac" +import ( "github.com/wailsapp/wails/v2/pkg/logger" + "github.com/wailsapp/wails/v2/pkg/options/mac" ) + // Default options for creating the App var Default = &App{ Title: "My Wails App", @@ -17,5 +18,6 @@ var Default = &App{ WebviewIsTransparent: false, WindowBackgroundIsTranslucent: false, }, - Logger: logger.NewDefaultLogger(), + Logger: logger.NewDefaultLogger(), + LogLevel: logger.INFO, } diff --git a/v2/internal/runtime/goruntime/browser.go b/v2/pkg/runtime/browser.go similarity index 97% rename from v2/internal/runtime/goruntime/browser.go rename to v2/pkg/runtime/browser.go index 0fc2416ae..c4fb8b5ff 100644 --- a/v2/internal/runtime/goruntime/browser.go +++ b/v2/pkg/runtime/browser.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import ( "fmt" diff --git a/v2/internal/runtime/goruntime/browser_test.go b/v2/pkg/runtime/browser_test.go similarity index 94% rename from v2/internal/runtime/goruntime/browser_test.go rename to v2/pkg/runtime/browser_test.go index 73a000a00..b5d8a8356 100644 --- a/v2/internal/runtime/goruntime/browser_test.go +++ b/v2/pkg/runtime/browser_test.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import ( "os" diff --git a/v2/internal/runtime/goruntime/dialog.go b/v2/pkg/runtime/dialog.go similarity index 99% rename from v2/internal/runtime/goruntime/dialog.go rename to v2/pkg/runtime/dialog.go index 0fc304ddb..094f50312 100644 --- a/v2/internal/runtime/goruntime/dialog.go +++ b/v2/pkg/runtime/dialog.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import ( "fmt" diff --git a/v2/internal/runtime/goruntime/events.go b/v2/pkg/runtime/events.go similarity index 99% rename from v2/internal/runtime/goruntime/events.go rename to v2/pkg/runtime/events.go index d370f5fec..5b7211410 100644 --- a/v2/internal/runtime/goruntime/events.go +++ b/v2/pkg/runtime/events.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import ( "github.com/wailsapp/wails/v2/internal/messagedispatcher/message" diff --git a/v2/internal/runtime/goruntime/log.go b/v2/pkg/runtime/log.go similarity index 98% rename from v2/internal/runtime/goruntime/log.go rename to v2/pkg/runtime/log.go index b31b827c1..16f258eed 100644 --- a/v2/internal/runtime/goruntime/log.go +++ b/v2/pkg/runtime/log.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import ( "github.com/wailsapp/wails/v2/internal/servicebus" diff --git a/v2/internal/runtime/goruntime/runtime.go b/v2/pkg/runtime/runtime.go similarity index 86% rename from v2/internal/runtime/goruntime/runtime.go rename to v2/pkg/runtime/runtime.go index 42ce1f160..51dd99fd8 100644 --- a/v2/internal/runtime/goruntime/runtime.go +++ b/v2/pkg/runtime/runtime.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import "github.com/wailsapp/wails/v2/internal/servicebus" @@ -9,13 +9,14 @@ type Runtime struct { Window Window Dialog Dialog System System + Store *StoreProvider Log Log bus *servicebus.ServiceBus } // New creates a new runtime func New(serviceBus *servicebus.ServiceBus) *Runtime { - return &Runtime{ + result := &Runtime{ Browser: newBrowser(), Events: newEvents(serviceBus), Window: newWindow(serviceBus), @@ -24,6 +25,8 @@ func New(serviceBus *servicebus.ServiceBus) *Runtime { Log: newLog(serviceBus), bus: serviceBus, } + result.Store = newStore(result) + return result } // Quit the application diff --git a/v2/internal/runtime/goruntime/store.go b/v2/pkg/runtime/store.go similarity index 96% rename from v2/internal/runtime/goruntime/store.go rename to v2/pkg/runtime/store.go index bf554fae8..c63c81bee 100644 --- a/v2/internal/runtime/goruntime/store.go +++ b/v2/pkg/runtime/store.go @@ -1,6 +1,6 @@ -// Package goruntime contains all the methods and data structures related to the +// package runtime contains all the methods and data structures related to the // runtime library of Wails. This includes both Go and JS runtimes. -package goruntime +package runtime import ( "bytes" @@ -32,8 +32,8 @@ type StoreProvider struct { runtime *Runtime } -// NewStoreProvider creates new stores using the provided Runtime reference. -func NewStoreProvider(runtime *Runtime) *StoreProvider { +// newStore creates new stores using the provided Runtime reference. +func newStore(runtime *Runtime) *StoreProvider { return &StoreProvider{ runtime: runtime, } diff --git a/v2/internal/runtime/goruntime/system.go b/v2/pkg/runtime/system.go similarity index 98% rename from v2/internal/runtime/goruntime/system.go rename to v2/pkg/runtime/system.go index 6c53b1a61..ca5099c69 100644 --- a/v2/internal/runtime/goruntime/system.go +++ b/v2/pkg/runtime/system.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import ( "fmt" diff --git a/v2/internal/runtime/goruntime/window.go b/v2/pkg/runtime/window.go similarity index 99% rename from v2/internal/runtime/goruntime/window.go rename to v2/pkg/runtime/window.go index 7c478da7f..c5739bc18 100644 --- a/v2/internal/runtime/goruntime/window.go +++ b/v2/pkg/runtime/window.go @@ -1,4 +1,4 @@ -package goruntime +package runtime import ( "github.com/wailsapp/wails/v2/internal/servicebus" diff --git a/v2/test/kitchensink/go.mod b/v2/test/kitchensink/go.mod index 60b5ad2f1..35ea3df8c 100644 --- a/v2/test/kitchensink/go.mod +++ b/v2/test/kitchensink/go.mod @@ -3,6 +3,7 @@ module test go 1.13 require ( + github.com/wailsapp/wails v1.8.0 github.com/wailsapp/wails/v2 v2.0.0-alpha ) diff --git a/v2/test/kitchensink/go.sum b/v2/test/kitchensink/go.sum index 69a380c55..267a19fc2 100644 --- a/v2/test/kitchensink/go.sum +++ b/v2/test/kitchensink/go.sum @@ -1,11 +1,17 @@ +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= +github.com/abadojack/whatlanggo v1.0.1 h1:19N6YogDnf71CTHm3Mp2qhYfkRdyvbgwWdd2EPxJRG4= +github.com/abadojack/whatlanggo v1.0.1/go.mod h1:66WiQbSbJBIlOZMsvbKe5m6pzQovxCH9B/K8tQB2uoc= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/colors v1.2.0/go.mod h1:miw1R2JIE19cclPxsXqNdzLZsk4DP4iF+m88bRc7kfM= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= @@ -16,30 +22,59 @@ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaW github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/jackmordaunt/icns v1.0.0/go.mod h1:7TTQVEuGzVVfOPPlLNHJIkzA6CoV7aH1Dv9dW351oOo= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leaanthony/clir v1.0.4/go.mod h1:k/RBkdkFl18xkkACMCLt09bhiZnrGORoxmomeMvDpE0= github.com/leaanthony/gosod v0.0.4/go.mod h1:nGMCb1PJfXwBDbOAike78jEYlpqge+xUKFf0iBKjKxU= +github.com/leaanthony/mewn v0.10.7/go.mod h1:CRkTx8unLiSSilu/Sd7i1LwrdaAL+3eQ3ses99qGMEQ= +github.com/leaanthony/slicer v1.4.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY= github.com/leaanthony/slicer v1.4.1/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY= +github.com/leaanthony/spinner v0.5.3/go.mod h1:oHlrvWicr++CVV7ALWYi+qHk/XNA91D9IJ48IqmpVUo= +github.com/leaanthony/synx v0.1.0/go.mod h1:Iz7eybeeG8bdq640iR+CwYb8p+9EOsgMWghkSRyZcqs= +github.com/leaanthony/wincursor v0.1.0/go.mod h1:7TVwwrzSH/2Y9gLOGH+VhA+bZhoWXBRgbGNTMk+yimE= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= +github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba/go.mod h1:iLnlXG2Pakcii2CU0cbY07DRCSvpWNa7nFxtevhOChk= github.com/tdewolff/minify v2.3.6+incompatible/go.mod h1:9Ov578KJUmAWpS6NeZwRZyT56Uf6o3Mcz9CEsg8USYs= github.com/tdewolff/minify/v2 v2.9.5/go.mod h1:jshtBj/uUJH6JX1fuxTLnnHOA1RVJhF5MM+leJzDKb4= github.com/tdewolff/parse v2.3.4+incompatible/go.mod h1:8oBwCsVmUkgHO8M5iCzSIDtpzXOT0WXX9cWhz+bIzJQ= @@ -47,24 +82,35 @@ github.com/tdewolff/parse/v2 v2.5.3/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1I github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/wailsapp/wails v1.8.0 h1:gnQhpwoGM8s2GD5PZrgMKU1PO3pQ9cdKKJgwtkNz2f4= +github.com/wailsapp/wails v1.8.0/go.mod h1:XFZunea+USOCMMgBlz0A0JHLL3oWrRhnOl4baZlRpxo= github.com/xyproto/xpm v1.2.1/go.mod h1:cMnesLsD0PBXLgjDfTDEaKr8XyTFsnP1QycSqRw7BiY= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c= golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -74,9 +120,11 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/AlecAivazis/survey.v1 v1.8.4/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= diff --git a/v2/wails.go b/v2/wails.go index 02433eaae..8f8a53852 100644 --- a/v2/wails.go +++ b/v2/wails.go @@ -4,12 +4,12 @@ package wails import ( "github.com/wailsapp/wails/v2/internal/app" - "github.com/wailsapp/wails/v2/internal/runtime/goruntime" "github.com/wailsapp/wails/v2/pkg/options" + "github.com/wailsapp/wails/v2/pkg/runtime" ) -// Runtime is an alias for the goruntime.Runtime struct -type Runtime = goruntime.Runtime +// Runtime is an alias for the runtime.Runtime struct +type Runtime = runtime.Runtime // CreateAppWithOptions creates an application based on the given config func CreateAppWithOptions(options *options.App) *app.App {