diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..99dd79af --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +# EditorConfig — machine-enforced formatting conventions for the Ludic repo. +# Mirrors ludic-fmt (tools/ludic-tools/fmt.ludic), which re-indents with a +# 2-space unit and normalises to LF/UTF-8. https://editorconfig.org +root = true + +# Ludic is the primary language; 2-space indent, LF, UTF-8, no trailing +# whitespace, and a final newline everywhere by default. +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +# The docgen/asset tooling is Python — PEP 8's 4-space indent. +[*.py] +indent_size = 4 + +# Markdown uses two trailing spaces as a hard line break; keep them. +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index e5eba8b0..e1040ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,15 @@ -build -**.zip -out.ppm +# Generated build tree: LLVM IR, objects, compiled apps and the docs site all +# land under build/ (see `bin/x build` / `bin/x clean`). Root-anchored so a +# source dir named "build" elsewhere is never accidentally ignored. +/build/ + +# Headless render dropped in the working directory by a --headless run. +/out.ppm + +# Archives are never tracked: the Kenney art is committed *extracted* under +# assets/kenney/**/ (PNG/tmx/License), while the original download .zips and any +# packaged plugin .zip are local-only build inputs/outputs. +*.zip # the toolchain binaries (ludicc, ludic, x, ludic-fmt, ludic-lsp) — all built # into bin/ by the one-line bootstrap + `bin/x build`; never checked in. The @@ -15,7 +24,7 @@ tools/editors/jetbrains/build/ # IntelliJ plugin SDK sandbox (tools/editors/jetbrains) .intellijPlatform/ -.idea +.idea/ # macOS Finder metadata .DS_Store diff --git a/tools/x/build.ludic b/tools/x/build.ludic index 384a7ac0..a9d989f4 100644 --- a/tools/x/build.ludic +++ b/tools/x/build.ludic @@ -81,3 +81,15 @@ function cmd_app() -> int { print(`done. run: ./{outbin} (from the repo root, so assets/ resolves)`) return 0 } + +# Remove every generated artifact and leave the tracked source untouched: the +# whole build/ tree (IR, objects, compiled apps), the headless render dropped in +# the root (out.ppm), and any stray *.tmp/*.ll left behind by a failed build. +# The toolchain binaries in bin/ are kept so the running `x` survives; rebuild +# them any time with `x build`. +function cmd_clean() -> int { + run("rm -rf build") + run("rm -f out.ppm bin/*.tmp") + print("cleaned: build/, out.ppm, bin/*.tmp (bin/ toolchain kept — `x build` to rebuild)") + return 0 +} diff --git a/tools/x/main.ludic b/tools/x/main.ludic index 8fa95c22..b2dd86be 100644 --- a/tools/x/main.ludic +++ b/tools/x/main.ludic @@ -27,6 +27,7 @@ program X { print(" x app [--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/, out.ppm and stray artifacts (keeps bin/)") print("") print("test:") print(" x test the full regression suite") @@ -56,6 +57,7 @@ program X { 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") { exit(cmd_test()) } if (cmd == "selfhost-test") { exit(cmd_selfhost_test()) } if (cmd == "test-tools") { exit(cmd_test_tools()) }