mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 08:31:47 +08:00
184 lines
4.5 KiB
YAML
184 lines
4.5 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
APP_NAME: "dev{{exeExt}}"
|
|
|
|
tasks:
|
|
|
|
pre-build:
|
|
summary: Pre-build hooks
|
|
|
|
post-build:
|
|
summary: Post-build hooks
|
|
|
|
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
|
|
|
|
build-frontend:
|
|
summary: Build the frontend project
|
|
dir: frontend
|
|
sources:
|
|
- src/*
|
|
generates:
|
|
- dist/*
|
|
deps:
|
|
- install-frontend-deps
|
|
cmds:
|
|
- npm run build
|
|
|
|
build:darwin:
|
|
summary: Builds the application
|
|
platforms:
|
|
- darwin
|
|
cmds:
|
|
- task: pre-build
|
|
- task: build-frontend
|
|
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
|
- task: post-build
|
|
env:
|
|
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
|
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
|
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
|
|
|
build:backend:darwin:
|
|
summary: Builds the application
|
|
platforms:
|
|
- darwin
|
|
cmds:
|
|
- task: pre-build
|
|
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
|
- task: post-build
|
|
env:
|
|
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
|
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
|
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
|
|
|
build:windows:
|
|
summary: Builds the application for Windows
|
|
platforms:
|
|
- windows
|
|
cmds:
|
|
- task: pre-build
|
|
- task: build-frontend
|
|
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
|
- task: post-build
|
|
|
|
|
|
build:backend:windows:
|
|
summary: Builds the backend application for Windows
|
|
platforms:
|
|
- windows
|
|
cmds:
|
|
- task: pre-build
|
|
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
|
- task: post-build
|
|
|
|
build:
|
|
summary: Builds the application
|
|
watch: true
|
|
sources:
|
|
- main.go
|
|
cmds:
|
|
- task: build:darwin
|
|
- task: build:windows
|
|
- task: run
|
|
|
|
build:backend:
|
|
summary: Builds the backend application
|
|
cmds:
|
|
- task: build:backend:darwin
|
|
- task: build:backend:windows
|
|
|
|
generate-icons:
|
|
summary: Generates Windows `.ico` and Mac `.icns` files from an image
|
|
dir: build
|
|
cmds:
|
|
# Generates both .ico and .icns files
|
|
- wails generate icons -input appicon.png
|
|
|
|
build-app-prod-darwin:
|
|
summary: Creates a production build of the application
|
|
cmds:
|
|
- task: pre-build
|
|
- task: build-frontend
|
|
- GOOS=darwin GOARCH={{.ARCH}} go build -tags production -ldflags="-w -s" -o build/bin/{{.APP_NAME}}
|
|
- task: post-build
|
|
env:
|
|
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
|
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
|
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
|
vars:
|
|
ARCH: $GOARCH
|
|
|
|
frontend:dev:
|
|
summary: Runs the frontend in development mode
|
|
deps:
|
|
- task: install-frontend-deps
|
|
dir: frontend
|
|
cmds:
|
|
- npm run dev
|
|
|
|
run:
|
|
summary: Runs the application
|
|
cmds:
|
|
- ./bin/{{.APP_NAME}}
|
|
|
|
dev:
|
|
summary: Runs the application in development mode
|
|
watch: true
|
|
preconditions:
|
|
- sh: 'wails3 tool checkport -p 5173'
|
|
msg: "Vite does not appear to be running. Please run `wails3 task frontend:dev` in another terminal."
|
|
cmds:
|
|
- task: build:backend
|
|
|
|
create-app-bundle:
|
|
summary: Builds a `.app` bundle
|
|
cmds:
|
|
- mkdir -p {{.APP_NAME}}.app/Contents/{MacOS,Resources}
|
|
- cp build/icons.icns {{.APP_NAME}}.app/Contents/Resources
|
|
- cp build/bin/{{.APP_NAME}} {{.APP_NAME}}.app/Contents/MacOS
|
|
- cp build/Info.plist {{.APP_NAME}}.app/Contents
|
|
|
|
package-darwin-arm64:
|
|
summary: Packages a production build of the application into a `.app` bundle
|
|
platform: darwin
|
|
deps:
|
|
- task: build-app-prod-darwin
|
|
vars:
|
|
ARCH: arm64
|
|
- generate-icons
|
|
cmds:
|
|
- task: create-app-bundle
|
|
|
|
generate:syso:
|
|
dir: build
|
|
platform: windows
|
|
cmds:
|
|
- wails generate syso -arch {{.ARCH}} -icon icon.ico -manifest wails.exe.manifest -info info.json
|
|
vars:
|
|
ARCH: $GOARCH
|
|
|
|
package:windows:
|
|
summary: Packages a production build of the application into a `.exe` bundle
|
|
platform: windows
|
|
deps:
|
|
- generate-icons
|
|
cmds:
|
|
- task: generate:syso
|
|
vars:
|
|
ARCH: amd64
|
|
- go build -tags production -ldflags="-w -s -H windowsgui" -o bin/{{.APP_NAME}}.exe
|
|
- powershell Remove-item *.syso
|