The package-manager half of prebuilt binary packages, on top of the compiler
foundation (dynamic system registration + --emit-module).
- x build-lib [module.ludic]: compile a package's module to a per-target native
dylib under lib/<target>/, with an @rpath install name so a consumer resolves
it from the content-addressed store.
- x link-flags: print the clang flags (the dylib, an rpath to its store dir,
-export_dynamic) so any build system links a project's prebuilt module dylibs;
x app splices them automatically for in-repo builds.
- kind prebuilt is resolved + linked like any dependency; a missing build target
stays a hard error.
Proven hermetically (macOS-gated, since dylibs are native): a module exporting a
component + an @System(Update) + a function is built with x build-lib, fetched
as a prebuilt dep, and linked into a consumer game that never saw its source —
the module's system mutates the shared world and its function is callable
("3 42"). Package suite 17/0; full suite 87/0.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
137 lines
7.3 KiB
Text
137 lines
7.3 KiB
Text
# x — the Ludic task runner. One native binary (bin/x) that replaces every
|
|
# build/test/bootstrap shell script in the repo. It is written in Ludic and
|
|
# compiled by Ludic; the unix tools and clang it drives are invoked through the
|
|
# `run` intrinsic, the same way the old *.sh files shelled out.
|
|
#
|
|
# Bootstrap it once from a clean checkout (the only step Ludic cannot do for
|
|
# itself, since compiling Ludic needs a compiler):
|
|
#
|
|
# clang selfhost/ludicc.seed.ll -o bin/ludicc && bin/ludicc tools/x/main.ludic -o bin/x
|
|
#
|
|
# Thereafter `bin/x build` rebuilds the whole toolchain — including bin/x itself.
|
|
# Always run x from the repository root.
|
|
program X {
|
|
import "prelude.ludic"
|
|
import "selfhost.ludic"
|
|
import "build.ludic"
|
|
import "tools.ludic"
|
|
import "selfhost_test.ludic"
|
|
import "test.ludic"
|
|
import "json.ludic"
|
|
import "checks.ludic"
|
|
import "docgen.ludic"
|
|
import "docgen_gen.ludic"
|
|
import "docgen_check.ludic"
|
|
import "release.ludic"
|
|
import "pkg.ludic"
|
|
import "pkg_test.ludic"
|
|
|
|
function usage() -> void {
|
|
print("x — the Ludic task runner (run from the repository root)")
|
|
print("")
|
|
print("build & run:")
|
|
print(" x build build the whole toolchain into bin/ (ludicc, ludic, x, ludic-fmt, ludic-lsp)")
|
|
print(" x build-cli build just bin/ludicc and bin/ludic from the IR seed")
|
|
print(" x app <file.ludic> [--headless] [--save-temps]")
|
|
print(" compile a Ludic program to a native app in build/")
|
|
print(" x tools [--install] [--test] build the editor toolchain (ludic-fmt, ludic-lsp)")
|
|
print(" x clean remove build/ (incl. build/out.ppm) and stray artifacts (keeps bin/)")
|
|
print("")
|
|
print("packages (issue #63 — MVS resolution, content-addressed store, ludic_modules/ links):")
|
|
print(" x add <module>[@version] add a dependency to package.ludic, then resolve + fetch + link")
|
|
print(" x get resolve every package.ludic dependency, link them, write the lock")
|
|
print(" x update [module] bump a dep (or all) to its latest published version, then relock")
|
|
print(" x verify check every locked package against the store by content hash")
|
|
print(" x vendor copy the resolved packages into ./vendor for offline builds")
|
|
print(" x build-lib <module.ludic> (#64) compile a package's module to a prebuilt dylib in lib/<target>/")
|
|
print(" x link-flags (#64) print the clang flags to link this project's prebuilt module dylibs")
|
|
print("")
|
|
print("test:")
|
|
print(" x test the full regression suite")
|
|
print(" x test-pkg the package-manager suite (hermetic git repos, offline)")
|
|
print(" x test --coverage per-file line coverage over the test specs")
|
|
print(" x selfhost-test the self-hosting suite (correctness + bootstrap fixpoints)")
|
|
print(" x test-tools the editor-toolchain suite")
|
|
print(" x golden regenerate selfhost/golden/renders.sha256 (review with git diff)")
|
|
print("")
|
|
print("doc / lint checks (Ludic, no Python):")
|
|
print(" x check-docs every ```ludic doc fence parses (or is marked skip/expect-error)")
|
|
print(" x check-impl every implemented feature has a docs/language page")
|
|
print(" x check-vocabulary the vocabulary is in sync across grammar / lexer / header / parser")
|
|
print(" x lint-asset <file> validate one editor .json / .xml asset")
|
|
print(" x docs-gen [--out DIR] generate the documentation site (default build/pages)")
|
|
print(" x docs-check [DIR] coverage/integrity guard over a generated docs site")
|
|
print(" x docs-palette regenerate emit_color.ludic + palette.json from the palette table")
|
|
print("")
|
|
print("release:")
|
|
print(" x version print the toolchain version (ludicc --version)")
|
|
print(" x release [major|minor|patch] [--publish]")
|
|
print(" cut a release: CHANGELOG + VERSION bump + tag (+ Forgejo release)")
|
|
print("")
|
|
print("self-host internals:")
|
|
print(" x selfhost-build [ludicc] [out] assemble + compile the self-host compiler")
|
|
print(" x bootstrap the self-hosting fixpoint proof (seeded from bin/ludicc)")
|
|
print(" x bootstrap-cfree rebuild the compiler from the seed with no C compiler")
|
|
print(" x reseed regenerate selfhost/ludicc.seed.ll after a compiler change")
|
|
print(" x game-build <ludicc> <game.ludic> <out> compile a Ludic game (headless)")
|
|
print(" x sh-compile <ludicc> <in.ludic> <out> compile + link one .ludic file")
|
|
}
|
|
|
|
# a positional argument, or a default when absent
|
|
function argn(i: int, dflt: pointer) -> pointer {
|
|
if (i < arg_count()) { return arg(i) }
|
|
return dflt
|
|
}
|
|
|
|
entry {
|
|
if (arg_count() < 2) { usage(); exit(1) }
|
|
let cmd = arg(1)
|
|
|
|
if (cmd == "build") { exit(cmd_build()) }
|
|
if (cmd == "build-cli") { exit(cmd_build_cli()) }
|
|
if (cmd == "app") { exit(cmd_app()) }
|
|
if (cmd == "tools") { exit(cmd_tools()) }
|
|
if (cmd == "clean") { exit(cmd_clean()) }
|
|
if (cmd == "test") {
|
|
if (argn(2, "") == "--coverage") { exit(cmd_test_coverage()) }
|
|
exit(cmd_test())
|
|
}
|
|
if (cmd == "selfhost-test") { exit(cmd_selfhost_test()) }
|
|
if (cmd == "test-tools") { exit(cmd_test_tools()) }
|
|
if (cmd == "check-docs") { exit(cmd_check_docs()) }
|
|
if (cmd == "check-impl") { exit(cmd_check_impl()) }
|
|
if (cmd == "check-vocabulary") { exit(cmd_check_vocab()) }
|
|
if (cmd == "lint-asset") { exit(cmd_lint_asset()) }
|
|
if (cmd == "docs-palette") { exit(cmd_docs_palette()) }
|
|
if (cmd == "docs-gen") { exit(cmd_docs_gen()) }
|
|
if (cmd == "docs-check") { exit(cmd_docs_check()) }
|
|
if (cmd == "golden") { exit(cmd_golden()) }
|
|
if (cmd == "bootstrap") { exit(cmd_bootstrap()) }
|
|
if (cmd == "bootstrap-cfree") { exit(cmd_bootstrap_cfree()) }
|
|
if (cmd == "reseed") { exit(cmd_reseed()) }
|
|
if (cmd == "selfhost-build") { exit(cmd_selfhost_build(argn(2, "bin/ludicc"), argn(3, "build/selfhost"))) }
|
|
if (cmd == "sh-compile") {
|
|
if (arg_count() < 5) { err("usage: x sh-compile <ludicc> <in.ludic> <out>\n"); exit(1) }
|
|
exit(cmd_sh_compile(arg(2), arg(3), arg(4)))
|
|
}
|
|
if (cmd == "game-build") {
|
|
if (arg_count() < 5) { err("usage: x game-build <ludicc> <game.ludic> <out>\n"); exit(1) }
|
|
exit(cmd_game_build(arg(2), arg(3), arg(4)))
|
|
}
|
|
if (cmd == "add") { exit(cmd_pkg_add()) }
|
|
if (cmd == "get") { exit(cmd_pkg_get()) }
|
|
if (cmd == "update") { exit(cmd_pkg_update()) }
|
|
if (cmd == "verify") { exit(cmd_pkg_verify()) }
|
|
if (cmd == "vendor") { exit(cmd_pkg_vendor()) }
|
|
if (cmd == "build-lib") { exit(cmd_pkg_build_lib()) }
|
|
if (cmd == "link-flags") { exit(cmd_pkg_link_flags()) }
|
|
if (cmd == "test-pkg") { exit(cmd_test_pkg()) }
|
|
if (cmd == "version") or (cmd == "--version") or (cmd == "-v") { exit(cmd_version()) }
|
|
if (cmd == "release") { exit(cmd_release()) }
|
|
if (cmd == "help") or (cmd == "--help") or (cmd == "-h") { usage(); exit(0) }
|
|
|
|
err(`x: unknown command '{cmd}'\n`)
|
|
usage()
|
|
exit(1)
|
|
}
|
|
}
|