financial_types 0.1.0

Core financial type definitions for trading systems: asset types, trading actions, position sides, and option styles.
Documentation
# =============================================================================
# Makefile for financial_types
# Core financial type definitions for trading systems
# =============================================================================

# Detect current branch
CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)

# Project name for packaging
PROJECT_NAME := financial_types

# =============================================================================
# Default target
# =============================================================================
.PHONY: all
all: fmt lint test build

# =============================================================================
# ๐Ÿ”ง Build & Run
# =============================================================================

.PHONY: build
build:
	@echo "๐Ÿ”จ Building debug version..."
	cargo build

.PHONY: release
release:
	@echo "๐Ÿš€ Building release version..."
	cargo build --release

.PHONY: clean
clean:
	@echo "๐Ÿงน Cleaning build artifacts..."
	cargo clean

# =============================================================================
# ๐Ÿงช Test & Quality
# =============================================================================

.PHONY: test
test:
	@echo "๐Ÿงช Running all tests..."
	RUST_LOG=warn cargo test --all-features

.PHONY: test-lib
test-lib:
	@echo "๐Ÿงช Running library tests..."
	RUST_LOG=warn cargo test --lib

.PHONY: test-doc
test-doc:
	@echo "๐Ÿงช Running documentation tests..."
	cargo test --doc

.PHONY: fmt
fmt:
	@echo "โœจ Formatting code..."
	cargo +stable fmt --all

.PHONY: fmt-check
fmt-check:
	@echo "๐Ÿ” Checking code formatting..."
	cargo +stable fmt --all --check

.PHONY: lint
lint:
	@echo "๐Ÿ” Running clippy lints..."
	cargo clippy --all-targets --all-features -- -D warnings

.PHONY: lint-fix
lint-fix:
	@echo "๐Ÿ”ง Auto-fixing lint issues..."
	cargo clippy --fix --all-targets --all-features --allow-dirty --allow-staged -- -D warnings

.PHONY: fix
fix:
	@echo "๐Ÿ”ง Applying cargo fix suggestions..."
	cargo fix --allow-staged --allow-dirty

.PHONY: check
check: fmt-check lint test
	@echo "โœ… All checks passed!"

.PHONY: pre-push
pre-push: fix fmt lint-fix test doc
	@echo "โœ… All pre-push checks passed!"

# =============================================================================
# ๐Ÿ“ฆ Packaging & Docs
# =============================================================================

.PHONY: doc
doc:
	@echo "๐Ÿ“š Generating documentation..."
	cargo doc --no-deps --document-private-items

.PHONY: doc-open
doc-open:
	@echo "๐Ÿ“š Opening documentation in browser..."
	cargo doc --no-deps --open

.PHONY: publish
publish:
	@echo "๐Ÿ“ฆ Publishing to crates.io..."
	cargo publish --dry-run
	@echo "Dry run complete. Run 'cargo publish' to actually publish."

# =============================================================================
# ๐Ÿ“ˆ Coverage
# =============================================================================

.PHONY: coverage
coverage:
	@echo "๐Ÿ“Š Generating code coverage report (XML)..."
	@command -v cargo-tarpaulin > /dev/null || cargo install cargo-tarpaulin
	@mkdir -p coverage
	RUST_LOG=warn cargo tarpaulin --verbose --all-features --timeout 120 --out Xml --output-dir coverage

# =============================================================================
# ๐Ÿš€ Release
# =============================================================================

.PHONY: version
version:
	@echo "๐Ÿ“‹ Current version:"
	@grep '^version' Cargo.toml | head -1

.PHONY: tag
tag:
	@echo "๐Ÿท๏ธ  Creating git tag..."
	@version=$$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/'); \
	git tag -a "v$$version" -m "Release v$$version"; \
	echo "Created tag v$$version"

# =============================================================================
# โ“ Help
# =============================================================================

.PHONY: help
help:
	@echo ""
	@echo "โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—"
	@echo "โ•‘              financial_types - Development Commands                  โ•‘"
	@echo "โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•"
	@echo ""
	@echo "๐Ÿ”ง Build:"
	@echo "  make build           Compile the project (debug)"
	@echo "  make release         Build in release mode"
	@echo "  make clean           Clean build artifacts"
	@echo ""
	@echo "๐Ÿงช Test & Quality:"
	@echo "  make test            Run all tests"
	@echo "  make fmt             Format code"
	@echo "  make lint            Run clippy"
	@echo "  make lint-fix        Auto-fix lint issues"
	@echo "  make pre-push        Run all pre-push checks"
	@echo ""
	@echo "๐Ÿ“ฆ Packaging & Docs:"
	@echo "  make doc             Generate documentation"
	@echo "  make publish         Dry-run publish to crates.io"
	@echo ""