mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-08 09:31:44 +08:00
64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
version: '3'
|
|
|
|
includes:
|
|
common: ../Taskfile.yml
|
|
|
|
tasks:
|
|
build:
|
|
summary: Builds the application for Windows
|
|
deps:
|
|
- task: common:go:mod:tidy
|
|
- task: common:build:frontend
|
|
vars:
|
|
BUILD_FLAGS:
|
|
ref: .BUILD_FLAGS
|
|
PRODUCTION:
|
|
ref: .PRODUCTION
|
|
- task: common:generate:icons
|
|
cmds:
|
|
- task: generate:syso
|
|
- go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/{{.APP_NAME}}.exe
|
|
- cmd: powershell Remove-item *.syso
|
|
platforms: [windows]
|
|
- cmd: rm -f *.syso
|
|
platforms: [linux, darwin]
|
|
vars:
|
|
BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production -trimpath -buildvcs=false -ldflags="-w -s -H windowsgui"{{else}}-buildvcs=false -gcflags=all="-l"{{end}}'
|
|
env:
|
|
GOOS: windows
|
|
CGO_ENABLED: 0
|
|
GOARCH: '{{.ARCH | default ARCH}}'
|
|
PRODUCTION: '{{.PRODUCTION | default "false"}}'
|
|
|
|
package:
|
|
summary: Packages a production build of the application into a `.exe` bundle
|
|
cmds:
|
|
- task: create:nsis:installer
|
|
|
|
generate:syso:
|
|
summary: Generates Windows `.syso` file
|
|
dir: build
|
|
cmds:
|
|
- wails3 generate syso -arch {{.ARCH}} -icon windows/icon.ico -manifest windows/wails.exe.manifest -info windows/info.json -out ../wails_windows_{{.ARCH}}.syso
|
|
vars:
|
|
ARCH: '{{.ARCH | default ARCH}}'
|
|
|
|
create:nsis:installer:
|
|
summary: Creates an NSIS installer
|
|
dir: build/windows/nsis
|
|
deps:
|
|
- task: build
|
|
vars:
|
|
PRODUCTION: "true"
|
|
cmds:
|
|
# Create the Microsoft WebView2 bootstrapper if it doesn't exist
|
|
- wails3 generate webview2bootstrapper -dir "{{.ROOT_DIR}}/build/windows/nsis"
|
|
- makensis -DARG_WAILS_{{.ARG_FLAG}}_BINARY="{{.ROOT_DIR}}/{{.BIN_DIR}}/{{.APP_NAME}}.exe" project.nsi
|
|
vars:
|
|
ARCH: '{{.ARCH | default ARCH}}'
|
|
ARG_FLAG: '{{if eq .ARCH "amd64"}}AMD64{{else}}ARM64{{end}}'
|
|
|
|
run:
|
|
cmds:
|
|
- '{{.BIN_DIR}}/{{.APP_NAME}}.exe'
|