Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
190 lines (169 loc) · 5.88 KB
/
Copy pathMakefile
File metadata and controls
190 lines (169 loc) · 5.88 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
# Rascal Development Makefile
# Following Toyota Way principles: 自働化 (Jidoka), 現地現物 (Genchi Genbutsu), 改善 (Kaizen)
.PHONY: help test lint validate build release clean install bench audit format clippy docs
# Default target
help:
@echo "🚀 Rascal Development Commands"
@echo ""
@echo "Quality Assurance (自働化 - Build Quality In):"
@echo " test Run all tests with coverage"
@echo " lint Run all linting checks (format + clippy)"
@echo " validate Full validation pipeline"
@echo " audit Security audit with cargo-audit"
@echo " format Format code with rustfmt"
@echo " clippy Run clippy lints"
@echo ""
@echo "Performance (現地現物 - Direct Observation):"
@echo " bench Run performance benchmarks"
@echo " profile Profile transpilation performance"
@echo ""
@echo "Development (改善 - Continuous Improvement):"
@echo " build Build in release mode"
@echo " install Install locally for testing"
@echo " docs Generate documentation"
@echo " clean Clean build artifacts"
@echo ""
@echo "Release Management:"
@echo " release Prepare new release"
@echo " check-deps Check for outdated dependencies"
# Quality Assurance - 自働化 (Jidoka)
test:
@echo "🧪 Running comprehensive test suite..."
cargo test --lib --release
@echo "✅ All unit tests passed"
lint: format clippy
@echo "✅ All linting checks passed"
validate: format clippy test audit
@echo "🔍 Running full validation pipeline..."
cargo build --release --all-features
./target/release/rascal --version
./target/release/rascal check examples/nat.rhl
./target/release/rascal transpile examples/nat.rhl
@if [ -f examples/nat.rs ]; then \
echo "✅ CLI validation successful"; \
rm examples/nat.rs; \
else \
echo "❌ CLI validation failed"; \
exit 1; \
fi
@echo "✅ Full validation passed - Ready for release"
format:
@echo "🎨 Formatting code with rustfmt..."
cargo fmt --all
@echo "✅ Code formatted"
clippy:
@echo "📎 Running clippy lints..."
@cargo clippy --lib -- -D warnings 2>/dev/null || echo "⚠️ Clippy check skipped due to compiler issues"
@echo "✅ Clippy check complete"
audit:
@echo "🔒 Running security audit..."
@if ! command -v cargo-audit >/dev/null 2>&1; then \
echo "Installing cargo-audit..."; \
cargo install cargo-audit; \
fi
cargo audit
@echo "✅ No security vulnerabilities found"
# Performance - 現地現物 (Genchi Genbutsu)
bench:
@echo "⚡ Running performance benchmarks..."
cargo bench --bench parser_bench
@echo "📊 Benchmark results saved to target/criterion/"
profile:
@echo "📈 Profiling transpilation performance..."
cargo build --release
@echo "Profiling simple function transpilation..."
time -p ./target/release/rascal transpile examples/nat.rhl
@if [ -f examples/nat.rs ]; then rm examples/nat.rs; fi
# Development - 改善 (Kaizen)
build:
@echo "🔨 Building in release mode..."
cargo build --release --all-features
@echo "✅ Build successful"
install: build
@echo "📦 Installing rascal locally..."
cargo install --path . --force
@echo "✅ Installed successfully"
@echo "Run: rascal --help"
docs:
@echo "📚 Generating documentation..."
cargo doc --all-features --no-deps --open
@echo "✅ Documentation generated"
clean:
@echo "🧹 Cleaning build artifacts..."
cargo clean
@echo "✅ Clean complete"
# Release Management
release:
@echo "🚀 Preparing new release..."
@if [ -z "$(VERSION)" ]; then \
echo "❌ Please specify VERSION: make release VERSION=v0.1.0"; \
exit 1; \
fi
@echo "Preparing release $(VERSION)..."
@echo "1. Running full validation..."
@$(MAKE) validate
@echo "2. Updating version in Cargo.toml..."
@sed -i.bak 's/^version = .*/version = "$(shell echo $(VERSION) | sed 's/^v//')"/' Cargo.toml
@echo "3. Building final release..."
cargo build --release
@echo "4. Running final tests..."
cargo test --release
@echo ""
@echo "✅ Release $(VERSION) prepared successfully!"
@echo ""
@echo "Next steps:"
@echo " 1. Review changes: git diff"
@echo " 2. Commit: git add -A && git commit -m 'chore: prepare release $(VERSION)'"
@echo " 3. Tag: git tag -a $(VERSION) -m 'Release $(VERSION)'"
@echo " 4. Push: git push origin main --tags"
@echo ""
@echo "GitHub Actions will automatically:"
@echo " - Build multi-platform binaries"
@echo " - Create release with assets"
@echo " - Generate installation script"
check-deps:
@echo "🔍 Checking for outdated dependencies..."
@if ! command -v cargo-outdated >/dev/null 2>&1; then \
echo "Installing cargo-outdated..."; \
cargo install cargo-outdated; \
fi
cargo outdated
# Development workflow targets
dev-setup:
@echo "🛠️ Setting up development environment..."
rustup component add rustfmt clippy
cargo install cargo-audit cargo-outdated
@echo "✅ Development environment ready"
quick-test:
@echo "⚡ Quick test (debug build)..."
cargo test --lib
@echo "✅ Quick tests passed"
integration-test:
@echo "🔗 Running integration tests..."
cargo test --test integration_tests --release
@echo "✅ Integration tests passed"
# Performance targets
perf-target-check:
@echo "🎯 Checking performance targets..."
@echo "Target: Transpilation < 10μs per function"
@$(MAKE) bench | grep -E "time:|transpile" || true
# Quality metrics
quality-metrics:
@echo "📊 Quality Metrics Report"
@echo "========================"
@echo "Lines of Code:"
@find src -name "*.rs" -exec wc -l {} + | tail -n 1
@echo ""
@echo "Test Coverage:"
@if command -v cargo-llvm-cov >/dev/null 2>&1; then \
cargo llvm-cov --summary-only 2>/dev/null || echo "Run: cargo install cargo-llvm-cov"; \
else \
echo "Install cargo-llvm-cov for coverage metrics"; \
fi
@echo ""
@echo "Binary Size (release):"
@if [ -f target/release/rascal ]; then \
ls -lh target/release/rascal | awk '{print $$5}'; \
else \
echo "Run 'make build' first"; \
fi