mirror of
https://github.com/imjasonh/krust
synced 2026-07-06 22:12:32 +00:00
- Integrate cargo-zigbuild as the default build backend, falling back to cargo build with best-effort linker detection if not installed - Auto-install rustup targets when missing (rustup target add) - Use persistent target/krust/ directory instead of temp dirs so incremental compilation works across runs - Remove .cargo/config.toml from repo (add to .gitignore) since zigbuild handles cross-linker configuration - Improve error messages: suggest cargo-zigbuild when linker not found - Simplify CI to use zigbuild instead of per-target system linkers - Simplify Makefile by removing setup-cross-compile/verify targets - Update README and CLAUDE.md to reflect new approach https://claude.ai/code/session_01EcsZDNeWn56wFqryb4Wq7r
68 lines
1.4 KiB
Makefile
68 lines
1.4 KiB
Makefile
.PHONY: test test-unit test-e2e test-testscript build run clean fmt lint check-fmt check install
|
|
|
|
# Test flags - run single-threaded to avoid env var races
|
|
TEST_FLAGS := -- --test-threads=1
|
|
|
|
# Build the project
|
|
build:
|
|
cargo build --verbose
|
|
|
|
# Run the project
|
|
run:
|
|
cargo run
|
|
|
|
# Run all tests
|
|
test: test-unit test-e2e
|
|
|
|
# Run unit tests only
|
|
test-unit:
|
|
cargo test --verbose --lib --bins $(TEST_FLAGS)
|
|
|
|
# Run e2e tests only
|
|
test-e2e:
|
|
cargo test --verbose --test '*' $(TEST_FLAGS)
|
|
|
|
# Run testscript tests only
|
|
test-testscript:
|
|
cargo test --verbose --test testscript_test
|
|
|
|
# Install krust to ~/.local/bin
|
|
install:
|
|
@echo "Building krust in release mode..."
|
|
@cargo build --release
|
|
@mkdir -p ~/.local/bin
|
|
@cp target/release/krust ~/.local/bin/krust
|
|
@echo "Installed krust to ~/.local/bin/krust"
|
|
@echo "Make sure ~/.local/bin is in your PATH"
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
cargo clean
|
|
|
|
# Format code
|
|
fmt:
|
|
cargo fmt
|
|
|
|
# Run linter
|
|
lint:
|
|
cargo clippy -- -D warnings
|
|
|
|
# Check formatting
|
|
check-fmt:
|
|
cargo fmt -- --check
|
|
|
|
# Check code (for pre-commit)
|
|
check-code:
|
|
cargo check
|
|
|
|
# Run all checks (format, lint, test)
|
|
check: check-fmt lint test
|
|
|
|
push-ttl:
|
|
@echo "Pushing to ttl.sh..."
|
|
KRUST_REPO=ttl.sh/krust cargo run build ./example/hello-krust
|
|
|
|
run-built-image:
|
|
@image=$$(KRUST_REPO=ttl.sh/krust cargo run build ./example/hello-krust) && \
|
|
echo "Running image: $$image" && \
|
|
docker run --rm $$image
|