[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
+45
View File
@@ -46,9 +46,25 @@ type Project struct {
// The platform to target
Platform string
// RunNonNativeBuildHooks will run build hooks though they are defined for a GOOS which is not equal to the host os
RunNonNativeBuildHooks bool `json:"runNonNativeBuildHooks"`
// Post build hooks for different targets, the hooks are executed in the following order
// Key: GOOS/GOARCH - Executed at build level after a build of the specific platform and arch
// Key: GOOS/* - Executed at build level after a build of the specific platform
// Key: */* - Executed at build level after a build
// The following keys are not yet supported.
// Key: GOOS - Executed at platform level after all builds of the specific platform
// Key: * - Executed at platform level after all builds of a platform
// Key: [empty] - Executed at global level after all builds of all platforms
PostBuildHooks map[string]string `json:"postBuildHooks"`
// The application author
Author Author
// The application information
Info Info
// Fully qualified filename
filename string
@@ -60,6 +76,9 @@ type Project struct {
// Arguments that are forwared to the application in dev mode
AppArgs string `json:"appargs"`
// NSISType to be build
NSISType string `json:"nsisType"`
}
func (p *Project) Save() error {
@@ -76,6 +95,14 @@ type Author struct {
Email string `json:"email"`
}
type Info struct {
CompanyName string `json:"companyName"`
ProductName string `json:"productName"`
ProductVersion string `json:"productVersion"`
Copyright *string `json:"copyright"`
Comments *string `json:"comments"`
}
// Load the project from the current working directory
func Load(projectPath string) (*Project, error) {
@@ -117,6 +144,24 @@ func Load(projectPath string) (*Project, error) {
}
}
if result.Info.CompanyName == "" {
result.Info.CompanyName = result.Name
}
if result.Info.ProductName == "" {
result.Info.ProductName = result.Name
}
if result.Info.ProductVersion == "" {
result.Info.ProductVersion = "1.0.0"
}
if result.Info.Copyright == nil {
v := "Copyright........."
result.Info.Copyright = &v
}
if result.Info.Comments == nil {
v := "Built using Wails (https://wails.app)"
result.Info.Comments = &v
}
// Return our project data
return &result, nil
}