#!/usr/bin/env bash # generate-dsl-registry.sh # # Regenerates the interpreted graph-DSL's builtin registry from the generator # sources. The output is committed, so run this after adding or changing a # generator's init signature and commit the diff. # # bash scripts/generate-dsl-registry.sh # regenerate + verify it compiles # bash scripts/generate-dsl-registry.sh --report # classification summary only # bash scripts/generate-dsl-registry.sh --check # fail if committed output is stale (CI) # # The generator lives in its own SwiftPM package (Tools/DSLRegistryGen) so its # swift-syntax dependency never enters the main package's build graph. # # Constants are declared module-wide (Math/, per-family constant files), not # just under Generators/, so the constant scan covers the whole module. set -euo pipefail cd "$(dirname "$0")/.." GENERATORS="Sources/Lyrebird/Generators" CONSTANTS="Sources/Lyrebird" OUTPUT="Sources/LyrebirdGraphDSL/Generated/GeneratedDSLRegistry.swift" run() { swift run --package-path Tools/DSLRegistryGen DSLRegistryGen \ --generators "$GENERATORS" --constants "$CONSTANTS" "$@" } case "${1:-}" in --report) run --report ;; --check) run --output "$OUTPUT" --check ;; *) mkdir -p "$(dirname "$OUTPUT")" run --output "$OUTPUT" # Verify the emitted registry actually compiles before trusting it. echo "verifying generated registry compiles…" swift build --target LyrebirdGraphDSL ;; esac