Files
workinf_Blender_Wasm/my-tools/build_local_webengine.py
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

47 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Incrementally compile the local WebEngine and publish its integrity binding."""
import json
import os
from pathlib import Path
import shutil
import subprocess
import time
ROOT = Path(__file__).resolve().parents[1]
def main():
nodes = sorted((ROOT / ".emsdk/node").glob("*/bin/node"))
node = str(nodes[-1]) if nodes else shutil.which("node")
if not node:
raise RuntimeError("local Node executable missing")
environment = {**os.environ,
"EM_CONFIG": str(ROOT / ".emscripten-web"),
"EM_LLVM_ROOT": str(ROOT / ".emsdk/upstream/bin"),
"EM_BINARYEN_ROOT": str(ROOT / ".emsdk/upstream"),
"EM_NODE_JS": node,
"EM_LLVM_ADD_VERSION": "", "EM_CLANG_ADD_VERSION": "",
}
jobs = max(1, min(4, int(os.environ.get("CMAKE_BUILD_PARALLEL_LEVEL", "4"))))
stages = []
for name, argv in [
("incremental_compile", ["cmake", "--build", "build_web_blender6", "--target", "web_engine", "--parallel", str(jobs)]),
("runtime_integrity_sync", ["node", "tools/web/sync-web-engine-runtime.mjs"]),
]:
start = time.monotonic()
result = subprocess.run(argv, cwd=ROOT, env=environment)
stages.append({"stage": name, "seconds": round(time.monotonic() - start, 6), "exitCode": result.returncode})
print(json.dumps(stages[-1]), flush=True)
if result.returncode:
return result.returncode
if os.environ.get("WBV2_RECEIPT_DIR"):
output = Path(os.environ["WBV2_RECEIPT_DIR"])
output.mkdir(parents=True, exist_ok=True)
(output / "build-stages.json").write_text(json.dumps(stages, indent=2) + "\n", encoding="utf-8")
return 0
if __name__ == "__main__":
raise SystemExit(main())