fluid-core/Makefile

55 lines
1.3 KiB
Makefile
Raw Normal View History

# FLUID core — build, generation and conformance.
#
# The record types in internal/contract are generated from schemas/. Never edit
# them by hand: run `make generate`.
GO ?= go
PYTHON ?= python3
PKGS := ./...
.PHONY: all
all: generate build vet test validate
.PHONY: generate
generate: ## Regenerate Go types from schemas/
$(GO) run ./tools/schemagen
gofmt -w internal/contract
.PHONY: build
build:
$(GO) build $(PKGS)
.PHONY: vet
vet:
$(GO) vet $(PKGS)
.PHONY: test
test: validate
$(GO) test $(PKGS)
.PHONY: validate
validate: ## Validate spec-derived fixtures against the schemas
$(PYTHON) conformance/validate_schemas.py
.PHONY: check-generated
check-generated: ## Fail if generated code is stale relative to schemas/
@$(MAKE) --no-print-directory generate
@if ! git diff --quiet -- internal/contract; then \
echo "internal/contract is stale — run 'make generate' and commit the result"; \
git --no-pager diff --stat -- internal/contract; \
exit 1; \
fi
.PHONY: conformance
conformance: ## Full conformance suite (grows through FLUID-WP-0007)
$(GO) test ./conformance/... $(PKGS)
.PHONY: clean
clean:
rm -rf bin internal/contract/*.broken
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'