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
|
|
@ -278,6 +278,7 @@ function parse_build_args(start: int) -> pointer {
|
|||
else if a == "--unsafe" { g_unsafe_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 == "--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 == "-o" {
|
||||
ai += 1
|
||||
|
|
@ -286,7 +287,7 @@ function parse_build_args(start: int) -> pointer {
|
|||
}
|
||||
else if a[0] == '-' {
|
||||
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
|
||||
}
|
||||
else { src = a }
|
||||
|
|
@ -311,17 +312,31 @@ function output_path(entry: pointer) -> pointer {
|
|||
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_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" }
|
||||
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 {
|
||||
ensure_ludicc()
|
||||
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
|
||||
}
|
||||
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}`)
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue