mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 23:51:44 +08:00
Merge pull request #53 from wailsapp/adjust-windows-build-behaviour
package by default. -p leaves resource artefacts
This commit is contained in:
commit
2dad29673d
16
cmd/fs.go
16
cmd/fs.go
@ -80,6 +80,22 @@ func (fs *FSHelper) Cwd() string {
|
|||||||
return cwd
|
return cwd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFile removes the given filename
|
||||||
|
func (fs *FSHelper) RemoveFile(filename string) error {
|
||||||
|
return os.Remove(filename)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFiles removes the given filenames
|
||||||
|
func (fs *FSHelper) RemoveFiles(files []string) error {
|
||||||
|
for _, filename := range files {
|
||||||
|
err := os.Remove(filename)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetSubdirs will return a list of FQPs to subdirectories in the given directory
|
// GetSubdirs will return a list of FQPs to subdirectories in the given directory
|
||||||
func (fs *FSHelper) GetSubdirs(dir string) (map[string]string, error) {
|
func (fs *FSHelper) GetSubdirs(dir string) (map[string]string, error) {
|
||||||
|
|
||||||
|
@ -50,8 +50,9 @@ func InstallGoDependencies() error {
|
|||||||
func BuildApplication(binaryName string, forceRebuild bool, buildMode string, packageApp bool, projectOptions *ProjectOptions) error {
|
func BuildApplication(binaryName string, forceRebuild bool, buildMode string, packageApp bool, projectOptions *ProjectOptions) error {
|
||||||
|
|
||||||
// Generate Windows assets if needed
|
// Generate Windows assets if needed
|
||||||
if runtime.GOOS == "windows" && packageApp {
|
if runtime.GOOS == "windows" {
|
||||||
err := PackageApplication(projectOptions)
|
cleanUp := !packageApp
|
||||||
|
err := NewPackageHelper().PackageWindows(projectOptions, cleanUp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -107,14 +108,6 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
|
|||||||
}
|
}
|
||||||
packSpinner.Success()
|
packSpinner.Success()
|
||||||
|
|
||||||
// Package application
|
|
||||||
if runtime.GOOS != "windows" && packageApp {
|
|
||||||
err = PackageApplication(projectOptions)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ func (b *PackageHelper) Package(po *ProjectOptions) error {
|
|||||||
}
|
}
|
||||||
return b.packageOSX(po)
|
return b.packageOSX(po)
|
||||||
case "windows":
|
case "windows":
|
||||||
return b.packageWindows(po)
|
return b.PackageWindows(po, true)
|
||||||
case "linux":
|
case "linux":
|
||||||
return fmt.Errorf("linux is not supported at this time. Please see https://github.com/wailsapp/wails/issues/2")
|
return fmt.Errorf("linux is not supported at this time. Please see https://github.com/wailsapp/wails/issues/2")
|
||||||
default:
|
default:
|
||||||
@ -150,7 +150,7 @@ func (b *PackageHelper) packageOSX(po *ProjectOptions) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *PackageHelper) packageWindows(po *ProjectOptions) error {
|
func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
|
||||||
basename := strings.TrimSuffix(po.BinaryName, ".exe")
|
basename := strings.TrimSuffix(po.BinaryName, ".exe")
|
||||||
|
|
||||||
// Copy icon
|
// Copy icon
|
||||||
@ -196,6 +196,15 @@ func (b *PackageHelper) packageWindows(po *ProjectOptions) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
if cleanUp {
|
||||||
|
filesToDelete := []string{tgtIconFile, tgtManifestFile, tgtRCFile}
|
||||||
|
err := b.fs.RemoveFiles(filesToDelete)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user