From 6e1248e3b860c06a036cd8b60642f9b506c19862 Mon Sep 17 00:00:00 2001 From: jyelon Date: Wed, 11 Feb 2026 13:21:42 -0500 Subject: [PATCH] This is a probably broken version of build.py --- .claude/settings.local.json | 10 +++++++-- .gitignore | 1 + Docs/A Summary of our Lua Patches.md | 2 -- build.py | 32 ++++++++++++++++++++++------ luprex/ext/eris-master/src/lapi.c | 14 ------------ luprex/ext/eris-master/src/lua.h | 1 - 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 8527f7d6..2dfd22f8 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -1,10 +1,16 @@ { "permissions": { - "defaultMode": "acceptEdits", + "allow": [ + "WebFetch(domain:dev.epicgames.com)", + "WebSearch", + "WebFetch(domain:github.com)", + "Bash(chmod:*)" + ], "deny": [ "Bash(git commit *)", "Bash(git push *)", "Bash(rm -rf *)" - ] + ], + "defaultMode": "acceptEdits" } } diff --git a/.gitignore b/.gitignore index 37fc3667..c283f688 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ luprex/ext/eris-master/src/luac luprex/ext/eris-master/test/persist luprex/ext/eris-master/test/unpersist +GPF-output/** diff --git a/Docs/A Summary of our Lua Patches.md b/Docs/A Summary of our Lua Patches.md index 769d8114..eea9c66d 100644 --- a/Docs/A Summary of our Lua Patches.md +++ b/Docs/A Summary of our Lua Patches.md @@ -100,8 +100,6 @@ Now, I'm seriously tempted to have lua_len just return the number of keys in the Since this feels insane, I have also provided a totally new API function: lua_nkeys. This returns the number of keys in the table, full stop. It's constant-time. -This patch also includes a function lua_nthkey, to get the Nth item in the table iteration, random-access style. I am not certain that this is a good idea, and I have deliberately avoided the use of this function for now, until I am convinced that it's wise. - This patch is live, and is necessary to the determinism of the system. ## The Table Flag Bits Patch diff --git a/build.py b/build.py index bfa0b0f4..50223a0b 100755 --- a/build.py +++ b/build.py @@ -340,21 +340,38 @@ def build_intellisense_database_for_clangd(): Path(f"{INTEGRATION}/.vscode/compile_commands.json").write_text(json.dumps(ccjson, indent=2)) +def run_generateprojectfiles_in_sandbox(): + """ + Unreal's GenerateProjectFiles does an absolutely terrible + job of generating project files for vscode. It's so bad + that we've decided to just not use it at all. But we + still sometimes want to look at the output, to see what + it would have generated. We run GenerateProjectFiles + in a sandbox so it can't modify the real project. Then, + we leave the output in the sandbox for inspection. The + results don't affect our build system at all. + """ + sandbox = Path(f"{INTEGRATION}/GPF-output") + if sandbox.exists(): + shutil.rmtree(sandbox) + sandbox.mkdir() + (sandbox / "Integration.uproject").write_bytes(Path(f"{INTEGRATION}/Integration.uproject").read_bytes()) + for name in ["Source", "Config", "Content"]: + (sandbox / name).symlink_to(f"../{name}") + shell(str(sandbox), f'{UNREALENGINE}/GenerateProjectFiles.{BAT} -projectfiles -project="{sandbox}/Integration.uproject" -game') + # Remove the symlinks and uproject copy, leaving only generated files + for name in ["Source", "Config", "Content", "Integration.uproject"]: + (sandbox / name).unlink() + + def generate_integration_code_workspace(): """ We build Integration.code-workspace from a template that we wrote ourselves, Integration.code-workspace.tpl.json. - We use UnrealBuildTool to generate Integration.code-workspace.ubt, - but we don't use it: we just keep it as a reference that you can - refer to when editing the template. """ workspace = f"{INTEGRATION}/Integration.code-workspace" - workspace_ubt = f"{INTEGRATION}/Integration.code-workspace.ubt" template = f"{INTEGRATION}/Integration.code-workspace.tpl.json" Path(workspace).unlink(missing_ok=True) - Path(workspace_ubt).unlink(missing_ok=True) - shell(INTEGRATION, f'{UNREALENGINE}/GenerateProjectFiles.{BAT} -projectfiles -project="{INTEGRATION}/Integration.uproject" -game') - Path(workspace).rename(workspace_ubt) expand_json_file(template, workspace, CONFIG) @@ -384,6 +401,7 @@ if MODE == "all": generate_lpx_paths() generate_integration_uproject() run_unrealengine_setup_bat_replacement() + run_generateprojectfiles_in_sandbox() build_unrealbuildtool() generate_integration_code_workspace() diff --git a/luprex/ext/eris-master/src/lapi.c b/luprex/ext/eris-master/src/lapi.c index f8390b78..d2d3943a 100644 --- a/luprex/ext/eris-master/src/lapi.c +++ b/luprex/ext/eris-master/src/lapi.c @@ -1227,20 +1227,6 @@ LUA_API int lua_nkeys (lua_State *L, int idx) { return n; } -LUA_API int lua_nthkey (lua_State *L, int idx, int n) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - api_incr_top(L); - api_incr_top(L); - int res = luaH_nthkey(L, hvalue(t), n, L->top - 2); - if (res == 0) - L->top -= 2; - lua_unlock(L); - return res; -} - LUA_API void lua_concat (lua_State *L, int n) { lua_lock(L); api_checknelems(L, n); diff --git a/luprex/ext/eris-master/src/lua.h b/luprex/ext/eris-master/src/lua.h index 85a6e472..17d5e621 100644 --- a/luprex/ext/eris-master/src/lua.h +++ b/luprex/ext/eris-master/src/lua.h @@ -317,7 +317,6 @@ LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); LUA_API int (lua_nkeys) (lua_State *L, int idx); -LUA_API int (lua_nthkey) (lua_State *L, int idx, int n); /* ** ===============================================================