`vendor/MetasequoiaImeEngine` submodule 改为 `engine/` 目录,导入的是 product-lock.json 原本钉住的提交 c810d201,逐文件核对过 blob,因此这是一次 搬迁而不是引擎升级。引擎自己的嵌套 submodule(googlepinyinime-rev、utfcpp、 miniaudio)按各自 gitlink 一并展开,来源与提交见 engine/UPSTREAM.md。 Windows 专门化裁掉了不属于本产品的部分:whisper.cpp 与本地推理 provider、 macOS 示例宿主、整个 dictionary/ 建库流水线、上游 CI 与 release-please 配置。 词库仍按 product-lock.json 在构建时取发布产物。 引擎不再进 product-lock.json:没有 gitlink 就没有可比对的东西,锁里写一个上游 commit 等于宣称这棵树仍等于上游,而第一个 Windows 专门化改动落地时这句话就假了。 verify-contracts / verify-checkout 随之移除,verify-published 保留。 CI 与工具链:引擎源码并入根 scripts/format.sh(删掉引擎自己的那份,避免两套排除 列表分叉);引擎 voice.yml 里的 silero_vad.onnx 摘要校验移到本仓 lock job; engine-bump-triage 工作流与其测试删除;gitsubmodule 的 dependabot 频率由 daily 改为 monthly。 README、README.en、AGENTS.md、CONTRIBUTING、docs/product-release.md 及各子目录 文档同步说明新的位置与边界。
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
"""Generate the machine-specific .clangd for this checkout.
|
|
|
|
Only .clangd is generated. tests/CMakeLists.txt and tests/CMakePresets.json used to be
|
|
generated from copies under config_files/ as well, which meant every source file added to
|
|
the real build had to be mirrored into a second copy by hand. It stopped being mirrored,
|
|
and running this script would overwrite a working tests/CMakeLists.txt with a stale one
|
|
that no longer listed eleven translation units. Both files now resolve Boost and vcpkg from
|
|
the environment on their own, so there is nothing left to rewrite.
|
|
"""
|
|
|
|
import os
|
|
|
|
|
|
def normpath(path):
|
|
return path.replace("\\", "/")
|
|
|
|
|
|
def resolve_boost_root(user_home):
|
|
"""Mirror the lookup order in tests/CMakeLists.txt so clangd and CMake agree."""
|
|
for name in ("Boost_ROOT", "BOOST_ROOT"):
|
|
value = os.environ.get(name)
|
|
if value:
|
|
return normpath(value)
|
|
return normpath(os.path.join(user_home, "scoop", "apps", "boost", "current"))
|
|
|
|
|
|
cur_file_path = os.path.dirname(os.path.abspath(__file__))
|
|
project_root_path = os.path.dirname(os.path.dirname(cur_file_path))
|
|
|
|
user_home = os.path.expanduser("~")
|
|
|
|
MetasequoiaImeEngine_root = normpath(project_root_path)
|
|
vcpkg_include = normpath(
|
|
os.path.join(
|
|
MetasequoiaImeEngine_root, "tests", "build", "vcpkg_installed", "x64-windows", "include"
|
|
)
|
|
)
|
|
utfcpp_path = normpath(os.path.join(MetasequoiaImeEngine_root, "utfcpp", "source"))
|
|
boost_path = resolve_boost_root(user_home)
|
|
|
|
dot_clangd_new_lines = [
|
|
f' "-I{MetasequoiaImeEngine_root}",\n',
|
|
f' "-I{vcpkg_include}",\n',
|
|
f' "-I{utfcpp_path}",\n',
|
|
f' "-I{boost_path}",\n',
|
|
]
|
|
dot_clangd_file = os.path.join(
|
|
MetasequoiaImeEngine_root, "tests", "scripts", "config_files", ".clangd"
|
|
)
|
|
dot_clangd_output_file = os.path.join(MetasequoiaImeEngine_root, ".clangd")
|
|
with open(dot_clangd_file, "r", encoding="utf-8") as f:
|
|
lines = f.readlines()
|
|
lines[6:10] = dot_clangd_new_lines
|
|
with open(dot_clangd_output_file, "w", encoding="utf-8") as f:
|
|
f.writelines(lines)
|
|
|
|
print(f"wrote {dot_clangd_output_file}")
|