Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
136 lines (117 loc) · 4.48 KB
/
Copy pathJustfile
File metadata and controls
136 lines (117 loc) · 4.48 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
# Lists all available commands.
list:
@just --list
# Update sponsors data
update-sponsors:
php scripts/update-sponsors-docs.php
# Regenerate the analyzer issue codes.
regen-analyzer-issue-codes:
rm -f crates/analyzer/src/code.rs
php scripts/regen-analyzer-issue-codes.php >> crates/analyzer/src/code.rs
rustfmt crates/analyzer/src/code.rs
# Regenerate the PHP SDK's stable syntax node names.
regen-sdk-node-kinds:
php scripts/regen-sdk-node-kinds.php
# Builds the library in release mode.
build:
cargo build --release
# Builds the webassembly module.
build-wasm:
cd crates/wasm && wasm-pack build --release --out-dir pkg
# Detects problems using rustfmt, clippy, and cargo check, and runs the linter and analyzer.
check:
cargo run -- fmt --check
cargo run -- lint
cargo run -- analyze
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo check --workspace --locked
# Fixes linting problems automatically using clippy, cargo fix, and rustfmt.
fix:
cargo run -- lint --fix
cargo run -- analyze --fix
cargo run -- fmt
cargo clippy --workspace --all-targets --all-features --fix --allow-dirty --allow-staged
cargo fix --allow-dirty --allow-staged
cargo fmt --all
# Runs all tests in the workspace.
test:
cargo test --workspace --locked --all-targets
# Runs the PHP SDK test suite.
test-sdk:
vendor/bin/phpunit --configuration composer/phpunit.xml
# Check formatted templates with the Twig runtime.
test-twig-runtime:
cargo build --bin mago --locked
php crates/twig-formatter/tests/runtime.php
# Check Twig lint fixes with the Twig runtime.
test-twig-linter-runtime:
cargo build --bin mago --locked
php crates/twig-linter/tests/runtime.php
# Fuzz the PHP lexer. Seeds are drawn from the syntax/analyzer/formatter PHP fixtures.
fuzz-php-lexer:
cd crates/syntax/fuzz && cargo +nightly fuzz run lexer \
corpus/lexer \
../tests/fixtures \
../../analyzer/tests/cases \
../../formatter/tests/cases
# Fuzz the PHP parser. Seeds are drawn from the syntax/analyzer/formatter PHP fixtures.
fuzz-php-parser:
cd crates/syntax/fuzz && cargo +nightly fuzz run parser \
corpus/parser \
../tests/fixtures \
../../analyzer/tests/cases \
../../formatter/tests/cases
# Fuzz the Twig lexer.
fuzz-twig-lexer:
cd crates/twig-syntax/fuzz && cargo +nightly fuzz run lexer corpus/lexer seeds/lexer
# Fuzz the Twig parser.
fuzz-twig-parser:
cd crates/twig-syntax/fuzz && cargo +nightly fuzz run parser corpus/parser seeds/parser
# Fuzz Twig formatting and idempotence.
fuzz-twig-formatter:
cd crates/twig-formatter/fuzz && cargo +nightly fuzz run formatter corpus/formatter ../tests/cases
# Fuzz Twig lint rules and their fixes.
fuzz-twig-linter:
cd crates/twig-linter/fuzz && cargo +nightly fuzz run linter corpus/linter ../tests/fixtures ../tests/runtime/cases ../../twig-formatter/tests/cases
# Publishes all crates to crates.io in the correct order.
publish $CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE="allow":
# Note: the order of publishing is important, as some crates depend on others.
# Each crate needs the siblings published just before it, so the publish-age cooldown is off here.
cargo publish -p mago-bytes
cargo publish -p mago-word
cargo publish -p mago-allocator
cargo publish -p mago-casing
cargo publish -p mago-php-version
cargo publish -p mago-text-edit
cargo publish -p mago-database
cargo publish -p mago-span
cargo publish -p mago-reporting
cargo publish -p mago-syntax-core
cargo publish -p mago-syntax
cargo publish -p mago-phpdoc-syntax
cargo publish -p mago-twig-syntax
cargo publish -p mago-flags
cargo publish -p mago-hir
cargo publish -p mago-collector
cargo publish -p mago-composer
cargo publish -p mago-formatter-core
cargo publish -p mago-formatter
cargo publish -p mago-twig-formatter
cargo publish -p mago-names
cargo publish -p mago-semantics
cargo publish -p mago-fingerprint
cargo publish -p mago-codex
cargo publish -p mago-prelude
cargo publish -p mago-algebra
cargo publish -p mago-guard
cargo publish -p mago-extension
cargo publish -p mago-analyzer
cargo publish -p mago-linter
cargo publish -p mago-twig-linter
cargo publish -p mago-orchestrator
cargo publish -p mago-wasm
cargo publish
# Cleans all build artifacts from the workspace.
clean:
cargo clean --workspace