Skip to content

Commit 8bd1517

Browse files
authored
Update taskfiles to match modern wails tempalte. (#85)
- Also fixes windows icon
1 parent ac7f9ea commit 8bd1517

12 files changed

Lines changed: 261 additions & 187 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
bin
22
.task
3+
build/**/*.ico
4+
build/**/*.icns
5+
*.syso

Taskfile.yml

Lines changed: 13 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,178 +1,32 @@
1-
version: "3"
1+
version: '3'
2+
3+
includes:
4+
common: ./build/Taskfile.yml
5+
windows: ./build/windows/Taskfile.yml
6+
linux: ./build/linux/Taskfile.yml
27

38
vars:
49
APP_NAME: "rlbotgui"
510
BIN_DIR: "bin"
6-
VITE_PORT: "{{.WAILS_VITE_PORT | default 9245}}"
11+
VITE_PORT: '{{.WAILS_VITE_PORT | default 9245}}'
712

813
tasks:
9-
## -------------------------- Build -------------------------- ##
10-
1114
build:
1215
summary: Builds the application
1316
cmds:
14-
# Build for current OS
15-
- task: build:{{OS}}
16-
17-
build:go:
18-
summary: Builds the application without frontend
19-
cmds:
20-
# Build for current OS
21-
- task: build:{{OS}}:go
22-
23-
build:windows:go:
24-
summary: Builds the application without frontend for Windows
25-
deps:
26-
- task: go:mod:tidy
27-
vars:
28-
BUILD_FLAGS: "{{.BUILD_FLAGS}}"
29-
- task: generate:icons
30-
vars:
31-
ARCH: "{{.ARCH}}"
32-
cmds:
33-
- go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/rlbotgui.exe
34-
vars:
35-
BUILD_FLAGS: '{{if ne .DEV "true"}}-tags production -trimpath -ldflags="-w -s -H windowsgui"{{else}}-gcflags=all="-l"{{end}}'
36-
env:
37-
GOOS: windows
38-
CGO_ENABLED: 1
39-
GOARCH: "{{.ARCH | default ARCH}}"
40-
CC: x86_64-w64-mingw32-gcc
41-
DEV: '{{.DEV | default "true"}}'
42-
43-
build:windows:
44-
summary: Builds the application for Windows
45-
deps:
46-
- task: build:frontend
47-
vars:
48-
BUILD_FLAGS: "{{.BUILD_FLAGS}}"
49-
cmds:
50-
- task: build:windows:go
51-
52-
## ------> Linux <-------
53-
54-
build:linux:go:
55-
summary: Builds the application without the frontend for Linux
56-
deps:
57-
- task: go:mod:tidy
58-
vars:
59-
BUILD_FLAGS: "{{.BUILD_FLAGS}}"
60-
- task: generate:icons
61-
vars:
62-
ARCH: "{{.ARCH}}"
63-
cmds:
64-
- go build {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/rlbotgui
65-
vars:
66-
BUILD_FLAGS: '{{if ne .DEV "true"}}-tags production -trimpath -ldflags="-w -s"{{else}}-gcflags=all="-l"{{end}}'
67-
env:
68-
GOOS: linux
69-
CGO_ENABLED: 1
70-
GOARCH: "{{.ARCH | default ARCH}}"
71-
DEV: '{{.DEV | default "true"}}'
72-
73-
build:linux:
74-
summary: Builds the application for Linux
75-
deps:
76-
- task: build:frontend
77-
vars:
78-
BUILD_FLAGS: "{{.BUILD_FLAGS}}"
79-
cmds:
80-
- task: build:linux:go
81-
82-
## -------------------------- Misc -------------------------- ##
83-
84-
generate:icons:
85-
summary: Generates Windows `.ico` file from an image
86-
dir: build
87-
sources:
88-
- "appicon.png"
89-
generates:
90-
- "icon.ico"
91-
cmds:
92-
# Generates both .ico
93-
- wails3 generate icons -input appicon.png -windowsfilename icon.ico
17+
- task: "{{OS}}:build"
9418

95-
install:frontend:deps:
96-
summary: Install frontend dependencies
97-
dir: frontend
98-
sources:
99-
- package.json
100-
- package-lock.json
101-
generates:
102-
- node_modules/*
103-
preconditions:
104-
- sh: pnpm version
105-
msg: "Looks like pnpm isn't installed."
19+
package:
20+
summary: Packages a production build of the application
10621
cmds:
107-
# - npm install --silent --no-progress
108-
- pnpm install
109-
110-
build:frontend:
111-
summary: Build the frontend project
112-
dir: frontend
113-
sources:
114-
- "**/*"
115-
generates:
116-
- dist/*
117-
deps:
118-
- install:frontend:deps
119-
- task: generate:bindings
120-
vars:
121-
BUILD_FLAGS: "{{.BUILD_FLAGS}}"
122-
cmds:
123-
- pnpm run build # -q
124-
125-
generate:bindings:
126-
summary: Generates bindings for the frontend
127-
sources:
128-
- "**/*.go"
129-
- go.mod
130-
- go.sum
131-
generates:
132-
- "frontend/bindings/**/*"
133-
cmds:
134-
# For a complete list of options, run `wails3 generate bindings -help`
135-
- wails3 generate bindings -f '{{.BUILD_FLAGS}}'
136-
137-
go:mod:tidy:
138-
summary: Runs `go mod tidy`
139-
internal: true
140-
generates:
141-
- go.sum
142-
sources:
143-
- go.mod
144-
cmds:
145-
- go mod tidy
146-
147-
# ----------------------- dev ----------------------- #
22+
- task: "{{OS}}:package"
14823

14924
run:
15025
summary: Runs the application
15126
cmds:
152-
- task: run:{{OS}}
153-
154-
run:windows:
155-
cmds:
156-
- '{{.BIN_DIR}}\\{{.APP_NAME}}.exe'
157-
158-
run:linux:
159-
cmds:
160-
- "{{.BIN_DIR}}/{{.APP_NAME}}"
161-
162-
dev:frontend:
163-
summary: Runs the frontend in development mode
164-
dir: frontend
165-
deps:
166-
- task: install:frontend:deps
167-
cmds:
168-
- pnpm run dev --port {{.VITE_PORT}}
27+
- task: "{{OS}}:run"
16928

17029
dev:
17130
summary: Runs the application in development mode
17231
cmds:
173-
- wails3 dev -port {{.VITE_PORT}}
174-
175-
dev:reload:
176-
summary: Reloads the application
177-
cmds:
178-
- task: run
32+
- wails3 dev -config ./build/config.yml -port {{.VITE_PORT}}

build/Taskfile.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
version: '3'
2+
3+
tasks:
4+
go:mod:tidy:
5+
summary: Runs `go mod tidy`
6+
internal: true
7+
cmds:
8+
- go mod tidy
9+
10+
install:frontend:deps:
11+
summary: Install frontend dependencies
12+
dir: frontend
13+
sources:
14+
- package.json
15+
- package-lock.json
16+
generates:
17+
- node_modules
18+
preconditions:
19+
- sh: pnpm version
20+
msg: "Looks like pnpm isn't installed."
21+
cmds:
22+
- pnpm install
23+
24+
build:frontend:
25+
label: build:frontend (DEV={{.DEV}})
26+
summary: Build the frontend project
27+
dir: frontend
28+
sources:
29+
- "**/*"
30+
generates:
31+
- dist/**/*
32+
deps:
33+
- task: install:frontend:deps
34+
- task: generate:bindings
35+
vars:
36+
BUILD_FLAGS:
37+
ref: .BUILD_FLAGS
38+
cmds:
39+
- npm run {{.BUILD_COMMAND}} -q
40+
env:
41+
PRODUCTION: '{{if eq .DEV "true"}}false{{else}}true{{end}}'
42+
vars:
43+
BUILD_COMMAND: '{{if eq .DEV "true"}}build:dev{{else}}build{{end}}'
44+
45+
generate:bindings:
46+
label: generate:bindings (BUILD_FLAGS={{.BUILD_FLAGS}})
47+
summary: Generates bindings for the frontend
48+
deps:
49+
- task: go:mod:tidy
50+
sources:
51+
- "**/*.[jt]s"
52+
- exclude: frontend/**/*
53+
- frontend/bindings/**/* # Rerun when switching between dev/production mode causes changes in output
54+
- "**/*.go"
55+
- go.mod
56+
- go.sum
57+
generates:
58+
- frontend/bindings/**/*
59+
cmds:
60+
- wails3 generate bindings -f '{{.BUILD_FLAGS}}' -clean=true
61+
62+
generate:icons:
63+
summary: Generates Windows `.ico` and Mac `.icns` from an image; on macOS, `-iconcomposerinput appicon.icon -macassetdir darwin` also produces `Assets.car` from a `.icon` file (skipped on other platforms).
64+
dir: build
65+
sources:
66+
- "appicon.png"
67+
- "appicon.icon"
68+
generates:
69+
- "darwin/icons.icns"
70+
- "windows/icon.ico"
71+
cmds:
72+
- wails3 generate icons -input appicon.png -macfilename darwin/icons.icns -windowsfilename windows/icon.ico -iconcomposerinput appicon.icon -macassetdir darwin
73+
74+
dev:frontend:
75+
summary: Runs the frontend in development mode
76+
dir: frontend
77+
deps:
78+
- task: install:frontend:deps
79+
cmds:
80+
- npm run dev -- --port {{.VITE_PORT}} --strictPort
81+
82+
update:build-assets:
83+
summary: Updates the build assets
84+
dir: build
85+
cmds:
86+
- wails3 update build-assets -name "{{.APP_NAME}}" -binaryname "{{.APP_NAME}}" -config config.yml -dir .

build/config.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
version: "3"
22

3+
# This information is used to generate the build assets.
4+
info:
5+
companyName: "RLBot" # The name of the company
6+
productName: "RLBotGUI" # The name of the application
7+
productIdentifier: "org.rlbot.gui" # The unique product identifier
8+
description: "A GUI for RLBot v5" # The application description
9+
copyright: "(c) 2026, RLBot Contributors" # Copyright text
10+
# comments: "Some Product Comments" # Comments
11+
# version: "0.0.1" # The application version
12+
313
dev_mode:
414
root_path: .
515
log_level: warn
@@ -16,17 +26,13 @@ dev_mode:
1626
- .gitkeep
1727
watched_extension:
1828
- "*.go"
29+
# - "*.js" # Watch for changes to JS/TS files included using the //wails:include directive.
30+
# - "*.ts" # The frontend directory will be excluded entirely by the setting above.
1931
git_ignore: true
2032
executes:
21-
- cmd: wails3 task build
22-
type: once
23-
- cmd: wails3 task install:frontend:deps
24-
type: once
25-
- cmd: wails3 task dev:frontend
26-
type: background
27-
- cmd: go mod tidy
28-
type: blocking
29-
- cmd: wails3 task build:go
33+
- cmd: wails3 build DEV=true
3034
type: blocking
35+
- cmd: wails3 task common:dev:frontend
36+
type: background
3137
- cmd: wails3 task run
3238
type: primary

build/icon.ico

-93 KB
Binary file not shown.

build/info.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)