Compare commits

...

87 Commits

Author SHA1 Message Date
Lea Anthony d24d82f86d Rename exp -> v3 2023-01-18 21:34:11 +11:00
Lea Anthony 81e9223124 Merge branch 'master' into future/exp 2023-01-18 21:27:30 +11:00
Lea Anthony 2374bb7e0e Update clir 2023-01-18 20:57:31 +11:00
Lea Anthony 4c42ef9710 Create generate bindings command 2023-01-18 20:19:12 +11:00
stffabi b4d64678b5 Basic integration of the assetserver 2023-01-18 09:31:09 +01:00
Lea Anthony a4f729a6a0 Rename parser package.
Fix linting issues
Add README.md
2023-01-18 08:22:31 +11:00
Lea Anthony 8e593e9c35 Start of TS models generation support 2023-01-17 18:57:35 +11:00
Lea Anthony 0a09363db7 Support struct discovery over multiple files 2023-01-17 07:45:41 +11:00
Lea Anthony b0b96c9838 Support struct discovery in methods 2023-01-16 20:30:05 +11:00
Lea Anthony 8bbf5ff3f1 Recursive bound model discovery implemented 2023-01-15 20:25:42 +11:00
Lea Anthony 572fbc9705 Initial parsing to discover bound struct names 2023-01-13 17:35:43 +11:00
Lea Anthony f371b513d1 Fix name of Window menu in role 2023-01-13 17:33:54 +11:00
Lea Anthony e5d3803fc1 Initial runtime builds
Added Taskfile for fast runtime builds
2023-01-08 21:06:31 +11:00
Lea Anthony 06a0377963 Fix frameless
Add rounded corners for frameless
Create NSWindow subclass
Add pre-post build hooks
2023-01-07 11:26:46 +11:00
Lea Anthony 62a5509390 Do not display internal tasks when using wails task list 2023-01-06 20:20:40 +11:00
Lea Anthony 54805d99a0 Remove New from Dialog methods 2023-01-06 20:19:20 +11:00
Lea Anthony d1e2ee452f Integrate Task 2023-01-05 15:02:08 +11:00
Lea Anthony b5127d95ff Add EnableFraudulentWebsiteWarnings feature
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2023-01-04 20:12:28 +11:00
Lea Anthony 174a31b49a Add run command for running tasks in a Taskfile.yml
Add `generate` command for generating assets
Add build example
2023-01-04 20:01:13 +11:00
Lea Anthony 746b4dfc04 Fix sizes bug
Remove redundant menu package
2023-01-03 05:43:56 +11:00
Lea Anthony e5da0eb5f8 Add icon generation
Add syso generation
Add tests
2023-01-02 21:23:44 +11:00
Lea Anthony f4044ebcd9 Add icon tool 2023-01-02 08:23:29 +11:00
Lea Anthony bc7d8295ba Refactor window -> webviewwindow 2023-01-02 05:48:52 +11:00
Lea Anthony 71fb7fadff Merge branch 'chore/move_assetserver_to_pkg' into future/exp 2022-12-31 13:08:34 +11:00
Lea Anthony be240795e2 Refactor assetserver into pkg 2022-12-31 11:01:24 +11:00
Lea Anthony cf5def05a6 Refactor application API to use options by default. Updated examples. 2022-12-31 10:38:36 +11:00
Lea Anthony ad802a3ad0 Frameless support
applicationShouldTerminateAfterLastWindowClosed support
2022-12-30 14:14:28 +11:00
Lea Anthony 287039a8f3 Task experiment 2022-12-28 19:17:38 +11:00
Lea Anthony ad1d104d85 Add screen support
Co-authored-by: Oleg Gulevskyy <43781031+oleggulevskyy@users.noreply.github.com>
2022-12-28 14:09:13 +11:00
Lea Anthony 92af7455ad Support Show/Hide window
Better demo
window.Run() -> window.Show()
2022-12-27 21:15:43 +11:00
Lea Anthony b6b6acf1d9 Remove debug printfs 2022-12-27 15:31:24 +11:00
Lea Anthony 5187641e25 Remove C.toggleFullscreen 2022-12-27 15:29:57 +11:00
Lea Anthony 41779866c4 Disable fullscreen button if there are size constraints 2022-12-27 13:42:57 +11:00
Lea Anthony f800222781 Allow SetSize to adjust min/max constraints 2022-12-27 09:38:00 +11:00
Lea Anthony 0c364b2813 Fix sizing of window/contentrect
Fix set min/max size
Ignore SetSize when in fullscreen
Disable size constraints when going fullscreen
2022-12-27 09:23:54 +11:00
Lea Anthony 7dbb8c1377 Improve Minimise, Maximise
Add Restore
setAutoenablesItems:NO
2022-12-26 20:21:51 +11:00
Lea Anthony 6a0c101b08 Fix dialog ID issue
Use map instead of uint for dialog IDs
2022-12-24 20:40:34 +11:00
Lea Anthony f240f2100c Refactor mainthread dispatch 2022-12-24 15:35:04 +11:00
Lea Anthony 2b91ced1b7 Support SetPosition
Optimise event listener callbacks
2022-12-24 13:38:48 +11:00
Lea Anthony b7f1defbf3 NavigateToURL -> SetURL
Fixed typo in colour
Removed EnableDevTools
2022-12-23 23:18:28 +11:00
Lea Anthony 2946a0aa25 GetCurrentWindow -> CurrentWindow 2022-12-23 19:55:54 +11:00
Lea Anthony b043126031 Add open file dialog filters
Add clipboard
Fix mouse event handling
2022-12-23 07:34:12 +11:00
Lea Anthony 4d58b56d54 Improve dialogs 2022-12-21 21:30:26 +11:00
Lea Anthony 025e8d7645 Add SaveFileDialog
Add Toolbar Styles
Add Invisible Titlebar option with drag support
2022-12-20 21:49:19 +11:00
Lea Anthony e7abe1c606 Add Webview navigation events
Add HTML/JS/CSS in config
Add RenderHTML()
Tidy up window delegate
2022-12-19 21:17:50 +11:00
Lea Anthony ea1f086289 OpenDialog attach to window & multiple files selection 2022-12-19 08:26:59 +11:00
Lea Anthony b1e8f2f887 Start of file dialogs 2022-12-18 23:06:31 +11:00
Lea Anthony 45adc49683 Add application icon support
Add message dialog support
Add default icons
Add png to byte slice task
Fixed kitchen sink
2022-12-18 13:06:03 +11:00
Lea Anthony 2409984aab Add application about dialog
Add application icon support
2022-12-18 00:40:53 +11:00
Lea Anthony 8f9eeb8055 Improve menu demo 2022-12-17 20:49:58 +11:00
Lea Anthony a8d5f185c2 Fix resizing bug
Refactor some application setters
2022-12-17 20:49:46 +11:00
Lea Anthony bbb418f98f Fix submenu radio processing 2022-12-17 20:49:04 +11:00
Lea Anthony f8eb680559 Add Window & Help menus
Fix min/max sizing
2022-12-17 19:56:29 +11:00
Lea Anthony da5fa806d7 Add Zoom In/Out & Actual size roles 2022-12-16 21:28:16 +11:00
Lea Anthony 88f6a3d1b9 Refactor and support more roles 2022-12-16 21:09:31 +11:00
Lea Anthony 475880c0a8 Add services, hide, hideothers, unhide role
Add application.Name()
refactor roles
Add app menu role
2022-12-16 21:06:49 +11:00
Lea Anthony faf418eac0 Add global reference for application
Add default application meu for Mac
Add window example
Fix invalid accelerator error logging
2022-12-15 21:21:19 +11:00
Lea Anthony f35b8dfec5 Refactor Application
Add SetActivationPolicy
Added labels to menus
2022-12-15 18:06:09 +11:00
Lea Anthony 14fcfb8348 Refactor event types 2022-12-15 18:03:01 +11:00
Lea Anthony f84c4aca72 Refactor message processing functions 2022-12-15 08:01:49 +11:00
Lea Anthony dad7798da9 New Systray example 2022-12-15 08:01:21 +11:00
Lea Anthony 79af667b7a Support Menu Accelerators 2022-12-15 08:00:49 +11:00
Lea Anthony d84cb5b190 Fix enabled menuitem 2022-12-14 19:15:58 +11:00
Lea Anthony 7c18f25508 Support radio menuitems
Support systemtray destroy()
2022-12-14 19:03:27 +11:00
Lea Anthony 085de606ee Support submenus 2022-12-14 08:48:17 +11:00
Lea Anthony c7ac90def4 Support template icons 2022-12-14 08:26:52 +11:00
Lea Anthony bb36ce61bc Refactor dispatching 2022-12-14 07:52:10 +11:00
Lea Anthony a35a876094 Add support for system tray + menus 2022-12-13 21:54:12 +11:00
Lea Anthony f38c6c6d1c Add Fatal() 2022-12-11 20:05:00 +11:00
Lea Anthony f6a16950f2 Add Window methods Width(), Height(), Size() + Position()
Fix main thread locking issue
Add Window aliases
2022-12-11 19:57:20 +11:00
Lea Anthony ddb2f63f7b Support Window aliases 2022-12-11 14:39:53 +11:00
Lea Anthony bf8e541221 Support Window events
Convert events to uint
Rename system events to application events
2022-12-11 13:01:38 +11:00
Lea Anthony 4a2cf597c2 Fix resizable 2022-12-11 11:26:21 +11:00
Lea Anthony 27370559d3 Refactor Is* methods
Add more events
2022-12-11 11:09:52 +11:00
Lea Anthony a134bfac42 Add Center
Add more events
2022-12-10 22:34:15 +11:00
Lea Anthony d5e21d5003 Fix race condition in closing window during navigating
Add sane defaults
2022-12-09 08:22:17 +11:00
Lea Anthony 85abb1122f Add main thread dispatching
Make `window.Run` operate on main thread
2022-12-09 07:47:47 +11:00
Lea Anthony 0257362a86 Support per-window message dispatching 2022-12-08 23:06:27 +11:00
Lea Anthony 1872672d0c Support appearance 2022-12-08 18:20:04 +11:00
Lea Anthony 644655662e Support toolbar config 2022-12-08 18:09:02 +11:00
Lea Anthony 508bbb4fb4 Support Min/Max/Fullscreen, BackgroundColour 2022-12-08 17:25:39 +11:00
Lea Anthony cb9df61a98 Support MacBackdrop type
Fix devtools window error
2022-12-08 07:47:04 +11:00
Lea Anthony ab976e56af Support ExecJS 2022-12-07 23:58:45 +11:00
Lea Anthony df1cc2ee0b Support EnableDevTools 2022-12-07 23:52:16 +11:00
Lea Anthony af6daa273e Support min/max window size 2022-12-07 23:44:19 +11:00
Lea Anthony 05803fb5d5 Add more Window API 2022-12-07 23:30:20 +11:00
Lea Anthony 5a37091bb0 Initial play around 2022-12-07 21:55:09 +11:00
147 changed files with 17073 additions and 16 deletions
+3
View File
@@ -31,3 +31,6 @@ v2/test/kitchensink/frontend/package.json.md5
v2/cmd/wails/internal/commands/initialise/templates/testtemplates/
.env
/website/static/img/.cache.json
/v3/.task
/v3/examples/build/bin/testapp
+1 -1
View File
@@ -141,7 +141,7 @@ func (a *App) start() error {
// Defer the shutdown
defer a.shutdown()
// Run the renderer
// run the renderer
err = a.renderer.Run()
if err != nil {
return err
+1 -1
View File
@@ -55,7 +55,7 @@ func newIPCMessage(incomingMessage string, responseFunction func(*ipcResponse) e
// hasCallbackID checks if the message can send an error back to the frontend
func (m *ipcMessage) hasCallbackID() error {
if m.CallbackID == "" {
return fmt.Errorf("attempted to return error to message with no Callback ID")
return fmt.Errorf("attempted to return error to message with no callback ID")
}
return nil
}
+2 -2
View File
@@ -186,7 +186,7 @@ func (w *WebView) evalJSSync(js string) error {
go func() {
exit := false
// We are done when we receive the Callback ID
// We are done when we receive the callback ID
w.log.Debug("SyncJS: sending with ID = " + ID)
w.eventManager.On(ID, func(...interface{}) {
w.log.Debug("SyncJS: Got callback ID = " + ID)
@@ -361,7 +361,7 @@ func (w *WebView) focus() {
// callback sends a callback to the frontend
func (w *WebView) callback(data string) error {
callbackCMD := fmt.Sprintf("window.wails._.Callback('%s');", data)
callbackCMD := fmt.Sprintf("window.wails._.callback('%s');", data)
return w.evalJS(callbackCMD)
}
+3 -2
View File
@@ -4,12 +4,13 @@ import (
"context"
"embed"
"fmt"
"time"
"github.com/wailsapp/wails/v2/pkg/application"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/windows"
"github.com/wailsapp/wails/v2/pkg/runtime"
"time"
)
//go:embed all:frontend/dist
@@ -52,7 +53,7 @@ func main() {
// create windows programmatically and be able to show/hide
// them from the systray with something like:
//
// myWindow := mainApp.NewWindow(...)
// myWindow := mainApp.NewWebviewWindow(...)
// mainApp.NewSystemTray(&options.SystemTray{
// OnLeftClick: func() {
// myWindow.SetVisibility(!myWindow.IsVisible())
@@ -26,6 +26,8 @@ import (
"github.com/wailsapp/wails/v2/pkg/assetserver"
"github.com/wailsapp/wails/v2/pkg/assetserver/webview"
"github.com/wailsapp/wails/v2/pkg/assetserver"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/frontend"
"github.com/wailsapp/wails/v2/internal/frontend/runtime"
@@ -327,7 +329,7 @@ func (f *Frontend) processMessage(message string) {
switch result[0] {
case 'c':
// Callback from a method call
// callback from a method call
f.Callback(result[1:])
default:
f.logger.Info("Unknown message returned from dispatcher: %+v", result)
@@ -337,7 +339,7 @@ func (f *Frontend) processMessage(message string) {
}
func (f *Frontend) Callback(message string) {
f.ExecJS(`window.wails.Callback(` + strconv.Quote(message) + `);`)
f.ExecJS(`window.wails.callback(` + strconv.Quote(message) + `);`)
}
func (f *Frontend) ExecJS(js string) {
@@ -428,7 +428,7 @@ func (f *Frontend) processMessage(message string) {
switch result[0] {
case 'c':
// Callback from a method call
// callback from a method call
f.Callback(result[1:])
default:
f.logger.Info("Unknown message returned from dispatcher: %+v", result)
@@ -437,7 +437,7 @@ func (f *Frontend) processMessage(message string) {
}
func (f *Frontend) Callback(message string) {
f.ExecJS(`window.wails.Callback(` + strconv.Quote(message) + `);`)
f.ExecJS(`window.wails.callback(` + strconv.Quote(message) + `);`)
}
func (f *Frontend) startDrag() {
@@ -628,7 +628,7 @@ func (f *Frontend) processMessage(message string) {
switch result[0] {
case 'c':
// Callback from a method call
// callback from a method call
f.Callback(result[1:])
default:
f.logger.Info("Unknown message returned from dispatcher: %+v", result)
@@ -638,7 +638,7 @@ func (f *Frontend) processMessage(message string) {
func (f *Frontend) Callback(message string) {
f.mainWindow.Invoke(func() {
f.chromium.Eval(`window.wails.Callback(` + strconv.Quote(message) + `);`)
f.chromium.Eval(`window.wails.callback(` + strconv.Quote(message) + `);`)
})
}
+1 -1
View File
@@ -129,7 +129,7 @@ func (e *Events) notifyBackend(eventName string, data ...interface{}) {
// We have a dirty flag to indicate that there are items to delete
itemsToDelete := false
// Callback in goroutine
// callback in goroutine
for _, listener := range listeners {
if listener.counter > 0 {
listener.counter--
+2 -1
View File
@@ -2,6 +2,7 @@ package menumanager
import (
"fmt"
"github.com/wailsapp/wails/v2/pkg/menu"
)
@@ -90,7 +91,7 @@ func (m *Manager) ProcessClick(menuID string, data string, menuType string, pare
return fmt.Errorf("No callback for menu '%s'", menuItem.Label)
}
// Create new Callback struct
// Create new callback struct
callbackData := &menu.CallbackData{
MenuItem: menuItem,
//ContextData: data,
+2 -2
View File
@@ -26,8 +26,8 @@ type TrayMenu struct {
// Tooltip
Tooltip string
// Callback function when menu clicked
//Click Callback `json:"-"`
// callback function when menu clicked
//Click callback `json:"-"`
// Disabled makes the item unselectable
Disabled bool
+8
View File
@@ -0,0 +1,8 @@
examples/kitchensink/kitchensink
cmd/wails/wails
/examples/systray/systray
/examples/window/window
/examples/dialogs/dialogs
/examples/menu/menu
/examples/clipboard/clipboard
/examples/plain/plain
+136
View File
@@ -0,0 +1,136 @@
# https://taskfile.dev
version: '3'
tasks:
build-runtime-debug:
dir: internal/runtime
internal: true
cmds:
- npx esbuild desktop/main.js --bundle --sourcemap=inline --outfile=runtime_debug_desktop_{{.PLATFORM}}.js --define:DEBUG=true --define:WINDOWS={{.WINDOWS}} --define:DARWIN={{.DARWIN}} --define:LINUX={{.LINUX}} --define:PLATFORM={{.PLATFORM}}
build-runtime-debug-windows:
cmds:
- task: build-runtime-debug
vars:
WINDOWS: true
DARWIN: false
LINUX: false
PLATFORM: windows
build-runtime-debug-linux:
cmds:
- task: build-runtime-debug
vars:
WINDOWS: false
DARWIN: false
LINUX: true
PLATFORM: linux
build-runtime-debug-darwin:
cmds:
- task: build-runtime-debug
vars:
WINDOWS: false
DARWIN: true
LINUX: false
PLATFORM: darwin
build-runtime-production:
dir: internal/runtime
internal: true
cmds:
- npx esbuild desktop/main.js --bundle --minify --outfile=runtime_production_desktop_{{.PLATFORM}}.js --define:DEBUG=true --define:WINDOWS={{.WINDOWS}} --define:DARWIN={{.DARWIN}} --define:LINUX={{.LINUX}} --define:PLATFORM={{.PLATFORM}}
build-runtime-production-windows:
cmds:
- task: build-runtime-production
vars:
WINDOWS: true
DARWIN: false
LINUX: false
PLATFORM: windows
build-runtime-production-linux:
cmds:
- task: build-runtime-production
vars:
WINDOWS: false
DARWIN: false
LINUX: true
PLATFORM: linux
build-runtime-production-darwin:
cmds:
- task: build-runtime-production
vars:
WINDOWS: false
DARWIN: true
LINUX: false
PLATFORM: darwin
install-runtime-dev-deps:
dir: internal/runtime/dev
internal: true
sources:
- package.json
cmds:
- npm install
install-runtime-deps:
dir: internal/runtime
internal: true
sources:
- package.json
cmds:
- npm install
build-runtime-dev:
dir: internal/runtime/dev
deps:
- install-runtime-dev-deps
sources:
- ./*.js
generates:
- ../ipc_websocket.js
cmds:
- node build.js
build-runtime-ipc:
dir: internal/runtime
deps:
- install-runtime-dev-deps
sources:
- ./desktop/ipc.js
generates:
- ipc.js
cmds:
- npx esbuild desktop/ipc.js --bundle --minify --outfile=ipc.js
test-runtime:
dir: internal/runtime
cmds:
- npx vitest
build-runtime-all:
dir: internal/runtime
deps:
- build-runtime-production-darwin
- build-runtime-production-windows
- build-runtime-production-linux
- build-runtime-debug-darwin
- build-runtime-debug-windows
- build-runtime-debug-linux
- build-runtime-dev
- build-runtime-ipc
cmds:
- task: test-runtime
build-runtime:
dir: internal/runtime
deps:
- install-runtime-deps
cmds:
- task: build-runtime-all
+79
View File
@@ -0,0 +1,79 @@
# The Wails CLI
The Wails CLI is a command line tool that allows you to create, build and run Wails applications.
There are a number of commands related to tooling, such as icon generation and asset bundling.
## Commands
### run
The run command is for running tasks defined in `Taskfile.yml`.
| Flag | Type | Description | Default |
|--------------------|--------|------------------------------------------------------|-----------------------|
| `-t` | string | The name of the task to run | |
### generate
The `generate` command is used to generate resources and assets for your Wails project.
It can be used to generate many things including:
- application icons,
- resource files for Windows applications
- Info.plist files for macOS deployments
#### icon
The `icon` command generates icons for your project.
| Flag | Type | Description | Default |
|--------------------|--------|------------------------------------------------------|-----------------------|
| `-example` | bool | Generates example icon file (appicon.png) | |
| `-input` | string | The input image file | |
| `-sizes` | string | The sizes to generate in .ico file (comma separated) | "256,128,64,48,32,16" |
| `-windowsFilename` | string | The output filename for the Windows icon | icons.ico |
| `-macFilename` | string | The output filename for the Mac icon bundle | icons.icns |
```bash
wails generate icon -input myicon.png -sizes "32,64,128" -windowsFilename myicon.ico -macFilename myicon.icns
```
This will generate icons for mac and windows and save them in the current directory as `myicon.ico`
and `myicons.icns`.
#### syso
The `syso` command generates a Windows resource file (aka `.syso`).
```bash
wails generate syso <options>
```
| Flag | Type | Description | Default |
|-------------|--------|--------------------------------------------|------------------|
| `-example` | bool | Generates example manifest & info files | |
| `-manifest` | string | The manifest file | |
| `-info` | string | The info.json file | |
| `-icon` | string | The icon file | |
| `-out` | string | The output filename for the syso file | `wails.exe.syso` |
| `-arch` | string | The target architecture (amd64,arm64,386) | `runtime.GOOS` |
If `-example` is provided, the command will generate example manifest and info files
in the current directory and exit.
If `-manifest` is provided, the command will use the provided manifest file to generate
the syso file.
If `-info` is provided, the command will use the provided info.json file to set the version
information in the syso file.
NOTE: We use [winres](https://github.com/tc-hib/winres) to generate the syso file. Please
refer to the winres documentation for more information.
NOTE: Whilst the tool will work for 32-bit Windows, it is not supported. Please use 64-bit.
#### defaults
```bash
wails icon -input myicon.png -sizes "32,64,128" -windowsFilename myicon.ico -macFilename myicon.icns
```
This will generate all the default assets and resources in the current directory. I
+28
View File
@@ -0,0 +1,28 @@
package main
import (
"os"
"github.com/pterm/pterm"
"github.com/leaanthony/clir"
"github.com/wailsapp/wails/v3/internal/commands"
)
func main() {
app := clir.NewCli("wails", "The Wails CLI", "v3")
app.NewSubCommandFunction("init", "Initialise a new project", commands.Init)
task := app.NewSubCommand("task", "Run and list tasks")
task.NewSubCommandFunction("run", "Run a task", commands.RunTask)
task.NewSubCommandFunction("list", "List tasks", commands.ListTasks)
generate := app.NewSubCommand("generate", "Generation tools")
generate.NewSubCommandFunction("defaults", "Generate default build assets", commands.Defaults)
generate.NewSubCommandFunction("icons", "Generate icons", commands.GenerateIcons)
generate.NewSubCommandFunction("syso", "Generate Windows .syso file", commands.GenerateSyso)
generate.NewSubCommandFunction("bindings", "Generate bindings + models", commands.GenerateBindings)
err := app.Run()
if err != nil {
pterm.Error.Println(err)
os.Exit(1)
}
}
+31
View File
@@ -0,0 +1,31 @@
package main
import (
_ "embed"
"log"
"github.com/wailsapp/wails/v3/examples/binding/services"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/options"
)
type localStruct struct{}
func main() {
app := application.New(options.Application{
Bind: []interface{}{
&localStruct{},
&services.GreetService{},
},
})
app.NewWebviewWindow()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
+5
View File
@@ -0,0 +1,5 @@
package models
type Person struct {
Name string
}
@@ -0,0 +1,23 @@
package services
import (
"github.com/wailsapp/wails/v3/examples/binding/models"
)
type GreetService struct {
SomeVariable int
lowercase string
Parent *models.Person
}
func (*GreetService) Greet(name string) string {
return "Hello " + name
}
func (g *GreetService) GetPerson() *models.Person {
return g.Parent
}
func (g *GreetService) SetPerson(person *models.Person) {
g.Parent = person
}
+15
View File
@@ -0,0 +1,15 @@
# Build
Wails has adopted [Taskfile](https://taskfile.dev) as its build tool. This is optional
and any build tool can be used. However, Taskfile is a great tool, and we recommend it.
The Wails CLI has built-in integration with Taskfile so the standalone version is not a
requirement.
## Building
To build the example, run:
```bash
wails run -t build
```
+42
View File
@@ -0,0 +1,42 @@
version: '3'
tasks:
pre-build:
summary: Pre-build hooks
post-build:
summary: Post-build hooks
build:
summary: Builds the application
cmds:
- task: pre-build
- go build -gcflags=all="-N -l" -o bin/testapp main.go
- task: post-build
env:
CGO_CFLAGS: "-mmacosx-version-min=10.13"
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
generate-icons:
summary: Generates Windows `.ico` and Mac `.icns` files from an image
dir: build
cmds:
# Generates both .ico and .icns files
- wails generate icon -input appicon.png
build-prod:
summary: Creates a production build of the application
cmds:
- go build -tags production -ldflags="-w -s" -o bin/testapp
package-darwin:
summary: Packages a production build of the application into a `.app` bundle
deps:
- build-prod
- generate-icons
cmds:
- mkdir -p buildtest.app/Contents/{MacOS,Resources}
- cp build/icons.icns buildtest.app/Contents/Resources
- cp bin/testapp buildtest.app/Contents/MacOS
- cp build/Info.plist buildtest.app/Contents

Some files were not shown because too many files have changed in this diff Show More