-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustFile
More file actions
292 lines (252 loc) · 9.99 KB
/
JustFile
File metadata and controls
292 lines (252 loc) · 9.99 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
# Justfile for Ferros development
# Run `just setup` to get started
# Default recipe - show available commands
default:
@just --list
# Setup development environment for new contributors
setup: check-prerequisites install-rust install-nightly verify-setup run-setup-tests
@echo ""
@echo "🎉 Setup complete! You're ready to contribute to Ferros."
@echo ""
@echo "Next steps:"
@echo " • Run 'just fmt' to format code"
@echo " • Run 'just lint' to check code quality"
@echo " • Run 'just test' to run tests"
@echo " • Read CONTRIBUTING.md for guidelines"
# Run tests as part of setup
run-setup-tests:
@echo ""
@echo "🧪 Running tests..."
@cargo test --workspace --all-features
# Check if prerequisites are installed
check-prerequisites:
@echo "🦀 Setting up Ferros development environment..."
@echo ""
@echo "📋 Checking prerequisites..."
@command -v git >/dev/null 2>&1 || { echo "❌ git is not installed. Please install git first."; exit 1; }
@echo " ✓ git found"
@command -v rustup >/dev/null 2>&1 || { echo " ⚠ rustup not found - will install"; exit 0; }
@echo " ✓ rustup found"
@command -v cargo >/dev/null 2>&1 || { echo " ⚠ cargo not found - will install with rustup"; exit 0; }
@echo " ✓ cargo found"
@command -v cargo-ws >/dev/null 2>&1 || { echo " ⚠ cargo-ws not found (optional, install with: cargo install cargo-workspaces)"; exit 0; }
@echo " ✓ cargo-ws found"
# Install Rust toolchain via rustup
install-rust:
@echo ""
@echo "🔧 Installing Rust toolchain..."
@if ! command -v rustup >/dev/null 2>&1; then \
echo "Installing rustup..."; \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; \
export PATH="$HOME/.cargo/bin:$PATH"; \
echo " ✓ rustup installed"; \
else \
echo " ✓ rustup already installed"; \
fi
@if ! command -v cargo >/dev/null 2>&1; then \
echo " ⚠ cargo not in PATH. Please run: source $HOME/.cargo/env"; \
fi
# Install nightly toolchain with rustfmt component
install-nightly:
@echo ""
@echo "🌙 Installing nightly toolchain with rustfmt..."
@rustup toolchain install nightly --component rustfmt 2>&1 | grep -v "info:" || true
@echo " ✓ nightly toolchain installed"
@rustup toolchain list | grep -q nightly || { echo " ⚠ Failed to install nightly"; exit 1; }
# Verify that everything is set up correctly
verify-setup:
@echo ""
@echo "✅ Verifying setup..."
@echo "Verifying Rust installation..."
@rustc --version || { echo " ❌ rustc not found"; exit 1; }
@echo " ✓ rustc: $(rustc --version | cut -d' ' -f2)"
@echo "Verifying cargo..."
@cargo --version || { echo " ❌ cargo not found"; exit 1; }
@echo " ✓ cargo: $(cargo --version | cut -d' ' -f2)"
@echo "Verifying nightly toolchain..."
@rustup toolchain list | grep -q nightly || { echo " ❌ nightly toolchain not found"; exit 1; }
@echo " ✓ nightly toolchain installed"
@echo "Verifying rustfmt..."
@cargo fmt --version >/dev/null 2>&1 || { echo " ❌ rustfmt not found"; exit 1; }
@echo " ✓ rustfmt: $(cargo fmt --version | cut -d' ' -f2)"
@echo "Verifying clippy..."
@cargo clippy --version >/dev/null 2>&1 || { echo " ⚠ clippy not found (optional)"; exit 0; }
@echo " ✓ clippy: $(cargo clippy --version | cut -d' ' -f2)"
@echo "Verifying cargo-workspaces..."
@cargo ws --version >/dev/null 2>&1 || { echo " ⚠ cargo-ws not found (optional)"; exit 0; }
@echo " ✓ cargo-ws: $(cargo ws --version | cut -d' ' -f2)"
# Format all code
fmt:
@echo "🎨 Formatting code..."
@cargo fmt --all
# Check formatting without making changes
fmt-check:
@echo "🔍 Checking code formatting..."
@cargo fmt --all -- --check
# Run clippy linter
lint:
@echo "🔍 Running clippy..."
@cargo clippy --all --all-targets -- -D warnings
# Run clippy with auto-fix
lint-fix:
@echo "🔧 Running clippy with auto-fix..."
@cargo clippy --all --all-targets --fix --allow-dirty --allow-staged
# Run all tests
test:
@echo "🧪 Running tests..."
@cargo test --workspace --all-features
# Run tests for a specific crate (usage: just test-crate ferros-core)
test-crate CRATE:
@echo "🧪 Running tests for {{CRATE}}..."
@cargo test -p {{CRATE}} --all-features
# Build the project
build:
@echo "🔨 Building project..."
@cargo build --workspace --all-features
# Build in release mode
build-release:
@echo "🔨 Building release..."
@cargo build --release --workspace --all-features
# Build and open documentation
docs:
@echo "📚 Building and opening documentation..."
@cargo doc --workspace --open --no-deps
# Build documentation without opening
docs-build:
@echo "📚 Building documentation..."
@cargo doc --workspace --no-deps
# Run all checks (fmt, clippy, test)
check:
@echo "🔍 Running all checks..."
@just fmt
@just lint
@just test
# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
@cargo clean
# Show project information
info:
@echo "🦀 Ferros Development Information"
@echo ""
@echo "Rust version: $(rustc --version)"
@echo "Cargo version: $(cargo --version)"
@echo "Toolchain: $(rustup show active-toolchain 2>/dev/null || echo 'unknown')"
@echo ""
@echo "Workspace crates:"
@cargo ws list
# List workspace crates using cargo-ws
list:
@echo "📦 Workspace crates:"
@cargo ws list 2>/dev/null || { \
echo " ⚠ cargo-ws failed. This may be due to workspace configuration issues."; \
echo " Try running 'just clean' to remove build artifacts."; \
exit 1; \
}
# List crates that have changed since last tagged release
changed:
@echo "📝 Changed crates since last release:"
@cargo ws changed
# Execute a command in each crate (usage: just exec "cargo test")
exec COMMAND:
@echo "🔧 Executing '{{COMMAND}}' in each crate..."
@cargo ws exec {{COMMAND}}
# Bump version of crates (usage: just version patch|minor|major)
version LEVEL:
@echo "📌 Bumping {{LEVEL}} version across workspace..."
@cargo ws version {{LEVEL}}
# Show publishing plan
plan:
@echo "📋 Publishing order:"
@cargo ws plan 2>&1 | grep -v "^error: config value" || true
# Publish all crates in the workspace (with version bumping)
# Usage: just publish [BUMP]
# Examples:
# just publish # Interactive version bump and publish
# just publish patch # Bump patch version and publish
# just publish minor # Bump minor version and publish
# just publish major # Bump major version and publish
# Note: For additional options (--yes, --allow-dirty, etc.), use cargo ws publish directly
publish BUMP="":
@echo "📦 Publishing workspace crates..."
@if [ -z "{{BUMP}}" ]; then \
cargo ws publish; \
else \
cargo ws publish {{BUMP}}; \
fi
# Publish crates without versioning (from current git state)
publish-as-is:
@echo "📦 Publishing workspace crates as-is (no version bump)..."
@cargo ws publish --publish-as-is
# Publish with a delay between crates to avoid rate limiting
# Usage: just publish-with-delay [BUMP] [SECONDS]
# Example: just publish-with-delay patch 10
publish-with-delay BUMP="patch" SECONDS="10":
@echo "📦 Publishing workspace crates with {{SECONDS}}s delay between publishes..."
@cargo ws publish {{BUMP}} --publish-interval {{SECONDS}}
# Website development commands
# Run website in development mode
website-dev:
@echo "🌐 Starting website development server..."
@cd website && if command -v pnpm >/dev/null 2>&1; then \
pnpm dev; \
elif command -v npm >/dev/null 2>&1; then \
npm run dev; \
elif command -v yarn >/dev/null 2>&1; then \
yarn dev; \
else \
echo "❌ No package manager found. Please install pnpm, npm, or yarn."; \
exit 1; \
fi
# Build website for production
website-build:
@echo "🔨 Building website for production..."
@cd website && if command -v pnpm >/dev/null 2>&1; then \
pnpm build; \
elif command -v npm >/dev/null 2>&1; then \
npm run build; \
elif command -v yarn >/dev/null 2>&1; then \
yarn build; \
else \
echo "❌ No package manager found. Please install pnpm, npm, or yarn."; \
exit 1; \
fi
# Preview production build of website
website-preview:
@echo "👀 Previewing website production build..."
@cd website && if command -v pnpm >/dev/null 2>&1; then \
pnpm preview; \
elif command -v npm >/dev/null 2>&1; then \
npm run preview; \
elif command -v yarn >/dev/null 2>&1; then \
yarn preview; \
else \
echo "❌ No package manager found. Please install pnpm, npm, or yarn."; \
exit 1; \
fi
# macOS-specific commands
# Sign debugger binary with entitlements (macOS only)
# Usage: just sign-debugger [BINARY_PATH]
# Example: just sign-debugger target/debug/ferros
sign-debugger BINARY_PATH="target/debug/ferros":
@echo "🔐 Signing debugger binary with entitlements..."
@if [ ! -f "{{BINARY_PATH}}" ]; then \
echo "❌ Binary not found: {{BINARY_PATH}}"; \
echo " Build it first with: cargo build"; \
exit 1; \
fi
@if [ ! -f "crates/ferros-core/ferros.entitlements" ]; then \
echo "❌ Entitlements file not found: crates/ferros-core/ferros.entitlements"; \
exit 1; \
fi
@codesign --entitlements crates/ferros-core/ferros.entitlements --force --sign - "{{BINARY_PATH}}" || { \
echo "❌ Failed to sign binary. Make sure you have a code signing certificate."; \
echo " Create one with: Keychain Access > Certificate Assistant > Create a Certificate"; \
exit 1; \
}
@echo "✅ Binary signed successfully: {{BINARY_PATH}}"
# Build and sign debugger binary (macOS only)
build-sign:
@echo "🔨 Building and signing debugger..."
@just build
@just sign-debugger target/debug/ferros