57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Apply source-backed runtime settings to the Creator web build output."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCE_SETTINGS = (
|
|
Path("/Users/hy/Documents/dev/qq_farm_godot_rebuild_20260616")
|
|
/ "source_raw"
|
|
/ "6A3BB7D3D4349E2050E7B701AAD51600_726750140f8084ebcbe5190fe9c198c9"
|
|
/ "src"
|
|
/ "settings.db152.json"
|
|
)
|
|
BUILD_SETTINGS = ROOT / "CocosFarm" / "build" / "web-mobile" / "src" / "settings.json"
|
|
REPORT_PATH = ROOT / "artifacts" / "creator_capture" / "stage1_build_settings_patch_report.json"
|
|
|
|
|
|
def load_json(path: Path) -> dict:
|
|
return json.loads(path.read_text(encoding="utf-8"))
|
|
|
|
|
|
def write_json(path: Path, data: dict) -> None:
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
|
|
|
|
|
def main() -> int:
|
|
source = load_json(SOURCE_SETTINGS)
|
|
build = load_json(BUILD_SETTINGS)
|
|
source_screen = source["screen"]
|
|
previous_screen = build.get("screen")
|
|
build["screen"] = source_screen
|
|
source_splash = source["splashScreen"]
|
|
previous_splash = build.get("splashScreen")
|
|
build["splashScreen"] = source_splash
|
|
write_json(BUILD_SETTINGS, build)
|
|
report = {
|
|
"status": "pass",
|
|
"sourceSettings": str(SOURCE_SETTINGS),
|
|
"buildSettings": str(BUILD_SETTINGS),
|
|
"previousScreen": previous_screen,
|
|
"appliedScreen": source_screen,
|
|
"previousSplashScreen": previous_splash,
|
|
"appliedSplashScreen": source_splash,
|
|
}
|
|
write_json(REPORT_PATH, report)
|
|
print(json.dumps(report, ensure_ascii=False, indent=2))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|