# Kirino Build System
#
# Usage:
# just <recipe> - Run specified recipe
# just --list - List all available recipes
#
# Main tasks:
# just check - Check compilation
# just clippy - Run Clippy lints
# just fmt - Format code
# just fmt-check - Check formatting
# just enforce-groups - Enforce use statement group layout
# just test - Run unit tests
# just ci - Run all CI checks
set shell := ["bash", "-c"]
# Windows: PowerShell (the 5.1 floor ships with every Windows; pwsh 7 is
# NOT assumed). Linewise recipes must stay PS-5.1-safe: no `&&` chains,
# `cd X; cmd` instead of `cd X && cmd`. Bash-only recipes use
# [script('bash')] and need Git Bash (or WSL) when actually run.
set windows-shell := ["powershell.exe", "-NoLogo", "-NoProfile", "-Command", "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8; $PSDefaultParameterValues['*:Encoding']='utf8';"]
set unstable
set lists
# Repo definitions override the shared template's (imported above).
set allow-duplicate-recipes
set allow-duplicate-variables
# Shared celestia-devtools recipes — NOT in git. Stage with: just fetch.
# `import?` silently skips when absent, so this justfile parses pre-fetch.
import? "./.just/git-bash-interop.just"
import? "./.just/celestia-devtools.just"
# Stage shared celestia-devtools recipes into .just/ (gitignored).
# Source order: explicit URL arg → local pip bundle (offline) → GitHub raw.
# curl honors HTTP_PROXY/HTTPS_PROXY/ALL_PROXY env vars automatically.
fetch URL='':
{{ if os_family() == "windows" { "python" } else { "python3" } }} -c "import os; os.makedirs('.just', exist_ok=True)"
{{ if URL != "" { "curl -fsSL " + URL + " -o .just/celestia-devtools.just" } else if which("celestia-devtools") != "" { "celestia-devtools fetch-just" } else { "curl -fsSL https://raw.githubusercontent.com/celestia-island/celestia-devtools/dev/src/celestia_devtools/common.just -o .just/celestia-devtools.just" } }}
python := if os_family() == "windows" { "python" } else { "python3" }
default:
@just --list
# ============================================================================
# Build tasks
# ============================================================================
# Build all crates. Release by default; `--dev` for debug, `--clean` to clean first.
build *FLAGS='':
just _build ":" "cargo build --all" "cargo build --release --all" {{FLAGS}}
# ============================================================================
# Code quality checks
# ============================================================================
# Check compilation
check:
@echo "Checking compilation..."
cargo check --all-targets --all-features
# Run Clippy linter
clippy:
@echo "Running Clippy..."
cargo clippy --all-targets --all-features -- -D warnings
# Format all code
fmt:
just fmt-toml
cargo fmt --all
python3 scripts/enforce_use_groups.py
# Check formatting without modifying files
fmt-check:
@echo "Checking code formatting..."
cargo fmt --all -- --check
# Enforce use statement group layout (imports grouping)
enforce-groups:
@echo "Enforcing use statement group layout..."
{{python}} scripts/enforce_use_groups.py
# ============================================================================
# Test tasks
# ============================================================================
# Run unit tests
test:
@echo "Running unit tests..."
cargo test --lib --all-features
# ============================================================================
# CI
# ============================================================================
# Run all CI checks (check + clippy + fmt-check + enforce-groups + test)
ci: check clippy fmt-check enforce-groups test
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@echo "All CI checks passed!"
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# ============================================================================
# Cleanup
# ============================================================================
# Clean all build artifacts
clean:
cargo clean