196 lines
8.9 KiB
Plaintext
Raw Permalink Normal View History

2025-12-22 21:34:01 +00:00
# Build recipes for SecretumVault with feature control
[doc("Show build help")]
help:
@echo "BUILD COMMANDS - FEATURE CONTROL SYSTEM"; \
echo ""; \
echo "PREDEFINED FEATURE SETS (Recommended):"; \
echo " just build::dev Dev (all features)"; \
echo " just build::secure Secure (PQC + etcd)"; \
echo " just build::prod Prod (OpenSSL + PostgreSQL)"; \
echo " just build::ha HA (etcd distributed)"; \
echo " just build::minimal Minimal (core only)"; \
echo ""; \
echo "BASIC BUILDS:"; \
echo " just build::debug Debug build"; \
echo " just build::release Release (default features)"; \
echo " just build::all All features release"; \
echo ""; \
echo "CUSTOM FEATURES:"; \
echo " just build::with-features FEATS Build with custom features"; \
echo " just build::features FEATS Alias for with-features"; \
echo ""; \
echo "SPECIALIZED:"; \
echo " just build::pqc Post-quantum (aws-lc,pqc)"; \
echo " just build::all-storage All storage backends"; \
echo " just build::target TARGET Cross-compile"; \
echo ""; \
echo "EXAMPLES:"; \
echo " just build::with-features aws-lc,pqc,postgresql-storage"; \
echo " just build::with-features etcd-storage"; \
echo " just build::target aarch64-unknown-linux-gnu"; \
echo ""
# ═══════════════════════════════════════════════════════════════════════
# PREDEFINED FEATURE COMBINATIONS
# ═══════════════════════════════════════════════════════════════════════
# Development: all features
[doc("Build with ALL features (development)")]
dev:
@echo "🔨 Building with ALL features (development)..."
cargo build --release --features aws-lc,pqc,etcd-storage,surrealdb-storage,postgresql-storage
@echo "✅ Development build complete"
# Production Secure: PQC + etcd
[doc("Build SECURE production (PQC + etcd)")]
secure:
@echo "🔨 Building SECURE production (PQC + etcd)..."
cargo build --release --features aws-lc,pqc,etcd-storage
@echo "✅ Secure build complete (post-quantum ready)"
# Production Standard: OpenSSL + PostgreSQL
[doc("Build STANDARD production (OpenSSL + PostgreSQL)")]
prod:
@echo "🔨 Building STANDARD production (OpenSSL + PostgreSQL)..."
cargo build --release --features postgresql-storage
@echo "✅ Production build complete"
# Production HA: etcd distributed
[doc("Build HIGH-AVAILABILITY (etcd distributed)")]
ha:
@echo "🔨 Building HIGH-AVAILABILITY (etcd)..."
cargo build --release --features etcd-storage
@echo "✅ HA build complete"
# Minimal: core only (filesystem)
[doc("Build MINIMAL (core only, filesystem storage)")]
minimal:
@echo "🔨 Building MINIMAL (core only)..."
cargo build --release --no-default-features
@echo "✅ Minimal build complete"
# ═══════════════════════════════════════════════════════════════════════
# CUSTOM FEATURE CONTROL
# ═══════════════════════════════════════════════════════════════════════
# Build with specific features
[doc("Build with specific features (comma-separated)")]
with-features FEATURES:
@echo "🔨 Building with features: {{ FEATURES }}"
cargo build --release --features {{ FEATURES }}
@echo "✅ Build complete"
# Alias for with-features
[doc("Alias for with-features")]
features FEATURES:
@just with-features {{ FEATURES }}
# ═══════════════════════════════════════════════════════════════════════
# BASIC BUILDS
# ═══════════════════════════════════════════════════════════════════════
# Debug build
[doc("Build debug binary")]
debug:
@echo "🔨 Building debug..."
cargo build
@echo "✅ Debug build complete"
# Release build (default features)
[doc("Build optimized release (default features)")]
release:
@echo "🔨 Building release..."
cargo build --release
@echo "✅ Release build complete"
# Default build (alias for release)
[doc("Build release (default, alias)")]
default:
@just release
# Release with all features
[doc("Build release with ALL features")]
all:
@echo "🔨 Building with all features..."
cargo build --release --all-features
@echo "✅ All-features build complete"
# ═══════════════════════════════════════════════════════════════════════
# SPECIALIZED BUILDS
# ═══════════════════════════════════════════════════════════════════════
# Build with post-quantum crypto
[doc("Build with post-quantum cryptography (aws-lc + pqc)")]
pqc:
@echo "🔨 Building with post-quantum crypto..."
cargo build --release --features aws-lc,pqc
@echo "✅ PQC build complete (ML-KEM, ML-DSA)"
# Build with all storage backends
[doc("Build with ALL storage backends")]
all-storage:
@echo "🔨 Building with all storage backends..."
cargo build --release --features etcd-storage,surrealdb-storage,postgresql-storage
@echo "✅ All-storage build complete"
# ═══════════════════════════════════════════════════════════════════════
# CROSS-COMPILATION & UTILITIES
# ═══════════════════════════════════════════════════════════════════════
# Build for specific target (cross-compile)
[doc("Cross-compile to target (e.g., aarch64-unknown-linux-gnu)")]
target TARGET:
@echo "🔨 Cross-compiling to {{ TARGET }}..."
cargo build --release --target {{ TARGET }}
@echo "✅ Build for {{ TARGET }} complete"
# Check compilation without building
[doc("Check without building (validate syntax)")]
check:
@echo "🔍 Checking all features..."
cargo check --all-features
@echo "✅ All checks passed"
# Size analysis
[doc("Analyze binary size")]
size:
@echo "📊 Analyzing binary size..."
cargo build --release
@ls -lh target/release/svault
@command -v cargo-bloat > /dev/null && cargo bloat --release || echo "cargo-bloat not installed"
# ═══════════════════════════════════════════════════════════════════════
# DOCKER BUILDS
# ═══════════════════════════════════════════════════════════════════════
# Docker image build
[doc("Build Docker image")]
docker:
@echo "🐳 Building Docker image..."
docker build -t secretumvault:latest .
@docker images | grep secretumvault | head -1
# Docker multi-architecture build
[doc("Build Docker for multiple architectures (requires buildx)")]
docker-multi:
@echo "🐳 Building multi-architecture Docker image..."
docker buildx build --push -t secretumvault:latest --platform linux/amd64,linux/arm64 .
@echo "✅ Multi-arch build pushed"
# ═══════════════════════════════════════════════════════════════════════
# TESTING BUILDS WITH FEATURES
# ═══════════════════════════════════════════════════════════════════════
# Test build without actually building
[doc("Test build configuration without compiling")]
test-config FEATURES:
@echo "🔍 Testing build configuration with: {{ FEATURES }}"
cargo check --features {{ FEATURES }}
@echo "✅ Configuration valid"
# Show what would be built
[doc("Show cargo build plan (what will be compiled)")]
plan:
cargo build --release --dry-run 2>&1 | head -20