mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
376 lines
11 KiB
YAML
376 lines
11 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
APP_NAME: "{{.ProjectName}}"
|
|
BIN_DIR: "bin"
|
|
|
|
tasks:
|
|
|
|
## -------------------------- Build -------------------------- ##
|
|
|
|
build:
|
|
summary: Builds the application
|
|
cmds:
|
|
# Build for current OS
|
|
- task: build:{{ "{{OS}}" }}
|
|
|
|
# Uncomment to build for specific OSes
|
|
# - task: build:linux
|
|
# - task: build:windows
|
|
# - task: build:darwin
|
|
|
|
|
|
## ------> Windows <-------
|
|
|
|
build:windows:
|
|
summary: Builds the application for Windows
|
|
deps:
|
|
- task: build:frontend
|
|
- task: generate:icons
|
|
- task: generate:syso
|
|
vars:
|
|
ARCH: {{ "'{{.ARCH}}'" }}
|
|
cmds:
|
|
- go build {{ "{{.BUILD_FLAGS}}" }} -o {{ "{{.BIN_DIR}}" }}/{{.ProjectName}}.exe
|
|
vars:
|
|
BUILD_FLAGS: {{ "'{{if eq .PRODUCTION \"true\"}}-tags production -ldflags=\"-w -s -H windowsgui\"{{else}}-gcflags=all=\"-N -l\"{{end}}'" }}
|
|
env:
|
|
GOOS: windows
|
|
CGO_ENABLED: 0
|
|
GOARCH: {{ "'{{.ARCH | default ARCH}}'" }}
|
|
PRODUCTION: {{ "'{{.PRODUCTION | default \"false\"}}'" }}
|
|
|
|
build:windows:prod:arm64:
|
|
summary: Creates a production build of the application
|
|
cmds:
|
|
- task: build:windows
|
|
vars:
|
|
ARCH: arm64
|
|
PRODUCTION: "true"
|
|
|
|
build:windows:prod:amd64:
|
|
summary: Creates a production build of the application
|
|
cmds:
|
|
- task: build:windows
|
|
vars:
|
|
ARCH: amd64
|
|
PRODUCTION: "true"
|
|
|
|
build:windows:debug:arm64:
|
|
summary: Creates a debug build of the application
|
|
cmds:
|
|
- task: build:windows
|
|
vars:
|
|
ARCH: arm64
|
|
|
|
build:windows:debug:amd64:
|
|
summary: Creates a debug build of the application
|
|
cmds:
|
|
- task: build:windows
|
|
vars:
|
|
ARCH: amd64
|
|
|
|
## ------> Darwin <-------
|
|
|
|
build:darwin:
|
|
summary: Creates a production build of the application
|
|
deps:
|
|
- task: build:frontend
|
|
- task: generate:icons
|
|
cmds:
|
|
- go build {{ "{{.BUILD_FLAGS}}" }} -o {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}
|
|
vars:
|
|
BUILD_FLAGS: {{ "'{{if eq .PRODUCTION \"true\"}}-tags production -ldflags=\"-w -s\"{{else}}-gcflags=all=\"-N -l\"{{end}}'" }}
|
|
env:
|
|
GOOS: darwin
|
|
CGO_ENABLED: 1
|
|
GOARCH: {{ "'{{.ARCH | default ARCH}}'" }}
|
|
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
|
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
|
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
|
PRODUCTION: {{ "'{{.PRODUCTION | default \"false\"}}'" }}
|
|
|
|
build:darwin:prod:arm64:
|
|
summary: Creates a production build of the application
|
|
cmds:
|
|
- task: build:darwin
|
|
vars:
|
|
ARCH: arm64
|
|
PRODUCTION: "true"
|
|
|
|
build:darwin:prod:amd64:
|
|
summary: Creates a production build of the application
|
|
cmds:
|
|
- task: build:darwin
|
|
vars:
|
|
ARCH: amd64
|
|
PRODUCTION: "true"
|
|
|
|
build:darwin:debug:arm64:
|
|
summary: Creates a debug build of the application
|
|
cmds:
|
|
- task: build:darwin
|
|
vars:
|
|
ARCH: arm64
|
|
|
|
build:darwin:debug:amd64:
|
|
summary: Creates a debug build of the application
|
|
cmds:
|
|
- task: build:darwin
|
|
vars:
|
|
ARCH: amd64
|
|
|
|
|
|
## ------> Linux <-------
|
|
|
|
build:linux:
|
|
summary: Builds the application for Linux
|
|
deps:
|
|
- task: build:frontend
|
|
- task: generate:icons
|
|
vars:
|
|
ARCH: {{ "'{{.ARCH}}'" }}
|
|
cmds:
|
|
- go build {{ "{{.BUILD_FLAGS}}" }} -o {{ "{{.BIN_DIR}}" }}/{{.ProjectName}}
|
|
vars:
|
|
BUILD_FLAGS: {{ "'{{if eq .PRODUCTION \"true\"}}-tags production -ldflags=\"-w -s\"{{else}}-gcflags=all=\"-N -l\"{{end}}'" }}
|
|
env:
|
|
GOOS: linux
|
|
CGO_ENABLED: 1
|
|
GOARCH: {{ "'{{.ARCH | default ARCH}}'" }}
|
|
PRODUCTION: {{ "'{{.PRODUCTION | default \"false\"}}'" }}
|
|
|
|
build:linux:prod:arm64:
|
|
summary: Creates a production build of the application
|
|
cmds:
|
|
- task: build:linux
|
|
vars:
|
|
ARCH: arm64
|
|
PRODUCTION: "true"
|
|
|
|
build:linux:prod:amd64:
|
|
summary: Creates a production build of the application
|
|
cmds:
|
|
- task: build:linux
|
|
vars:
|
|
ARCH: amd64
|
|
PRODUCTION: "true"
|
|
|
|
build:linux:debug:arm64:
|
|
summary: Creates a debug build of the application
|
|
cmds:
|
|
- task: build:linux
|
|
vars:
|
|
ARCH: arm64
|
|
|
|
build:linux:debug:amd64:
|
|
summary: Creates a debug build of the application
|
|
cmds:
|
|
- task: build:linux
|
|
vars:
|
|
ARCH: amd64
|
|
|
|
## -------------------------- Package -------------------------- ##
|
|
|
|
package:
|
|
summary: Packages a production build of the application into a bundle
|
|
cmds:
|
|
|
|
# Package for current OS
|
|
- task: package:{{ "{{OS}}" }}
|
|
|
|
# Package for specific os/arch
|
|
# - task: package:darwin:arm64
|
|
# - task: package:darwin:amd64
|
|
# - task: package:windows:arm64
|
|
# - task: package:windows:amd64
|
|
|
|
## ------> Windows <------
|
|
|
|
package:windows:
|
|
summary: Packages a production build of the application into a `.exe` bundle
|
|
cmds:
|
|
- task: create:nsis:installer
|
|
vars:
|
|
ARCH: {{ "'{{.ARCH}}'" }}
|
|
vars:
|
|
ARCH: {{ "'{{.ARCH | default ARCH}}'" }}
|
|
|
|
package:windows:arm64:
|
|
summary: Packages a production build of the application into a `.exe` bundle
|
|
cmds:
|
|
- task: package:windows
|
|
vars:
|
|
ARCH: arm64
|
|
|
|
package:windows:amd64:
|
|
summary: Packages a production build of the application into a `.exe` bundle
|
|
cmds:
|
|
- task: package:windows
|
|
vars:
|
|
ARCH: amd64
|
|
|
|
generate:syso:
|
|
summary: Generates Windows `.syso` file
|
|
dir: build
|
|
cmds:
|
|
- wails3 generate syso -arch {{ "{{.ARCH}}" }} -icon icon.ico -manifest wails.exe.manifest -info info.json -out ../wails.syso
|
|
vars:
|
|
ARCH: {{ "'{{.ARCH | default ARCH}}'" }}
|
|
|
|
create:nsis:installer:
|
|
summary: Creates an NSIS installer
|
|
label: "NSIS Installer ({{ "{{.ARCH}}"}})"
|
|
dir: build/nsis
|
|
sources:
|
|
- "{{ "{{.ROOT_DIR}}"}}\\bin\\{{ "{{.APP_NAME}}"}}.exe"
|
|
generates:
|
|
- "{{ "{{.ROOT_DIR}}"}}\\bin\\{{ "{{.APP_NAME}}"}}-{{ "{{.ARCH}}"}}-installer.exe"
|
|
deps:
|
|
- task: build:windows
|
|
vars:
|
|
PRODUCTION: "true"
|
|
ARCH: {{ "'{{.ARCH}}'" }}
|
|
cmds:
|
|
- 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}}'" }}
|
|
|
|
## ------> Darwin <------
|
|
|
|
package:darwin:
|
|
summary: Packages a production build of the application into a `.app` bundle
|
|
platforms: [ darwin ]
|
|
deps:
|
|
- task: build:darwin
|
|
vars:
|
|
PRODUCTION: "true"
|
|
cmds:
|
|
- task: create:app:bundle
|
|
|
|
package:darwin:arm64:
|
|
summary: Packages a production build of the application into a `.app` bundle
|
|
platforms: [ darwin/arm64 ]
|
|
deps:
|
|
- task: package:darwin
|
|
vars:
|
|
ARCH: arm64
|
|
|
|
package:darwin:amd64:
|
|
summary: Packages a production build of the application into a `.app` bundle
|
|
platforms: [ darwin/amd64 ]
|
|
deps:
|
|
- task: package:darwin
|
|
vars:
|
|
ARCH: amd64
|
|
|
|
create:app:bundle:
|
|
summary: Creates an `.app` bundle
|
|
cmds:
|
|
- mkdir -p {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}.app/Contents/{MacOS,Resources}
|
|
- cp build/icons.icns {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}.app/Contents/Resources
|
|
- cp {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }} {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}.app/Contents/MacOS
|
|
- cp build/Info.plist {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}.app/Contents
|
|
|
|
## ------> Linux <------
|
|
|
|
package:linux:
|
|
summary: Packages a production build of the application for Linux
|
|
platforms: [ linux ]
|
|
deps:
|
|
- task: build:linux
|
|
vars:
|
|
PRODUCTION: "true"
|
|
cmds:
|
|
- task: create:appimage
|
|
|
|
create:appimage:
|
|
summary: Creates an AppImage
|
|
platforms: [ linux ]
|
|
deps:
|
|
- task: build:linux
|
|
vars:
|
|
PRODUCTION: "true"
|
|
- task: generate:linux:dotdesktop
|
|
cmds:
|
|
- chmod +x {{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}
|
|
- chmod +x build/appimage/build.sh
|
|
- sh: build/appimage/build.sh
|
|
env:
|
|
- APP_NAME: {{ "'{{.APP_NAME}}'" }}
|
|
- APP_BINARY: '{{ "{{.ROOT_DIR}}"}}/{{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}'
|
|
- ICON_PATH: '{{ "{{.ROOT_DIR}}"}}/build/appicon.png'
|
|
- DESKTOP_FILE: '{{ "{{.ROOT_DIR}}"}}/build/{{ "{{.APP_NAME}}" }}.desktop'
|
|
|
|
generate:linux:dotdesktop:
|
|
summary: Generates a `.desktop` file
|
|
dir: build
|
|
sources:
|
|
- "appicon.png"
|
|
generates:
|
|
- "{{ "{{.ROOT_DIR}}"}}/build/appimage/{{ "{{.APP_NAME}}" }}.desktop"
|
|
cmds:
|
|
# Run `wails3 generate .desktop -help` for all the options
|
|
- |
|
|
wails3 generate .desktop
|
|
-name "{{ "{{.APP_NAME}}" }}"
|
|
-exec "{{ "{{.EXEC}}" }}"
|
|
-icon "{{ "{{.ICON}}" }}"
|
|
-outputfile {{ "{{.ROOT_DIR}}"}}/build/appimage/{{ "{{.APP_NAME}}" }}.desktop
|
|
# -categories "Development;Graphics;"
|
|
# -comment "A comment"
|
|
# -terminal "true"
|
|
# -version "1.0"
|
|
# -genericname "Generic Name"
|
|
# -keywords "keyword1;keyword2;"
|
|
# -startupnotify "true"
|
|
# -mimetype "application/x-extension1;application/x-extension2;"
|
|
|
|
vars:
|
|
APP_NAME: '-name \"{{ "{{.APP_NAME}}" }}\"'
|
|
EXEC: '{{ "{{.ROOT_DIR}}"}}/{{ "{{.BIN_DIR}}" }}/{{ "{{.APP_NAME}}" }}'
|
|
ICON: '{{ "{{.ROOT_DIR}}"}}/build/appicon.png'
|
|
OUTPUTFILE: '-outputfile {{ "{{.ROOT_DIR}}"}}/build/appimage/{{ "{{.APP_NAME}}" }}.desktop'
|
|
## -------------------------- Misc -------------------------- ##
|
|
|
|
|
|
generate:icons:
|
|
summary: Generates Windows `.ico` and Mac `.icns` files from an image
|
|
dir: build
|
|
sources:
|
|
- "appicon.png"
|
|
generates:
|
|
- "icons.icns"
|
|
- "icons.ico"
|
|
method: timestamp
|
|
cmds:
|
|
# Generates both .ico and .icns files
|
|
- wails3 generate icons -input appicon.png
|
|
|
|
install:frontend:deps:
|
|
summary: Install frontend dependencies
|
|
dir: frontend
|
|
sources:
|
|
- package.json
|
|
- package-lock.json
|
|
generates:
|
|
- node_modules/*
|
|
preconditions:
|
|
- sh: npm version
|
|
msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/"
|
|
cmds:
|
|
# - npm install --silent --no-progress
|
|
- npm install
|
|
|
|
build:frontend:
|
|
summary: Build the frontend project
|
|
dir: frontend
|
|
sources:
|
|
- "*"
|
|
generates:
|
|
- dist/*
|
|
deps:
|
|
- install:frontend:deps
|
|
cmds:
|
|
- npm run build
|