|
| 1 | +# Makefile for Acropolis workspace |
| 2 | + |
| 3 | +.DEFAULT_GOAL := build |
| 4 | + |
| 5 | +SHELL := bash |
| 6 | +CARGO := cargo |
| 7 | +PYTHON := python3 |
| 8 | +PROCESS_PKG := acropolis_process_omnibus |
| 9 | + |
| 10 | +# Test snapshots |
| 11 | +SNAPSHOT_SMALL ?= tests/fixtures/snapshot-small.cbor |
| 12 | +MANIFEST_SMALL ?= tests/fixtures/test-manifest.json |
| 13 | + |
| 14 | +# Real Cardano Haskell node snapshot (Conway era, epoch 507) |
| 15 | +SNAPSHOT ?= tests/fixtures/134092758.670ca68c3de580f8469677754a725e86ca72a7be381d3108569f0704a5fca327.cbor |
| 16 | +MANIFEST ?= tests/fixtures/134092758.670ca68c3de580f8469677754a725e86ca72a7be381d3108569f0704a5fca327.json |
| 17 | + |
| 18 | +SECTIONS_ALL := --params --governance --pools --accounts --utxo |
| 19 | + |
| 20 | +.PHONY: help all build test run fmt clippy |
| 21 | +.PHONY: snapshot-summary snapshot-sections-all snapshot-bootstrap |
| 22 | +.PHONY: snap-test-streaming |
| 23 | + |
| 24 | +help: |
| 25 | + @echo "Acropolis Makefile Targets:" |
| 26 | + @echo "" |
| 27 | + @echo "Build & Test:" |
| 28 | + @echo " all Format, lint, and test" |
| 29 | + @echo " build Build the omnibus process" |
| 30 | + @echo " test Run all tests" |
| 31 | + @echo " fmt Run cargo fmt" |
| 32 | + @echo " clippy Run cargo clippy -D warnings" |
| 33 | + @echo "" |
| 34 | + @echo "Snapshot Commands:" |
| 35 | + @echo " snap-test-streaming Test streaming parser with large snapshot (2.4GB)" |
| 36 | + @echo "" |
| 37 | + @echo "Variables:" |
| 38 | + @echo " SNAPSHOT=<path> Path to snapshot file (default: Conway epoch 507)" |
| 39 | + @echo "" |
| 40 | + @echo "Examples:" |
| 41 | + @echo " make snap-test-streaming" |
| 42 | + @echo " make snap-test-streaming SNAPSHOT=path/to/snapshot.cbor" |
| 43 | + |
| 44 | +all: fmt clippy test |
| 45 | + |
| 46 | +build: |
| 47 | + $(CARGO) build -p $(PROCESS_PKG) |
| 48 | + |
| 49 | +test: |
| 50 | + $(CARGO) test |
| 51 | + |
| 52 | +run: |
| 53 | + $(CARGO) run -p $(PROCESS_PKG) |
| 54 | + |
| 55 | +fmt: |
| 56 | + $(CARGO) fmt --all |
| 57 | + |
| 58 | +clippy: |
| 59 | + $(CARGO) clippy --workspace -- -D warnings |
| 60 | + |
| 61 | +# Streaming snapshot parser test |
| 62 | +snap-test-streaming: |
| 63 | + @echo "Testing Streaming Snapshot Parser" |
| 64 | + @echo "==================================" |
| 65 | + @echo "Snapshot: $(SNAPSHOT)" |
| 66 | + @echo "Size: $$(du -h $(SNAPSHOT) | cut -f1)" |
| 67 | + @echo "" |
| 68 | + @test -f "$(SNAPSHOT)" || (echo "Error: Snapshot file not found: $(SNAPSHOT)"; exit 1) |
| 69 | + @echo "This will parse the entire snapshot and collect all data with callbacks..." |
| 70 | + @echo "Expected time: ~1-3 minutes for 2.4GB snapshot with 11M UTXOs" |
| 71 | + @echo "" |
| 72 | + @$(CARGO) run --release --example test_streaming_parser -- "$(SNAPSHOT)" |
| 73 | + |
| 74 | +# Pattern rule: generate .json manifest from .cbor snapshot |
| 75 | +# Usage: make tests/fixtures/my-snapshot.json |
| 76 | +# Extracts header metadata from CBOR and computes SHA256 + file size |
| 77 | +%.json: %.cbor |
| 78 | + @echo "Generating manifest for $< -> $@" |
| 79 | + @echo "Note: Manifest generation script not yet ported" |
| 80 | + @echo "TODO: Port scripts/generate_manifest.py from original project" |
| 81 | + @ERA_FLAG=$${ERA:+--era $$ERA}; \ |
| 82 | + BH_FLAG=$${BLOCK_HASH:+--block-hash $$BLOCK_HASH}; \ |
| 83 | + BHGT_FLAG=$${BLOCK_HEIGHT:+--block-height $$BLOCK_HEIGHT}; \ |
| 84 | + if [ -f scripts/generate_manifest.py ]; then \ |
| 85 | + $(PYTHON) scripts/generate_manifest.py $$ERA_FLAG $$BH_FLAG $$BHGT_FLAG $< > $@; \ |
| 86 | + else \ |
| 87 | + echo "Error: scripts/generate_manifest.py not found"; \ |
| 88 | + exit 1; \ |
| 89 | + fi |
0 commit comments