[v2] NSIS installer support for Windows (#1184)

* [v2] Add support for post build hooks

Currently only supports build-level hooks

* [v2] Improve build assets handling and use single source for manifest generation

The manifest asset files are now a go template and data will be
resolved before they are included into the build output.

Breaking Change: Windows manifest file must be named
“wails.exe.manifest” and doesn’t depend on the project name
anymore.

* [v2, windows] NSIS installer generation
This commit is contained in:
stffabi
2022-03-02 19:44:31 +11:00
committed by GitHub
parent c63b1f1981
commit b02dbfaddf
27 changed files with 781 additions and 166 deletions
@@ -0,0 +1,21 @@
package webview2runtime
import (
_ "embed"
"os"
"path/filepath"
)
//go:embed MicrosoftEdgeWebview2Setup.exe
var setupexe []byte
// WriteInstallerToFile writes the installer file to the given file.
func WriteInstallerToFile(targetFile string) error {
return os.WriteFile(targetFile, setupexe, 0755)
}
// WriteInstaller writes the installer exe file to the given directory and returns the path to it.
func WriteInstaller(targetPath string) (string, error) {
installer := filepath.Join(targetPath, `MicrosoftEdgeWebview2Setup.exe`)
return installer, WriteInstallerToFile(installer)
}
@@ -14,9 +14,6 @@ import (
"unsafe"
)
//go:embed MicrosoftEdgeWebview2Setup.exe
var setupexe []byte
// Info contains all the information about an installation of the webview2 runtime.
type Info struct {
Location string
@@ -170,9 +167,3 @@ func OpenInstallerDownloadWebpage() error {
cmd := exec.Command("rundll32", "url.dll,FileProtocolHandler", "https://developer.microsoft.com/en-us/microsoft-edge/webview2/")
return cmd.Run()
}
// WriteInstaller writes the installer exe file to the given path
func WriteInstaller(targetPath string) (string, error) {
installer := filepath.Join(targetPath, `MicrosoftEdgeWebview2Setup.exe`)
return installer, os.WriteFile(installer, setupexe, 0755)
}