Files
msime-windows/ui-html/scripts/sync-contracts.py
T
Evan Hu 373f8d1473 refactor: collapse the duplicated submodules into one vendor/ directory
Windows, Server and UiHtml each carried their own gitlink to MSIME-Engine, all three pinned to the same commit, and Server carried a gitlink to MSIME-UI that is now the ui/ component. Git only reads the root .gitmodules, so the nested ones had to go regardless.

The engine and the two third-party dependencies now live once at vendor/MetasequoiaImeEngine, vendor/opencc and vendor/cpp-pinyin. Server reaches them through MSIME_VENDOR_DIR and builds ui/ as an out-of-tree subdirectory; the Windows tip's relative contract includes gained the extra level; the ui-html contract sync and the Server env/table generators follow the engine to its new location.
2026-09-06 02:27:52 +09:00

23 lines
950 B
Python

#!/usr/bin/env python3
"""Materialize the pinned Engine's web contract for bundling and classic WebView pages."""
import argparse
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
MONOREPO_ROOT = ROOT.parent
FILES = ('schema.js', 'runtime.js', 'schema.d.ts', 'runtime.d.ts', 'messages.ts')
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--check', action='store_true')
args = parser.parse_args()
source = MONOREPO_ROOT / 'vendor/MetasequoiaImeEngine/contracts/webview'
destination = ROOT / 'webview2/shared'
for name in FILES:
expected = (source / name).read_bytes()
target = destination / name
if args.check:
if not target.exists() or target.read_bytes() != expected:
raise SystemExit(f'{target} differs from the pinned Engine contract; run scripts/sync-contracts.py')
else:
destination.mkdir(parents=True, exist_ok=True)
target.write_bytes(expected)