# Build the project in debug mode
build-debug:
@echo "Building project in debug mode..."
@cargo build
@echo "Debug build complete."
# Build the project in release mode
build-release:
@echo "Building project in release mode..."
@cargo build --release
@echo "Release build complete."
# Install required cargo tools
install-tools:
@echo "Installing required cargo and Rust tools..."
@cargo install tokei
@cargo install cargo-edit
@cargo install cargo-llvm-cov
@rustup component add clippy
@echo "Cargo and Rust tools installed."
# Install pre-commit hooks using 'prek'
install-pre-commit-hooks:
@echo "Installing pre-commit hooks using prek..."
@prek install
@echo "Pre-commit hooks installed."
# Update pre-commit hooks using 'prek'
pre-commit-update:
@echo "Updating pre-commit hooks using prek..."
@prek auto-update
@echo "Pre-commit hooks updated."
# Upgrade project dependencies using 'cargo'
upgrade-dependencies:
@echo "Upgrading project dependencies..."
@cargo update --verbose
@echo "Dependencies upgraded."
# Bump the patch version of the project using 'cargo'
bump-patch:
@echo "Current project version: $(cargo pkgid | cut -d# -f2)"
@cargo set-version --bump patch
@echo "Updated project to: $(cargo pkgid | cut -d# -f2)"
# Format the code
format:
@echo "Formatting code..."
@cargo fmt
@echo "Code formatted."
# Run the type checker and linter
type-check-and-lint:
@echo "Running type checker and linter..."
@cargo check
@cargo clippy -- -D warnings
@echo "Type checking and linting complete."
# Fix with clippy
type-check-and-lint-fix:
@echo "Running clippy with automatic fixes..."
@cargo clippy --fix --allow-dirty --allow-staged
@echo "Clippy fixes applied."
# Generate crate documentation
generate-docs-and-show-in-browser:
@echo "Cleaning old documentation..."
@rm -rf target/doc
@echo "Generating crate documentation..."
@cargo doc --no-deps --open
@echo "Documentation generated and opened in browser."
export RUN_INTEGRATION_TESTS := "1"
# Run comprehensive tests, including downloading models
test-comprehensive $RUN_INTEGRATION_TESTS="1":
@echo "Running all tests, including downloading models, with --test-threads=1 to avoid shared-state conflicts in integration downloads..."
@cargo test -- --include-ignored --test-threads=1
@echo "All tests complete."
# Generate comprehensive test coverage report (including integration tests) and show in browser
coverage-comprehensive-and-show-in-browser $RUN_INTEGRATION_TESTS="1":
@echo "Generating comprehensive test coverage report (including integration tests) with --test-threads=1 for stable integration coverage, and opening it in browser..."
@cargo llvm-cov --all-targets --html --open -- --include-ignored --test-threads=1
@echo "Comprehensive coverage report generated and opened in browser."
# Run tests
test $RUN_INTEGRATION_TESTS="0":
@echo "Running tests..."
@cargo test
@echo "Tests complete."
# Generate test coverage report and show in browser
coverage-and-show-in-browser $RUN_INTEGRATION_TESTS="0":
@echo "Generating test coverage report and opening it in browser..."
@cargo llvm-cov --all-targets --html --open
@echo "Coverage report generated and opened in browser."
# Count lines of code and documentation
count-lines:
@echo "Counting lines of code and documentation..."
@tokei --hidden --exclude target
@echo "Line count complete."
# Run the Open Source Vulnerability scanner
vulnerability-scan:
@echo "Running Open Source Vulnerability scanner..."
@osv-scanner scan source -r .
@echo "Vulnerability scan complete."