-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
268 lines (217 loc) · 11.3 KB
/
Copy pathjustfile
File metadata and controls
268 lines (217 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# jake - a justfile runner written in Zig
# Jake targets Zig 0.15.x. Prefer the repo's toolchain shim (resolves a
# compatible zig even when a newer one is on PATH); fall back to `zig`.
zig := if path_exists(justfile_directory() + "/scripts/zig") == "true" { justfile_directory() + "/scripts/zig" } else { "zig" }
# Default: show available recipes
default:
@just --list
# ─────────────────────────────────────────────────────────────────────────────
# Building
# ─────────────────────────────────────────────────────────────────────────────
# Build the project (debug mode)
[group('build')]
build:
{{zig}} build
# Build with ReleaseFast optimizations
[group('build')]
release:
{{zig}} build -Doptimize=ReleaseFast
# Build smallest binary
[group('build')]
release-small:
{{zig}} build -Doptimize=ReleaseSmall
# Build with safety checks enabled
[group('build')]
release-safe:
{{zig}} build -Doptimize=ReleaseSafe
# ─────────────────────────────────────────────────────────────────────────────
# Running
# ─────────────────────────────────────────────────────────────────────────────
# Build and run the application
[group('run')]
run *ARGS:
{{zig}} build run {{ if ARGS != "" { "-- " + ARGS } else { "" } }}
# ─────────────────────────────────────────────────────────────────────────────
# Testing
# ─────────────────────────────────────────────────────────────────────────────
# Run all tests
[group('test')]
test:
{{zig}} build test --summary all
# Run tests with verbose output
[group('test')]
test-verbose:
{{zig}} build test --summary all
# ─────────────────────────────────────────────────────────────────────────────
# Code Quality
# ─────────────────────────────────────────────────────────────────────────────
# Format all Zig source files
[group('quality')]
fmt:
{{zig}} fmt src/
# Check formatting without modifying files
[group('quality')]
fmt-check:
{{zig}} fmt --check src/
# ─────────────────────────────────────────────────────────────────────────────
# Development
# ─────────────────────────────────────────────────────────────────────────────
# Watch and rebuild on changes (requires entr)
[group('dev')]
watch:
find src -name '*.zig' | entr -c just build
# Watch and run tests on changes (requires entr)
[group('dev')]
watch-test:
find src -name '*.zig' | entr -c just test
# ─────────────────────────────────────────────────────────────────────────────
# Maintenance
# ─────────────────────────────────────────────────────────────────────────────
# Remove build artifacts and generated docs
[group('maintenance')]
clean:
rm -rf .zig-cache zig-out
# Fetch dependencies
[group('maintenance')]
fetch:
{{zig}} build --fetch
# Install to ~/.local/bin
[group('maintenance')]
install:
{{zig}} build --prefix ~/.local
# Uninstall from ~/.local/bin
[group('maintenance')]
uninstall:
rm -f ~/.local/bin/jake
# Generate Zig API documentation (into zig-out/docs)
[group('maintenance')]
docs:
{{zig}} build-lib src/root.zig -femit-docs=zig-out/docs -fno-emit-bin
# ─────────────────────────────────────────────────────────────────────────────
# CI (requires: brew install act)
# ─────────────────────────────────────────────────────────────────────────────
# Run CI workflow locally via act (requires: brew install act)
# Note: May fail if Zig download mirrors are unavailable
[group('ci')]
ci:
act push -W .github/workflows/ci.yml -P ubuntu-latest=catthehacker/ubuntu:act-latest --container-architecture linux/amd64
# ─────────────────────────────────────────────────────────────────────────────
# Fuzzing
# ─────────────────────────────────────────────────────────────────────────────
# Run coverage-guided fuzz tests
[group('fuzz')]
fuzz:
{{zig}} build fuzz --fuzz
# ─────────────────────────────────────────────────────────────────────────────
# E2E Tests
# ─────────────────────────────────────────────────────────────────────────────
# Run E2E test suite using jake
[group('test')]
e2e: release
cd tests/e2e && ../../zig-out/bin/jake test-all
# ─────────────────────────────────────────────────────────────────────────────
# Benchmarking & Profiling
# ─────────────────────────────────────────────────────────────────────────────
# Run internal zBench benchmarks
[group('bench')]
bench-internal:
{{zig}} build bench -Doptimize=ReleaseFast
# Build benchmark binary only
[group('bench')]
bench-build:
{{zig}} build bench-build -Doptimize=ReleaseFast
# Benchmark jake vs just (requires: brew install hyperfine)
[group('bench')]
bench: release
hyperfine --warmup 3 \
'./zig-out/bin/jake -l' \
'just --list' \
--export-markdown /dev/stdout
# Benchmark startup time
[group('bench')]
bench-startup: release
hyperfine --warmup 10 --runs 100 './zig-out/bin/jake --version'
# Benchmark parsing with different file sizes
[group('bench')]
bench-parse: release
#!/usr/bin/env bash
for n in 10 50 100 500; do
python3 -c "for i in range($n): print(f'task t{i}:\n echo {i}\n')" > /tmp/jake-$n.jake
done
hyperfine --warmup 3 \
'./zig-out/bin/jake -f /tmp/jake-10.jake -l' \
'./zig-out/bin/jake -f /tmp/jake-50.jake -l' \
'./zig-out/bin/jake -f /tmp/jake-100.jake -l' \
'./zig-out/bin/jake -f /tmp/jake-500.jake -l'
# Benchmark parallel scaling
[group('bench')]
bench-parallel: release
hyperfine --warmup 2 \
'./zig-out/bin/jake -j1 -n all' \
'./zig-out/bin/jake -j2 -n all' \
'./zig-out/bin/jake -j4 -n all' \
'./zig-out/bin/jake -j8 -n all'
# Profile with samply (requires: brew install samply)
[group('bench')]
profile: release-safe
samply record ./zig-out/bin/jake -l
# Check for memory leaks (macOS)
[group('bench')]
leaks: release-safe
leaks --atExit -- ./zig-out/bin/jake -l
# Show binary sizes for all optimization levels
[group('bench')]
sizes:
@echo "Building all optimization levels..."
@{{zig}} build -Doptimize=Debug && cp zig-out/bin/jake /tmp/jake-debug
@{{zig}} build -Doptimize=ReleaseSafe && cp zig-out/bin/jake /tmp/jake-safe
@{{zig}} build -Doptimize=ReleaseFast && cp zig-out/bin/jake /tmp/jake-fast
@{{zig}} build -Doptimize=ReleaseSmall && cp zig-out/bin/jake /tmp/jake-small
@echo ""
@echo "Binary sizes:"
@ls -lh /tmp/jake-debug /tmp/jake-safe /tmp/jake-fast /tmp/jake-small
# ─────────────────────────────────────────────────────────────────────────────
# Info
# ─────────────────────────────────────────────────────────────────────────────
# Show project info
[group('info')]
info:
@echo "Project: jake"
@echo "Zig version: $({{zig}} version)"
@echo "Source files:"
@find src -name '*.zig' | xargs wc -l | tail -1
# Show zig build options
[group('info')]
zig-help:
{{zig}} build --help
# ─────────────────────────────────────────────────────────────────────────────
# Editor Plugins
# ─────────────────────────────────────────────────────────────────────────────
# Sync all editor plugin files from canonical sources
[group('editors')]
editors-sync:
./editors/sync.sh
# Check if editor plugin files are in sync (for CI)
[group('editors')]
editors-sync-check:
./editors/sync.sh --check
# Build tree-sitter-jake grammar
[group('editors')]
editors-tree-sitter:
cd editors/tree-sitter-jake && npm run build
# Run tree-sitter-jake tests
[group('editors')]
editors-tree-sitter-test:
cd editors/tree-sitter-jake && npm test
# Generate flavored tree-sitter queries
[group('editors')]
editors-queries:
cd editors/tree-sitter-jake && python3 build-flavored-queries.py
# Package VS Code extension
[group('editors')]
editors-vscode-package:
cd editors/vscode-jake && npx vsce package
# Build IntelliJ plugin
[group('editors')]
editors-intellij-build:
cd editors/intellij-jake && ./gradlew buildPlugin