From 2881a5bc0dbba12b0960e6f923374f864377045f Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Wed, 28 Apr 2021 15:44:29 +1000 Subject: [PATCH] [windows] output required DLLs on build --- v2/internal/ffenestri/windows/x64/x64.go | 9 +++++++++ v2/pkg/commands/build/base.go | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 v2/internal/ffenestri/windows/x64/x64.go diff --git a/v2/internal/ffenestri/windows/x64/x64.go b/v2/internal/ffenestri/windows/x64/x64.go new file mode 100644 index 00000000..7fe5990b --- /dev/null +++ b/v2/internal/ffenestri/windows/x64/x64.go @@ -0,0 +1,9 @@ +package x64 + +import _ "embed" + +//go:embed webview.dll +var WebView2 []byte + +//go:embed WebView2Loader.dll +var WebView2Loader []byte diff --git a/v2/pkg/commands/build/base.go b/v2/pkg/commands/build/base.go index 375079c9..3f7cfd5f 100644 --- a/v2/pkg/commands/build/base.go +++ b/v2/pkg/commands/build/base.go @@ -3,6 +3,7 @@ package build import ( "bytes" "fmt" + "github.com/wailsapp/wails/v2/internal/ffenestri/windows/x64" "io/ioutil" "os" "os/exec" @@ -294,6 +295,18 @@ func (b *BaseBuilder) CompileProject(options *Options) error { return fmt.Errorf("%s\n%s", err, string(stde.Bytes())) } + // If we are targeting windows, dump the DLLs + if options.Platform == "windows" { + err := os.WriteFile(filepath.Join(appDir, "webview2.dll"), x64.WebView2, 0755) + if err != nil { + return err + } + err = os.WriteFile(filepath.Join(appDir, "WebView2Loader.dll"), x64.WebView2Loader, 0755) + if err != nil { + return err + } + } + if !options.Compress { return nil }