-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.toml
More file actions
320 lines (268 loc) · 9.17 KB
/
Makefile.toml
File metadata and controls
320 lines (268 loc) · 9.17 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
[config]
default_to_workspace = false
# Environment variables
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
PROJECT_NAME = "tmpltool"
# ========================================
# Standard Development Tasks
# ========================================
[tasks.format]
description = "Format code using rustfmt"
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all"]
[tasks.format-check]
description = "Check code formatting without making changes"
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
[tasks.clippy]
description = "Run clippy linter"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
[tasks.lint]
description = "Run extended lint checks (clippy + dead code detection)"
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings", "-W", "unused", "-W", "dead_code", "-W", "unreachable_code", "-W", "unused_imports", "-W", "unused_variables"]
[tasks.clippy-fix]
description = "Run clippy and automatically fix issues"
command = "cargo"
args = ["clippy", "--fix", "--all-targets", "--all-features"]
[tasks.clean]
description = "Clean all build artifacts"
command = "cargo"
args = ["clean"]
[tasks.build]
description = "Build the project in debug mode"
command = "cargo"
args = ["build"]
[tasks.build-release]
description = "Build the project in release mode (optimized)"
command = "cargo"
args = ["build", "--release"]
[tasks.test]
description = "Run all tests"
command = "cargo"
args = ["test"]
[tasks.test-verbose]
description = "Run all tests with verbose output"
command = "cargo"
args = ["test", "--", "--nocapture", "--test-threads=1"]
[tasks.run]
description = "Run the application with example"
command = "cargo"
args = ["run", "--", "examples/greeting.txt.tmpltool"]
[tasks.check]
description = "Fast check for compile errors (no binary generation)"
command = "cargo"
args = ["check", "--all-targets"]
# ========================================
# Cross-Platform Release Builds
# ========================================
[tasks.build-linux-x86_64]
description = "Build release binary for Linux x86_64"
command = "cargo"
args = ["build", "--release", "--target", "x86_64-unknown-linux-gnu"]
[tasks.build-linux-musl]
description = "Build static release binary for Linux (musl)"
command = "cargo"
args = ["build", "--release", "--target", "x86_64-unknown-linux-musl"]
[tasks.build-macos-x86_64]
description = "Build release binary for macOS x86_64 (Intel)"
command = "cargo"
args = ["build", "--release", "--target", "x86_64-apple-darwin"]
[tasks.build-macos-aarch64]
description = "Build release binary for macOS aarch64 (Apple Silicon)"
command = "cargo"
args = ["build", "--release", "--target", "aarch64-apple-darwin"]
[tasks.build-windows-x86_64]
description = "Build release binary for Windows x86_64"
command = "cargo"
args = ["build", "--release", "--target", "x86_64-pc-windows-gnu"]
[tasks.build-all-platforms]
description = "Build release binaries for all platforms"
dependencies = [
"build-linux-x86_64",
"build-macos-x86_64",
"build-macos-aarch64",
"build-windows-x86_64"
]
# ========================================
# Quality Assurance Flows
# ========================================
[tasks.ci]
description = "Run CI checks (format, clippy, test)"
dependencies = ["format-check", "clippy", "test"]
[tasks.qa]
description = "Run full quality assurance (format-check, lint, test)"
dependencies = ["format-check", "lint", "test"]
[tasks.pre-commit]
description = "Run checks before committing"
dependencies = ["format", "clippy", "test"]
# ========================================
# Documentation Tasks
# ========================================
[tasks.docs]
description = "Generate and open documentation"
command = "cargo"
args = ["doc", "--open", "--no-deps"]
[tasks.docs-build]
description = "Generate documentation without opening"
command = "cargo"
args = ["doc", "--no-deps"]
# ========================================
# Installation Tasks
# ========================================
[tasks.install]
description = "Install the binary to ~/.cargo/bin"
command = "cargo"
args = ["install", "--path", "."]
[tasks.uninstall]
description = "Uninstall the binary from ~/.cargo/bin"
command = "cargo"
args = ["uninstall", "tmpltool"]
# ========================================
# Benchmark & Performance Tasks
# ========================================
[tasks.bench]
description = "Run benchmarks (if any)"
command = "cargo"
args = ["bench"]
[tasks.bloat]
description = "Analyze binary size (requires cargo-bloat)"
install_crate = "cargo-bloat"
command = "cargo"
args = ["bloat", "--release"]
# ========================================
# Security & Audit Tasks
# ========================================
[tasks.audit]
description = "Audit dependencies for security vulnerabilities"
install_crate = "cargo-audit"
command = "cargo"
args = ["audit"]
[tasks.outdated]
description = "Check for outdated dependencies"
install_crate = "cargo-outdated"
command = "cargo"
args = ["outdated"]
[tasks.update]
description = "Update dependencies"
command = "cargo"
args = ["update"]
# ========================================
# Development Workflow
# ========================================
[tasks.dev]
description = "Quick development check (check + test)"
dependencies = ["check", "test"]
[tasks.release-prepare]
description = "Prepare for release (clean + format + clippy + test + build-release)"
dependencies = ["clean", "format", "clippy", "test", "build-release"]
[tasks.all]
description = "Full build and test suite"
dependencies = ["clean", "format", "clippy", "test", "build-release", "docs-build"]
# ========================================
# Package Building Tasks
# ========================================
[tasks.build-nix]
description = "Build with Nix flake"
command = "nix"
args = ["build"]
[tasks.build-msi]
description = "Build Windows MSI installer (requires WiX and cargo-wix)"
install_crate = "cargo-wix"
command = "cargo"
args = ["wix", "--nocapture"]
[tasks.build-dmg]
description = "Build macOS DMG installer"
dependencies = ["build-release"]
script_runner = "@shell"
script = '''
./scripts/create-dmg.sh
'''
[tasks.build-deb]
description = "Build Debian package"
install_crate = "cargo-deb"
command = "cargo"
args = ["deb"]
[tasks.build-rpm]
description = "Build RPM package"
install_crate = "cargo-generate-rpm"
script_runner = "@shell"
script = '''
cargo build --release
cargo generate-rpm
'''
# ========================================
# Example Testing Tasks
# ========================================
[tasks.test-examples]
description = "Test all example templates"
script_runner = "@shell"
script = '''
echo "Testing examples..."
cargo build --release
echo "✓ Testing greeting.txt.tmpltool..."
./target/release/tmpltool examples/greeting.txt.tmpltool > /dev/null
echo "✓ Testing basic.txt.tmpltool..."
CUSTOM_VAR="test" ./target/release/tmpltool examples/basic.txt.tmpltool > /dev/null
echo "✓ Testing config-with-defaults.toml.tmpltool..."
./target/release/tmpltool examples/config-with-defaults.toml.tmpltool > /dev/null
echo "✓ Testing docker-compose.yaml.tmpltool..."
./target/release/tmpltool examples/docker-compose.yaml.tmpltool > /dev/null
echo ""
echo "All examples tested successfully!"
'''
# ========================================
# Help Task
# ========================================
[tasks.default]
description = "Show available tasks"
script = '''
echo "==============================================="
echo "tmpltool - Available cargo-make tasks"
echo "==============================================="
echo ""
echo "Development:"
echo " cargo make build - Build debug binary"
echo " cargo make build-release - Build optimized binary"
echo " cargo make test - Run tests"
echo " cargo make run - Run with example"
echo " cargo make dev - Quick dev check"
echo ""
echo "Code Quality:"
echo " cargo make format - Format code"
echo " cargo make clippy - Run linter"
echo " cargo make qa - Full quality check"
echo " cargo make ci - CI checks"
echo ""
echo "Cross-Platform Builds:"
echo " cargo make build-linux-x86_64 - Linux x86_64"
echo " cargo make build-linux-musl - Linux (static)"
echo " cargo make build-macos-x86_64 - macOS Intel"
echo " cargo make build-macos-aarch64 - macOS Apple Silicon"
echo " cargo make build-windows-x86_64 - Windows x86_64"
echo " cargo make build-all-platforms - All platforms"
echo ""
echo "Package Building:"
echo " cargo make build-deb - Build Debian package"
echo " cargo make build-rpm - Build RPM package"
echo " cargo make build-msi - Build Windows MSI"
echo " cargo make build-dmg - Build macOS DMG"
echo " cargo make build-nix - Build with Nix flake"
echo ""
echo "Utilities:"
echo " cargo make clean - Clean build artifacts"
echo " cargo make docs - Generate & open docs"
echo " cargo make install - Install binary"
echo " cargo make audit - Security audit"
echo " cargo make test-examples - Test all examples"
echo ""
echo "Workflows:"
echo " cargo make release-prepare - Prepare for release"
echo " cargo make all - Full build suite"
echo ""
echo "==============================================="
'''