diff --git a/.gitignore b/.gitignore
index c6fb84333..620386a67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,6 @@ v2/test/kitchensink/frontend/public
v2/test/kitchensink/build/darwin/desktop/kitchensink
v2/test/kitchensink/frontend/package.json.md5
/v2/internal/ffenestri/windows/test/cmake-build-debug/
+!v2/internal/ffenestri/windows/x64/webview2.dll
+!v2/internal/ffenestri/windows/x64/WebView2Loader.dll
.idea/
diff --git a/v2/.vscode/settings.json b/v2/.vscode/settings.json
deleted file mode 100644
index 01d4ec2d2..000000000
--- a/v2/.vscode/settings.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "files.associations": {
- "ios": "c",
- "typeinfo": "c",
- "sstream": "c",
- "__functional_03": "c",
- "functional": "c",
- "__locale": "c",
- "locale": "c",
- "chrono": "c",
- "system_error": "c"
- }
-}
\ No newline at end of file
diff --git a/v2/cmd/wails/internal/commands/initialise/initialise.go b/v2/cmd/wails/internal/commands/initialise/initialise.go
index 04063d740..f83ca10a9 100644
--- a/v2/cmd/wails/internal/commands/initialise/initialise.go
+++ b/v2/cmd/wails/internal/commands/initialise/initialise.go
@@ -2,6 +2,7 @@ package initialise
import (
"fmt"
+ "github.com/wailsapp/wails/v2/pkg/buildassets"
"io"
"strings"
"time"
@@ -40,7 +41,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
// Quiet Init
quiet := false
- command.BoolFlag("q", "Supress output to console", &quiet)
+ command.BoolFlag("q", "Suppress output to console", &quiet)
initGit := false
gitInstalled := git.IsInstalled()
@@ -129,6 +130,12 @@ func initProject(options *templates.Options) error {
return err
}
+ // Install the default assets
+ err = buildassets.Install(options.TargetDir, options.ProjectName)
+ if err != nil {
+ return err
+ }
+
if options.InitGit {
err = initGit(options)
if err != nil {
diff --git a/v2/go.mod b/v2/go.mod
index 87457ccf3..50e44097c 100644
--- a/v2/go.mod
+++ b/v2/go.mod
@@ -10,10 +10,11 @@ require (
github.com/imdario/mergo v0.3.11
github.com/jackmordaunt/icns v1.0.0
github.com/leaanthony/clir v1.0.4
- github.com/leaanthony/debme v1.1.2
+ github.com/leaanthony/debme v1.2.0
github.com/leaanthony/go-ansi-parser v1.0.1
github.com/leaanthony/gosod v1.0.1
github.com/leaanthony/slicer v1.5.0
+ github.com/leaanthony/winicon v0.0.0-20200606125418-4419cea822a0
github.com/matryer/is v1.4.0
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/olekukonko/tablewriter v0.0.4
diff --git a/v2/go.sum b/v2/go.sum
index e4b2e6c3b..18148d495 100644
--- a/v2/go.sum
+++ b/v2/go.sum
@@ -42,14 +42,16 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/leaanthony/clir v1.0.4 h1:Dov2y9zWJmZr7CjaCe86lKa4b5CSxskGAt2yBkoDyiU=
github.com/leaanthony/clir v1.0.4/go.mod h1:k/RBkdkFl18xkkACMCLt09bhiZnrGORoxmomeMvDpE0=
github.com/leaanthony/debme v1.1.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
-github.com/leaanthony/debme v1.1.2 h1:dGeQuj0+xPIlDQzGIjmAU52+yRg85u5pWaaqrdLBjD0=
-github.com/leaanthony/debme v1.1.2/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
+github.com/leaanthony/debme v1.2.0 h1:i7JUQhuv7PtJ/7qV+SIa5QARTGBcojUZ+2eCiV9begU=
+github.com/leaanthony/debme v1.2.0/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4=
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
github.com/leaanthony/gosod v1.0.1 h1:F+4c3DmEBfigi7oAswCV2RpQ+k4DcNbhuCZUGdBHacQ=
github.com/leaanthony/gosod v1.0.1/go.mod h1:W8RyeSFBXu7RpIxPGEJfW4moSyGGEjlJMLV25wEbAdU=
github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0HtY=
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
+github.com/leaanthony/winicon v0.0.0-20200606125418-4419cea822a0 h1:FPGYnfxuuxqCZhrGq8nKjthEcYHgHmFbyY953Xv9cNI=
+github.com/leaanthony/winicon v0.0.0-20200606125418-4419cea822a0/go.mod h1:en5xhijl92aphrJdmRPlh4NI1L6wq3gEm0LpXAPghjU=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
@@ -92,6 +94,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
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 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
+golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
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=
diff --git a/v2/internal/app/server.go b/v2/internal/app/server.go
index 52b8ca28a..620139c4c 100644
--- a/v2/internal/app/server.go
+++ b/v2/internal/app/server.go
@@ -79,7 +79,7 @@ func (a *App) Run() error {
// Default app options
var port = 8080
var ip = "localhost"
- var supressLogging = false
+ var SuppressLogging = false
var debugMode = false
// Create CLI
@@ -89,7 +89,7 @@ func (a *App) Run() error {
cli.IntFlag("p", "Port to serve on", &port)
cli.StringFlag("i", "IP to serve on", &ip)
cli.BoolFlag("d", "Debug mode", &debugMode)
- cli.BoolFlag("q", "Supress logging", &supressLogging)
+ cli.BoolFlag("q", "Suppress logging", &SuppressLogging)
// Setup main action
cli.Action(func() error {
@@ -98,8 +98,8 @@ func (a *App) Run() error {
a.webserver.SetPort(port)
a.webserver.SetIP(ip)
a.webserver.SetBindings(a.bindings)
- // Log information (if we aren't supressing it)
- if !supressLogging {
+ // Log information (if we aren't Suppressing it)
+ if !SuppressLogging {
cli.PrintBanner()
a.logger.Info("Running server at %s", a.webserver.URL())
}
diff --git a/v2/internal/ffenestri/windows/test/CMakeLists.txt b/v2/internal/ffenestri/windows/test/CMakeLists.txt
index fd3246851..304e016fc 100644
--- a/v2/internal/ffenestri/windows/test/CMakeLists.txt
+++ b/v2/internal/ffenestri/windows/test/CMakeLists.txt
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.19)
-project(test C)
+project(test)
-set(CMAKE_C_STANDARD 99)
-set(SOURCES ../../ffenestri_windows.cpp)
+set(CMAKE_CXX_STANDARD 14)
-add_executable(test ${SOURCES} main.c)
\ No newline at end of file
+add_executable(test main.cpp)
\ No newline at end of file
diff --git a/v2/internal/ffenestri/windows/test/compile.bat b/v2/internal/ffenestri/windows/test/compile.bat
deleted file mode 100644
index 9dfd45d16..000000000
--- a/v2/internal/ffenestri/windows/test/compile.bat
+++ /dev/null
@@ -1 +0,0 @@
-g++ main.c ..\..\ffenestri_windows.cpp -lgdi32 -std=c++11
\ No newline at end of file
diff --git a/v2/internal/project/project.go b/v2/internal/project/project.go
index ff30cfb01..015a905cb 100644
--- a/v2/internal/project/project.go
+++ b/v2/internal/project/project.go
@@ -25,8 +25,8 @@ type Project struct {
// The path to the project directory
Path string
- // Assets directory
- AssetsDir string `json:"assetsdir"`
+ // Build directory
+ BuildDir string `json:"builddir"`
// The output filename
OutputFilename string `json:"outputfilename"`
@@ -76,8 +76,8 @@ func Load(projectPath string) (*Project, error) {
}
// Set default assets directory if none given
- if result.AssetsDir == "" {
- result.AssetsDir = filepath.Join(result.Path, "assets")
+ if result.BuildDir == "" {
+ result.BuildDir = filepath.Join(result.Path, "build")
}
// Fix up OutputFilename
diff --git a/v2/pkg/buildassets/build/README.md b/v2/pkg/buildassets/build/README.md
new file mode 100644
index 000000000..b8c1271f8
--- /dev/null
+++ b/v2/pkg/buildassets/build/README.md
@@ -0,0 +1,52 @@
+# Assets Directory
+
+The assets directory is used to house all the assets of your application.
+
+The structure is:
+
+ * dialog - Icons for dialogs
+ * tray - Icons for the system tray
+ * mac - MacOS specific files
+ * linux - Linux specific files
+ * windows - Windows specific files
+
+## Dialog Icons
+
+Place any PNG file in this directory to be able to use them in message dialogs.
+The files should have names in the following format: `name[-(light|dark)][2x].png`
+
+Examples:
+
+* `mypic.png` - Standard definition icon with ID `mypic`
+* `mypic-light.png` - Standard definition icon with ID `mypic`, used when system theme is light
+* `mypic-dark.png` - Standard definition icon with ID `mypic`, used when system theme is dark
+* `mypic2x.png` - High definition icon with ID `mypic`
+* `mypic-light2x.png` - High definition icon with ID `mypic`, used when system theme is light
+* `mypic-dark2x.png` - High definition icon with ID `mypic`, used when system theme is dark
+
+### Order of preference
+
+Icons are selected with the following order of preference:
+
+For High Definition displays:
+* name-(theme)2x.png
+* name2x.png
+* name-(theme).png
+* name.png
+
+For Standard Definition displays:
+* name-(theme).png
+* name.png
+
+## Tray
+
+Place any PNG file in this directory to be able to use them as tray icons.
+The name of the filename will be the ID to reference the image.
+
+Example:
+
+* `mypic.png` - May be referenced using `runtime.Tray.SetIcon("mypic")`
+
+## Mac
+
+The `mac` directory holds files specific to Mac builds, such as `Info.plist`. These may be edited and used as part of the build.
diff --git a/v2/pkg/buildassets/build/appicon.png b/v2/pkg/buildassets/build/appicon.png
new file mode 100644
index 000000000..a3ad26ce7
Binary files /dev/null and b/v2/pkg/buildassets/build/appicon.png differ
diff --git a/v2/pkg/buildassets/build/darwin/Info.tmpl.plist b/v2/pkg/buildassets/build/darwin/Info.tmpl.plist
new file mode 100644
index 000000000..7180c58de
--- /dev/null
+++ b/v2/pkg/buildassets/build/darwin/Info.tmpl.plist
@@ -0,0 +1,14 @@
+
+
+ CFBundlePackageTypeAPPL
+ CFBundleName{{.Name}}
+ CFBundleExecutable{{.Name}}
+ CFBundleIdentifiercom.wails.{{.Name}}
+ CFBundleVersion1.0.0
+ CFBundleGetInfoStringBuilt using Wails (https://wails.app)
+ CFBundleShortVersionString1.0.0
+ CFBundleIconFileiconfile
+ LSMinimumSystemVersion10.13.0
+ NSHighResolutionCapabletrue
+ NSHumanReadableCopyrightCopyright.........
+
\ No newline at end of file
diff --git a/v2/pkg/buildassets/build/dialog/README.md b/v2/pkg/buildassets/build/dialog/README.md
new file mode 100644
index 000000000..b9ddc2781
--- /dev/null
+++ b/v2/pkg/buildassets/build/dialog/README.md
@@ -0,0 +1,3 @@
+# Default Dialog Icons
+
+This directory contains the default dialog icons. These are pre-compiled into a single C file (`defaultDialogIcons.c`) which resides in the `ffenestri` directory. If these icons are ever updated, then there is a need to run: `go run build.go` in this directory. This will generate a new `defaultDialogIcons.c` file in the `ffenestri` directory.
\ No newline at end of file
diff --git a/v2/pkg/buildassets/build/dialog/info-dark.png b/v2/pkg/buildassets/build/dialog/info-dark.png
new file mode 100644
index 000000000..9ff6655ee
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/info-dark.png differ
diff --git a/v2/pkg/buildassets/build/dialog/info-dark2x.png b/v2/pkg/buildassets/build/dialog/info-dark2x.png
new file mode 100644
index 000000000..fcdf8006a
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/info-dark2x.png differ
diff --git a/v2/pkg/buildassets/build/dialog/info-light.png b/v2/pkg/buildassets/build/dialog/info-light.png
new file mode 100644
index 000000000..1fb32e8a9
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/info-light.png differ
diff --git a/v2/pkg/buildassets/build/dialog/info-light2x.png b/v2/pkg/buildassets/build/dialog/info-light2x.png
new file mode 100644
index 000000000..874b2d301
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/info-light2x.png differ
diff --git a/v2/pkg/buildassets/build/dialog/question-dark.png b/v2/pkg/buildassets/build/dialog/question-dark.png
new file mode 100644
index 000000000..c2387420e
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/question-dark.png differ
diff --git a/v2/pkg/buildassets/build/dialog/question-dark2x.png b/v2/pkg/buildassets/build/dialog/question-dark2x.png
new file mode 100644
index 000000000..86ea1b037
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/question-dark2x.png differ
diff --git a/v2/pkg/buildassets/build/dialog/question-light.png b/v2/pkg/buildassets/build/dialog/question-light.png
new file mode 100644
index 000000000..0d3b6ba02
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/question-light.png differ
diff --git a/v2/pkg/buildassets/build/dialog/question-light2x.png b/v2/pkg/buildassets/build/dialog/question-light2x.png
new file mode 100644
index 000000000..fcd21569f
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/question-light2x.png differ
diff --git a/v2/pkg/buildassets/build/dialog/warning-dark.png b/v2/pkg/buildassets/build/dialog/warning-dark.png
new file mode 100644
index 000000000..db432321b
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/warning-dark.png differ
diff --git a/v2/pkg/buildassets/build/dialog/warning-dark2x.png b/v2/pkg/buildassets/build/dialog/warning-dark2x.png
new file mode 100644
index 000000000..3325d22d2
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/warning-dark2x.png differ
diff --git a/v2/pkg/buildassets/build/dialog/warning-light.png b/v2/pkg/buildassets/build/dialog/warning-light.png
new file mode 100644
index 000000000..cf421a171
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/warning-light.png differ
diff --git a/v2/pkg/buildassets/build/dialog/warning-light2x.png b/v2/pkg/buildassets/build/dialog/warning-light2x.png
new file mode 100644
index 000000000..ff092f6cd
Binary files /dev/null and b/v2/pkg/buildassets/build/dialog/warning-light2x.png differ
diff --git a/v2/pkg/buildassets/build/windows/wails.exe.manifest b/v2/pkg/buildassets/build/windows/wails.exe.manifest
new file mode 100644
index 000000000..b236d268f
--- /dev/null
+++ b/v2/pkg/buildassets/build/windows/wails.exe.manifest
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ true/pm
+ permonitorv2,permonitor
+ true
+
+
+
\ No newline at end of file
diff --git a/v2/pkg/buildassets/build/windows/wails.rc.tmpl b/v2/pkg/buildassets/build/windows/wails.rc.tmpl
new file mode 100644
index 000000000..a1254d9d8
--- /dev/null
+++ b/v2/pkg/buildassets/build/windows/wails.rc.tmpl
@@ -0,0 +1,2 @@
+100 ICON "app.ico"
+110 24 "{{.Name}}.exe.manifest"
\ No newline at end of file
diff --git a/v2/pkg/buildassets/buildassets.go b/v2/pkg/buildassets/buildassets.go
new file mode 100644
index 000000000..3924dbbbf
--- /dev/null
+++ b/v2/pkg/buildassets/buildassets.go
@@ -0,0 +1,76 @@
+package buildassets
+
+import (
+ "embed"
+ "github.com/leaanthony/debme"
+ "github.com/leaanthony/gosod"
+ "os"
+ "path/filepath"
+ "text/template"
+)
+
+//go:embed build
+var assets embed.FS
+
+type assetData struct {
+ Name string
+}
+
+// Install will install all default project assets
+func Install(targetDir string, projectName string) error {
+ templateDir := gosod.New(assets)
+ err := templateDir.Extract(targetDir, &assetData{Name: projectName})
+ if err != nil {
+ return err
+ }
+
+ // Rename the manifest file
+ windowsDir := filepath.Join(targetDir, "build", "windows")
+ manifest := filepath.Join(windowsDir, "wails.exe.manifest")
+ targetFile := filepath.Join(windowsDir, projectName+".exe.manifest")
+ err = os.Rename(manifest, targetFile)
+ if err != nil {
+ return err
+ }
+
+ // Rename the rc file
+ rc := filepath.Join(windowsDir, "wails.rc")
+ targetFile = filepath.Join(windowsDir, projectName+".rc")
+ err = os.Rename(rc, targetFile)
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+// RegenerateRCFile will recreate the RC file
+func RegenerateRCFile(projectDir string, projectName string) error {
+ targetFile, err := os.OpenFile(filepath.Join(projectDir, "build", "windows", projectName+".rc"), os.O_CREATE, 0644)
+ if err != nil {
+ return err
+ }
+ data := &assetData{Name: projectName}
+ templateData, err := assets.ReadFile("build/windows/wails.rc.tmpl")
+ if err != nil {
+ return err
+ }
+
+ tmpl, err := template.New("rc").Parse(string(templateData))
+ if err != nil {
+ return err
+ }
+ err = tmpl.Execute(targetFile, data)
+ if err != nil {
+ return err
+ }
+ return nil
+
+}
+
+func RegenerateManifest(target string) error {
+ a, err := debme.FS(assets, "build")
+ if err != nil {
+ return err
+ }
+ return a.CopyFile("windows/wails.exe.manifest", target, 0644)
+}
diff --git a/v2/pkg/commands/build/base.go b/v2/pkg/commands/build/base.go
index 3894b060e..106cdcbc6 100644
--- a/v2/pkg/commands/build/base.go
+++ b/v2/pkg/commands/build/base.go
@@ -152,7 +152,16 @@ func (b *BaseBuilder) CleanUp() {
func (b *BaseBuilder) OutputFilename(options *Options) string {
outputFile := options.OutputFile
if outputFile == "" {
- outputFile = b.projectData.OutputFilename
+ target := strings.TrimSuffix(b.projectData.OutputFilename, ".exe")
+ if b.projectData.OutputType != "desktop" {
+ target += "-" + b.projectData.OutputType
+ }
+ switch b.options.Platform {
+ case "windows":
+ outputFile = b.projectData.OutputFilename
+ case "darwin", "linux":
+ outputFile = fmt.Sprintf("%s-%s-%s", target, b.options.Platform, b.options.Arch)
+ }
}
return outputFile
}
@@ -306,7 +315,7 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
println("Done.")
// If we are targeting windows, dump the DLLs
if options.Platform == "windows" {
- err := os.WriteFile(filepath.Join(appDir, "webview2.dll"), x64.WebView2, 0755)
+ err := os.WriteFile(filepath.Join(appDir, "webview.dll"), x64.WebView2, 0755)
if err != nil {
return err
}
diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go
index aaf917a11..9ee384190 100644
--- a/v2/pkg/commands/build/build.go
+++ b/v2/pkg/commands/build/build.go
@@ -74,7 +74,7 @@ func Build(options *Options) (string, error) {
options.ProjectData = projectData
// Set build directory
- options.BuildDirectory = filepath.Join(options.ProjectData.Path, "build", options.Platform, options.OutputType)
+ options.BuildDirectory = filepath.Join(options.ProjectData.Path, "build", "bin")
// Save the project type
projectData.OutputType = options.OutputType
@@ -161,8 +161,14 @@ func Build(options *Options) (string, error) {
return "", fmt.Errorf("%s - %s", err.Error(), stderr)
}
// Remove temp binaries
- fs.DeleteFile(filepath.Join(options.BuildDirectory, amd64Filename))
- fs.DeleteFile(filepath.Join(options.BuildDirectory, arm64Filename))
+ err = fs.DeleteFile(filepath.Join(options.BuildDirectory, amd64Filename))
+ if err != nil {
+ return "", err
+ }
+ err = fs.DeleteFile(filepath.Join(options.BuildDirectory, arm64Filename))
+ if err != nil {
+ return "", err
+ }
projectData.OutputFilename = outputFile
options.CompiledBinary = filepath.Join(options.BuildDirectory, outputFile)
} else {
@@ -171,7 +177,6 @@ func Build(options *Options) (string, error) {
return "", err
}
}
- outputLogger.Println("Done.")
// Do we need to pack the app?
if options.Pack {
diff --git a/v2/pkg/commands/build/desktop.go b/v2/pkg/commands/build/desktop.go
index d3edd182e..27bcbcf37 100644
--- a/v2/pkg/commands/build/desktop.go
+++ b/v2/pkg/commands/build/desktop.go
@@ -25,11 +25,11 @@ func (d *DesktopBuilder) BuildAssets(options *Options) error {
var err error
// Check assets directory exists
- if !fs.DirExists(options.ProjectData.AssetsDir) {
+ if !fs.DirExists(options.ProjectData.BuildDir) {
// Path to default assets
defaultAssets := fs.RelativePath("./internal/assets")
// Copy the default assets directory
- err := fs.CopyDir(defaultAssets, options.ProjectData.AssetsDir)
+ err := fs.CopyDir(defaultAssets, options.ProjectData.BuildDir)
if err != nil {
return err
}
@@ -106,7 +106,7 @@ func (d *DesktopBuilder) BuildBaseAssets(assets *html.AssetBundle, options *Opti
func (d *DesktopBuilder) processApplicationIcon(assetDir string) error {
// Copy default icon if one doesn't exist
- iconFile := filepath.Join(d.projectData.AssetsDir, "appicon.png")
+ iconFile := filepath.Join(d.projectData.BuildDir, "appicon.png")
if !fs.FileExists(iconFile) {
err := fs.CopyFile(defaultIconPath(), iconFile)
if err != nil {
diff --git a/v2/pkg/commands/build/desktop_darwin.go b/v2/pkg/commands/build/desktop_darwin.go
index 76fe05897..9cf0d8884 100644
--- a/v2/pkg/commands/build/desktop_darwin.go
+++ b/v2/pkg/commands/build/desktop_darwin.go
@@ -27,7 +27,7 @@ func (d *DesktopBuilder) processTrayIcons(assetDir string, options *Options) err
var err error
// Get all the tray icon filenames
- trayIconDirectory := filepath.Join(options.ProjectData.AssetsDir, "tray")
+ trayIconDirectory := filepath.Join(options.ProjectData.BuildDir, "tray")
// If the directory doesn't exist, create it
if !fs.DirExists(trayIconDirectory) {
@@ -116,7 +116,7 @@ func (d *DesktopBuilder) processDialogIcons(assetDir string, options *Options) e
var err error
// Get all the dialog icon filenames
- dialogIconDirectory := filepath.Join(options.ProjectData.AssetsDir, "dialog")
+ dialogIconDirectory := filepath.Join(options.ProjectData.BuildDir, "dialog")
var dialogIconFilenames []string
// If the directory does not exist, create it
diff --git a/v2/pkg/commands/build/desktop_windows.go b/v2/pkg/commands/build/desktop_windows.go
index d3286db36..396988182 100644
--- a/v2/pkg/commands/build/desktop_windows.go
+++ b/v2/pkg/commands/build/desktop_windows.go
@@ -8,7 +8,7 @@ func (d *DesktopBuilder) processTrayIcons(assetDir string, options *Options) err
// var err error
//
// // Get all the tray icon filenames
- // trayIconDirectory := filepath.Join(options.ProjectData.AssetsDir, "tray")
+ // trayIconDirectory := filepath.Join(options.ProjectData.BuildDir, "tray")
//
// // If the directory doesn't exist, create it
// if !fs.DirExists(trayIconDirectory) {
@@ -97,7 +97,7 @@ func (d *DesktopBuilder) processDialogIcons(assetDir string, options *Options) e
// var err error
//
// // Get all the dialog icon filenames
- // dialogIconDirectory := filepath.Join(options.ProjectData.AssetsDir, "dialog")
+ // dialogIconDirectory := filepath.Join(options.ProjectData.BuildDir, "dialog")
// var dialogIconFilenames []string
//
// // If the directory does not exist, create it
diff --git a/v2/pkg/commands/build/hybrid.go b/v2/pkg/commands/build/hybrid.go
index 381b36038..8047e20e7 100644
--- a/v2/pkg/commands/build/hybrid.go
+++ b/v2/pkg/commands/build/hybrid.go
@@ -30,12 +30,6 @@ func (b *HybridBuilder) BuildAssets(options *Options) error {
if err != nil {
return err
}
- // Build static assets
- err = b.buildCustomAssets(b.projectData)
- if err != nil {
- return err
- }
-
return nil
}
@@ -63,18 +57,6 @@ func (b *HybridBuilder) BuildBaseAssets(options *Options) error {
return err
}
- // Build desktop static assets
- err = b.desktop.buildCustomAssets(b.projectData)
- if err != nil {
- return err
- }
-
- // Build server static assets
- err = b.server.buildCustomAssets(b.projectData)
- if err != nil {
- return err
- }
-
return nil
}
diff --git a/v2/pkg/commands/build/internal/packager/darwin/Info.plist b/v2/pkg/commands/build/internal/packager/darwin/Info.plist
index 30ded0ef6..8e67cb18f 100644
--- a/v2/pkg/commands/build/internal/packager/darwin/Info.plist
+++ b/v2/pkg/commands/build/internal/packager/darwin/Info.plist
@@ -2,11 +2,13 @@
CFBundlePackageTypeAPPL
CFBundleName{{.Title}}
- CFBundleExecutable{{.Exe}}
- CFBundleIdentifier{{.PackageID}}
- CFBundleVersion{{.Version}}
- CFBundleGetInfoStringBuilt by {{.Author}} using Wails (https://wails.app)
- CFBundleShortVersionString{{.Version}}
+ CFBundleExecutable{{.Title}}
+ CFBundleIdentifiercom.wails.{{.Title}}
+ CFBundleVersion1.0.0
+ CFBundleGetInfoStringBuilt using Wails (https://wails.app)
+ CFBundleShortVersionString1.0.0
CFBundleIconFileiconfile
+ LSMinimumSystemVersion10.13.0
NSHighResolutionCapabletrue
+ NSHumanReadableCopyrightCopyright.........
\ No newline at end of file
diff --git a/v2/pkg/commands/build/internal/packager/linux/AppRun b/v2/pkg/commands/build/internal/packager/linux/AppRun
deleted file mode 100644
index 621fed611..000000000
--- a/v2/pkg/commands/build/internal/packager/linux/AppRun
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-cd "$(dirname "$0")"
-exec ./{{.OutputFilename}}
\ No newline at end of file
diff --git a/v2/pkg/commands/build/packager.go b/v2/pkg/commands/build/packager.go
index c32900a05..9472d35ea 100644
--- a/v2/pkg/commands/build/packager.go
+++ b/v2/pkg/commands/build/packager.go
@@ -14,7 +14,7 @@ func packageProject(options *Options, platform string) error {
var err error
switch platform {
- case "linux", "darwin":
+ case "darwin", "windows":
err = packageApplication(options)
default:
err = fmt.Errorf("packing not supported for %s yet", platform)
diff --git a/v2/pkg/commands/build/packager_darwin.go b/v2/pkg/commands/build/packager_darwin.go
index 6062b6d3b..9668492a4 100644
--- a/v2/pkg/commands/build/packager_darwin.go
+++ b/v2/pkg/commands/build/packager_darwin.go
@@ -49,7 +49,7 @@ func packageApplication(options *Options) error {
}
// Generate Icons
- err = processApplicationIcon(resourceDir, options.ProjectData.AssetsDir)
+ err = processApplicationIcon(resourceDir, options.ProjectData.BuildDir)
if err != nil {
return err
}
@@ -68,7 +68,7 @@ func packageApplication(options *Options) error {
func processPList(options *Options, contentsDirectory string) error {
// Check if plist already exists in project dir
- plistFile := filepath.Join(options.ProjectData.AssetsDir, "mac", "Info.plist")
+ plistFile := filepath.Join(options.ProjectData.BuildDir, "darwin", "Info.plist")
// If the file doesn't exist, generate it
if !fs.FileExists(plistFile) {
diff --git a/v2/pkg/commands/build/packager_windows.go b/v2/pkg/commands/build/packager_windows.go
index a64ba85c9..925217949 100644
--- a/v2/pkg/commands/build/packager_windows.go
+++ b/v2/pkg/commands/build/packager_windows.go
@@ -1,6 +1,78 @@
package build
+import (
+ "fmt"
+ "github.com/leaanthony/winicon"
+ "github.com/wailsapp/wails/v2/internal/fs"
+ "github.com/wailsapp/wails/v2/pkg/buildassets"
+ "os"
+ "path/filepath"
+)
+
func packageApplication(options *Options) error {
- // TBD
+ // Generate icon
+ var err error
+ err = generateIcoFile(options)
+ if err != nil {
+ return err
+ }
+
+ // Ensure RC file is present
+ err = generateRCFile(options)
+ if err != nil {
+ return err
+ }
+
+ // Ensure Manifest is present
+ err = generateManifest(options)
+ if err != nil {
+ return err
+ }
+ // Run
+
+ return nil
+}
+
+func generateManifest(options *Options) error {
+ filename := options.ProjectData.Name + ".exe.manifest"
+ manifestFile := filepath.Join(options.ProjectData.Path, "build", "windows", filename)
+ if !fs.FileExists(manifestFile) {
+ return buildassets.RegenerateManifest(manifestFile)
+ }
+ return nil
+}
+
+func generateRCFile(options *Options) error {
+ filename := options.ProjectData.Name + ".rc"
+ rcFile := filepath.Join(options.ProjectData.Path, "build", "windows", filename)
+ if !fs.FileExists(rcFile) {
+ return buildassets.RegenerateRCFile(options.ProjectData.Path, options.ProjectData.Name)
+ }
+ return nil
+}
+
+func generateIcoFile(options *Options) error {
+ // Check ico file exists already
+ icoFile := filepath.Join(options.ProjectData.Path, "build", "windows", "app.ico")
+ if !fs.FileExists(icoFile) {
+ // Check icon exists
+ appicon := filepath.Join(options.ProjectData.Path, "build", "appicon.png")
+ if !fs.FileExists(appicon) {
+ return fmt.Errorf("application icon missing: %s", appicon)
+ }
+ // Load icon
+ input, err := os.Open(appicon)
+ if err != nil {
+ return err
+ }
+ output, err := os.OpenFile(icoFile, os.O_CREATE, 0644)
+ if err != nil {
+ return err
+ }
+ err = winicon.GenerateIcon(input, output, []int{256, 128, 64, 48, 32, 16})
+ if err != nil {
+ return err
+ }
+ }
return nil
}
diff --git a/v2/pkg/commands/build/server.go b/v2/pkg/commands/build/server.go
index 8e305a8f7..e6e34bfba 100644
--- a/v2/pkg/commands/build/server.go
+++ b/v2/pkg/commands/build/server.go
@@ -37,12 +37,6 @@ func (s *ServerBuilder) BuildAssets(_ *Options) error {
return err
}
- // Build static assets
- err = s.buildCustomAssets(s.projectData)
- if err != nil {
- return err
- }
-
return nil
}