This is a probably broken version of build.py

This commit is contained in:
2026-02-11 13:21:42 -05:00
parent 159e97d5bb
commit 6e1248e3b8
6 changed files with 34 additions and 26 deletions

View File

@@ -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()