The sx 0100 fix (cli.parse / json.parse name collision) is merged on sx master, so `dist.sx` — co-importing std.cli (via dist) and std.json (via json_out) — now lowers and builds. Finish the step: - dist.sx: fix two real frontend errors the old IR-lowering crash had masked — `main` returns `!` (noreturn exit tails), and the post-parse dispatch is guarded by `if !perr` so the failable `p` is used only with its error proven absent. Drop the stale BLOCKED narration. - Makefile: `make build` now also compiles src/dist.sx -> build/dist; `make test` depends on `build` so the acceptance test finds the binary. - tests/cli_dispatch.sx: drives the BUILT build/dist via process.run and asserts the std.cli exit-code + --json purity contract: no-args and unknown-command -> human text on stderr + EX_USAGE (64); `ci publish --json` -> stdout is a single valid JSON object (std.json.parse, no trailing junk) with the human ack on stderr; `--help` lists ci/release. Handlers stay honest stubs (real ci publish is P3.4). Gate green: make build (build/dist), make test (7/7).
35 lines
1.0 KiB
Makefile
35 lines
1.0 KiB
Makefile
# distribution — build/test gate.
|
|
#
|
|
# The sx compiler lives in a separate repo; locate it via SX (overridable):
|
|
# make build SX=/path/to/sx
|
|
SX ?= /Users/agra/projects/sx/zig-out/bin/sx
|
|
|
|
BUILD_DIR := build
|
|
|
|
# Programs compiled by `make build`: the smoke program and the `dist`
|
|
# product entry point. Further entry points under src/ get added here as
|
|
# they land.
|
|
SMOKE := tests/smoke.sx
|
|
DIST := src/dist.sx
|
|
|
|
.PHONY: build test publish-example clean
|
|
|
|
# Compile the product sources (and the smoke program) without running.
|
|
build:
|
|
@mkdir -p $(BUILD_DIR)
|
|
$(SX) build -o $(BUILD_DIR)/smoke $(SMOKE)
|
|
$(SX) build -o $(BUILD_DIR)/dist $(DIST)
|
|
|
|
# Run the test runner over every tests/**/*.sx. Exits non-zero on any
|
|
# failure. Depends on `build` so the CLI acceptance test (tests/cli_*.sx)
|
|
# finds a fresh `build/dist` to drive.
|
|
test: build
|
|
@SX="$(SX)" ./tests/run.sh
|
|
|
|
# Placeholder for the end-to-end publish flow — becomes real in P3.4.
|
|
publish-example:
|
|
@echo "publish-example: not implemented yet (becomes real in P3.4)"
|
|
|
|
clean:
|
|
@rm -rf $(BUILD_DIR)
|