Skip to content

Commit 413228e

Browse files
refactor(taskfiles): split tauri.yml into cargo.yml and tauri.yml
Extract Cargo/Rust toolchain concerns from tauri.yml into a new taskfiles/cargo.yml (install-sccache, clean, build:timings, lint, format, test). Move shared env (PATH stripping, CARGO_*, RUSTFLAGS) to root taskfile.yml so all included tasks inherit them. Root lint, format, test, test:e2e, and build:timings now delegate to sub-tasks. Add deno:lint and deno:format to deno.yml to support delegation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ae7ead9 commit 413228e

4 files changed

Lines changed: 104 additions & 65 deletions

File tree

taskfile.yml

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,28 @@ shopt: ['globstar']
66
dotenv: ['.env']
77

88
vars:
9+
# Reserve 2 cores for system, minimum 1 job
10+
BUILD_JOBS: '{{if gt (sub numCPU 2) 0}}{{sub numCPU 2}}{{else}}1{{end}}'
11+
12+
env:
13+
# Strip IDE extension paths (e.g. VS Code globalStorage) from PATH so
14+
# IDE-bundled tools don't shadow project-pinned versions during builds
15+
PATH:
16+
sh: 'echo "$PATH" | tr ":" "\n" | grep -v "globalStorage" | paste -sd ":" -'
17+
CARGO_HOME: "{{.ROOT_DIR}}/.cache/cargo"
18+
CARGO_TARGET_DIR: "{{.ROOT_DIR}}/target"
19+
RUSTUP_TOOLCHAIN: nightly
20+
RUSTC_WRAPPER: sccache
21+
RUSTFLAGS: "-Zthreads={{.BUILD_JOBS}}"
22+
CARGO_BUILD_JOBS: "{{.BUILD_JOBS}}"
923

1024
includes:
1125
npm:
1226
taskfile: ./taskfiles/npm.yml
1327
deno:
1428
taskfile: ./taskfiles/deno.yml
29+
cargo:
30+
taskfile: ./taskfiles/cargo.yml
1531
tauri:
1632
taskfile: ./taskfiles/tauri.yml
1733

@@ -47,30 +63,25 @@ tasks:
4763
lint:
4864
desc: "Run linters"
4965
cmds:
50-
- cargo clippy --workspace
51-
- deno lint
66+
- task: cargo:lint
67+
- task: deno:lint
5268

5369
format:
5470
desc: "Run formatters"
5571
cmds:
56-
- cargo fmt --all
57-
- deno fmt
72+
- task: cargo:format
73+
- task: deno:format
5874

5975
test:
6076
desc: "Run tests (Rust + Frontend)"
6177
cmds:
62-
- |
63-
if command -v cargo-nextest &> /dev/null; then
64-
cargo nextest run --workspace
65-
else
66-
cargo test --workspace
67-
fi
68-
- npm --prefix app/frontend test
78+
- task: cargo:test
79+
- task: deno:test
6980

7081
test:e2e:
7182
desc: "Run Playwright E2E tests"
7283
cmds:
73-
- npm --prefix app/frontend run test:e2e
84+
- task: deno:test:e2e
7485

7586
build:
7687
desc: "Build Tauri app for current architecture"
@@ -100,15 +111,7 @@ tasks:
100111
build:timings:
101112
desc: "Analyze build performance bottlenecks"
102113
cmds:
103-
- cargo build --workspace --timings
104-
- |
105-
if [[ "$OSTYPE" == "darwin"* ]]; then
106-
open target/cargo-timings/cargo-timing.html
107-
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
108-
xdg-open target/cargo-timings/cargo-timing.html 2>/dev/null || echo "Open target/cargo-timings/cargo-timing.html in your browser"
109-
else
110-
echo "Open target/cargo-timings/cargo-timing.html in your browser"
111-
fi
114+
- task: cargo:build:timings
112115

113116
profile:
114117
desc: "Show CPU/RAM usage for mt processes (dev + release)"

taskfiles/cargo.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: "3.0"
2+
3+
set: ['e', 'u', 'pipefail']
4+
shopt: ['globstar']
5+
6+
tasks:
7+
install-sccache:
8+
desc: "Install sccache for Rust build caching"
9+
platforms: [darwin]
10+
cmds:
11+
- brew install sccache
12+
status:
13+
- command -v sccache &> /dev/null
14+
15+
clean:
16+
desc: "Clean Rust build artifacts"
17+
cmds:
18+
- cargo clean
19+
silent: true
20+
21+
build:timings:
22+
desc: "Analyze Rust build performance bottlenecks"
23+
cmds:
24+
- cargo build --workspace --timings
25+
- |
26+
if [[ "$OSTYPE" == "darwin"* ]]; then
27+
open target/cargo-timings/cargo-timing.html
28+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
29+
xdg-open target/cargo-timings/cargo-timing.html 2>/dev/null || echo "Open target/cargo-timings/cargo-timing.html in your browser"
30+
else
31+
echo "Open target/cargo-timings/cargo-timing.html in your browser"
32+
fi
33+
34+
lint:
35+
desc: "Run Rust linter"
36+
cmds:
37+
- cargo clippy --workspace
38+
39+
format:
40+
desc: "Format Rust code"
41+
cmds:
42+
- cargo fmt --all
43+
44+
test:
45+
desc: "Run Rust tests"
46+
cmds:
47+
- |
48+
if command -v cargo-nextest &> /dev/null; then
49+
cargo nextest run --workspace
50+
else
51+
cargo test --workspace
52+
fi

taskfiles/deno.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ tasks:
5858
- deno info --json package.json | head -50
5959
silent: true
6060

61+
lint:
62+
desc: "Run Deno linter"
63+
cmds:
64+
- deno lint
65+
66+
format:
67+
desc: "Format TypeScript/JavaScript code"
68+
cmds:
69+
- deno fmt
70+
6171
check-deps:
6272
desc: "Check if deno is installed"
6373
cmds:

taskfiles/tauri.yml

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,7 @@ vars:
1313
LINUX_AMD64_TARGET: "x86_64-unknown-linux-gnu"
1414
LINUX_ARM64_TARGET: "aarch64-unknown-linux-gnu"
1515
WINDOWS_X64_TARGET: "x86_64-pc-windows-msvc"
16-
# Reserve 2 cores for system, minimum 1 job
17-
BUILD_JOBS: '{{if gt (sub numCPU 2) 0}}{{sub numCPU 2}}{{else}}1{{end}}'
1816
env:
19-
# Strip IDE extension paths (e.g. VS Code globalStorage) from PATH so
20-
# IDE-bundled tools don't shadow project-pinned versions during builds
21-
PATH:
22-
sh: 'echo "$PATH" | tr ":" "\n" | grep -v "globalStorage" | paste -sd ":" -'
23-
CARGO_HOME: "{{.ROOT_DIR}}/.cache/cargo"
24-
CARGO_TARGET_DIR: "{{.ROOT_DIR}}/target"
25-
RUSTUP_TOOLCHAIN: nightly
26-
RUSTC_WRAPPER: sccache
27-
RUSTFLAGS: "-Zthreads={{.BUILD_JOBS}}"
28-
CARGO_BUILD_JOBS: "{{.BUILD_JOBS}}"
2917
APPLE_API_KEY_PATH: /tmp/auth_key.p8
3018

3119
tasks:
@@ -54,15 +42,6 @@ tasks:
5442
EOF
5543
silent: true
5644

57-
_install-macos-deps:
58-
internal: true
59-
desc: "Install macOS system dependencies for Tauri"
60-
platforms: [darwin]
61-
cmds:
62-
- brew install sccache
63-
status:
64-
- command -v sccache &> /dev/null
65-
6645
_install-linux-deps:
6746
internal: true
6847
desc: "Install Linux system dependencies for Tauri"
@@ -121,7 +100,7 @@ tasks:
121100
122101
build:
123102
desc: "Build Tauri app for current platform"
124-
deps: [":deno:install", "_install-macos-deps", "_install-linux-deps"]
103+
deps: [":deno:install", ":cargo:install-sccache", "_install-linux-deps"]
125104
vars:
126105
CURRENT_TARGET:
127106
sh: |
@@ -145,7 +124,7 @@ tasks:
145124
build:arm64:
146125
desc: "Build Tauri app for Apple Silicon (arm64)"
147126
platforms: [darwin/arm64]
148-
deps: [":deno:install", "_install-macos-deps"]
127+
deps: [":deno:install", ":cargo:install-sccache"]
149128
cmds:
150129
- task: _build
151130
vars:
@@ -158,7 +137,7 @@ tasks:
158137
build:x64:
159138
desc: "Build Tauri app for Intel (x86_64)"
160139
platforms: [darwin/amd64]
161-
deps: [":deno:install", "_install-macos-deps"]
140+
deps: [":deno:install", ":cargo:install-sccache"]
162141
cmds:
163142
- task: _build
164143
vars:
@@ -191,7 +170,7 @@ tasks:
191170
build:signed:
192171
desc: "Build signed macOS app (requires APPLE_SIGNING_IDENTITY)"
193172
platforms: [darwin]
194-
deps: [":deno:install", "_install-macos-deps"]
173+
deps: [":deno:install", ":cargo:install-sccache"]
195174
preconditions:
196175
- sh: '[ -n "$APPLE_SIGNING_IDENTITY" ]'
197176
msg: "APPLE_SIGNING_IDENTITY env var is required"
@@ -204,7 +183,7 @@ tasks:
204183
build:dmg:
205184
desc: "Build signed DMG installer (requires APPLE_SIGNING_IDENTITY)"
206185
platforms: [darwin]
207-
deps: [":deno:install", "_install-macos-deps"]
186+
deps: [":deno:install", ":cargo:install-sccache"]
208187
preconditions:
209188
- sh: '[ -n "$APPLE_SIGNING_IDENTITY" ]'
210189
msg: "APPLE_SIGNING_IDENTITY env var is required"
@@ -214,22 +193,23 @@ tasks:
214193

215194
dev:
216195
desc: "Run Tauri in development mode"
217-
deps: [":deno:install", "_install-macos-deps"]
196+
deps: [":deno:install", ":cargo:install-sccache"]
218197
cmds:
219198
- deno run -A npm:@tauri-apps/cli dev
220199
interactive: true
221200
ignore_error: true
222201

223202
dev:mcp:
224203
desc: "Run Tauri in development mode with MCP bridge for AI agent debugging"
225-
deps: [":deno:install", "_install-macos-deps"]
204+
deps: [":deno:install", ":cargo:install-sccache"]
226205
cmds:
227206
- deno run -A npm:@tauri-apps/cli dev -- --features mcp
228207
interactive: true
229208
ignore_error: true
230209

231210
icons:
232211
desc: "Generate app icons from logo"
212+
deps: [":deno:install"]
233213
cmds:
234214
- deno run -A npm:@tauri-apps/cli icon {{.ROOT_DIR}}/static/logo.png
235215
sources:
@@ -245,22 +225,6 @@ tasks:
245225
- rm -rf {{.ROOT_DIR}}/dist
246226
silent: true
247227

248-
clean:rust:
249-
desc: "Clean only Rust build artifacts"
250-
cmds:
251-
- cargo clean
252-
silent: true
253-
254-
test-app:
255-
desc: "Launch the built macOS app"
256-
platforms: [darwin]
257-
vars:
258-
APP_PATH: "{{.ROOT_DIR}}/target/{{.MACOS_ARM64_TARGET}}/release/bundle/macos/{{.APP_NAME}}.app"
259-
cmds:
260-
- open "{{.APP_PATH}}"
261-
preconditions:
262-
- test -d "{{.APP_PATH}}"
263-
264228
check-deps:
265229
desc: "Check if Tauri dependencies are installed"
266230
cmds:
@@ -294,6 +258,16 @@ tasks:
294258
cmds:
295259
- deno run -A npm:@tauri-apps/cli info
296260

261+
test-app:
262+
desc: "Launch the built macOS app"
263+
platforms: [darwin]
264+
vars:
265+
APP_PATH: "{{.ROOT_DIR}}/target/{{.MACOS_ARM64_TARGET}}/release/bundle/macos/{{.APP_NAME}}.app"
266+
cmds:
267+
- open "{{.APP_PATH}}"
268+
preconditions:
269+
- test -d "{{.APP_PATH}}"
270+
297271
build:linux-arm64:
298272
desc: "Build Linux ARM64 .deb via Docker (for Raspberry Pi)"
299273
cmds:

0 commit comments

Comments
 (0)