ludic build --check reads the maps only for the package's entry - a partial program (a unit test, a molecule, a bake's runner) lacks the game's constants and cannot judge them; --maps reads them anyway, --no-maps never; ludicc unchanged
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
af90a1a334
commit
f864f94207
3 changed files with 30 additions and 6 deletions
|
|
@ -715,7 +715,9 @@ field's type, `@OneOf` and `@Range` hold, an `@Ref` into a game registry is in r
|
||||||
into a `@PerMap` registry names a row of that table in the same map (in any of its chunks; `""` is
|
into a `@PerMap` registry names a row of that table in the same map (in any of its chunks; `""` is
|
||||||
none). A key is written once in a file. Errors carry the map file's line and column, through the
|
none). A key is written once in a file. Errors carry the map file's line and column, through the
|
||||||
diagnostics as any other (`--diagnostics=json`); `--no-maps` leaves the maps alone, and no maps
|
diagnostics as any other (`--diagnostics=json`); `--no-maps` leaves the maps alone, and no maps
|
||||||
root is nothing to check. `LUDIC_PERMAP_SRC=<file>` appends what the compiler wrote for each table.
|
root is nothing to check. `ludic build --check` reads them only for the package's `entry` (the game):
|
||||||
|
a partial program - a unit test, a molecule, a bake's runner - lacks the game's constants and cannot
|
||||||
|
judge them, so they are left alone there unless `--maps` asks. `LUDIC_PERMAP_SRC=<file>` appends what the compiler wrote for each table.
|
||||||
|
|
||||||
### Editor attributes and the schema (`@Ref`, `@Range`, ..., `ludic schema`)
|
### Editor attributes and the schema (`@Ref`, `@Range`, ..., `ludic schema`)
|
||||||
|
|
||||||
|
|
|
||||||
7
changes/maps-entry-only.md
Normal file
7
changes/maps-entry-only.md
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
bump: patch
|
||||||
|
type: fix
|
||||||
|
**`ludic build --check` reads the maps only for the package's entry.** A partial program - a unit test, a
|
||||||
|
molecule, a bake's runner - lacks the game's constants, so checking every map's tables against it refused
|
||||||
|
rows the game reads fine (`TH_*`, `NPCK_*` unknown). The maps are now checked with the `entry` package.ludic
|
||||||
|
names (as `ludic build --check` with no file, and tests/pack.sh, do); `--maps` checks them anyway, `--no-maps`
|
||||||
|
never. `ludicc` itself is unchanged: it reads them unless told `--no-maps`.
|
||||||
|
|
@ -278,6 +278,7 @@ function parse_build_args(start: int) -> pointer {
|
||||||
else if a == "--unsafe" { g_unsafe_build = true }
|
else if a == "--unsafe" { g_unsafe_build = true }
|
||||||
else if a == "--check" { g_check_build = true }
|
else if a == "--check" { g_check_build = true }
|
||||||
else if a == "--no-maps" { g_no_maps_build = true } # --check leaves the map directories alone
|
else if a == "--no-maps" { g_no_maps_build = true } # --check leaves the map directories alone
|
||||||
|
else if a == "--maps" { g_maps_build = true } # ... or reads them, whatever program it checks
|
||||||
else if a == "--diagnostics=json" { g_check_build = true; g_diag_json_build = true } # every error, as JSON on stdout
|
else if a == "--diagnostics=json" { g_check_build = true; g_diag_json_build = true } # every error, as JSON on stdout
|
||||||
else if a == "-o" {
|
else if a == "-o" {
|
||||||
ai += 1
|
ai += 1
|
||||||
|
|
@ -286,7 +287,7 @@ function parse_build_args(start: int) -> pointer {
|
||||||
}
|
}
|
||||||
else if a[0] == '-' {
|
else if a[0] == '-' {
|
||||||
err(`ludic: unknown option {a}\n`)
|
err(`ludic: unknown option {a}\n`)
|
||||||
err(" build/run take: [file] [--headless|--windowed] [-o out] [--save-temps] [--check [--diagnostics=json] [--no-maps]]\n")
|
err(" build/run take: [file] [--headless|--windowed] [-o out] [--save-temps] [--check [--diagnostics=json] [--maps|--no-maps]]\n")
|
||||||
g_argerr = true
|
g_argerr = true
|
||||||
}
|
}
|
||||||
else { src = a }
|
else { src = a }
|
||||||
|
|
@ -311,17 +312,31 @@ function output_path(entry: pointer) -> pointer {
|
||||||
var g_check_build: bool = false
|
var g_check_build: bool = false
|
||||||
var g_diag_json_build: bool = false # --diagnostics=json: the compiler's JSON array is the whole stdout
|
var g_diag_json_build: bool = false # --diagnostics=json: the compiler's JSON array is the whole stdout
|
||||||
var g_no_maps_build: bool = false
|
var g_no_maps_build: bool = false
|
||||||
function no_maps_flag() -> pointer {
|
var g_maps_build: bool = false
|
||||||
|
# the maps are checked with the package's entry - the game - and left alone for any other program: a
|
||||||
|
# partial program (a unit test, a bake's runner) lacks the game's constants and cannot judge them
|
||||||
|
function no_maps_flag(src: pointer) -> pointer {
|
||||||
if g_no_maps_build { return " --no-maps" }
|
if g_no_maps_build { return " --no-maps" }
|
||||||
return ""
|
if g_maps_build { return "" }
|
||||||
|
if not file_exists("package.ludic") { return "" }
|
||||||
|
let m = read_root_manifest()
|
||||||
|
if m.entry == "" or bld_same_path(m.entry, src) { return "" }
|
||||||
|
return " --no-maps"
|
||||||
|
}
|
||||||
|
function bld_same_path(a: pointer, b: pointer) -> bool {
|
||||||
|
var x = a
|
||||||
|
var y = b
|
||||||
|
if len(x) > 2 and x[0] == '.' and x[1] == '/' { x = x[2..len(x)] }
|
||||||
|
if len(y) > 2 and y[0] == '.' and y[1] == '/' { y = y[2..len(y)] }
|
||||||
|
return x == y
|
||||||
}
|
}
|
||||||
function check_app(src: pointer) -> int {
|
function check_app(src: pointer) -> int {
|
||||||
ensure_ludicc()
|
ensure_ludicc()
|
||||||
if g_diag_json_build {
|
if g_diag_json_build {
|
||||||
if not shq(`{ludicc()} --check --diagnostics=json{no_maps_flag()}{title_flag()}{unsafe_flag()} {src}`) { return 1 }
|
if not shq(`{ludicc()} --check --diagnostics=json{no_maps_flag(src)}{title_flag()}{unsafe_flag()} {src}`) { return 1 }
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if not shq(`{ludicc()} --check{no_maps_flag()}{title_flag()}{unsafe_flag()} {src}`) { return 1 }
|
if not shq(`{ludicc()} --check{no_maps_flag(src)}{title_flag()}{unsafe_flag()} {src}`) { return 1 }
|
||||||
print(`checked {src}`)
|
print(`checked {src}`)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue