`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 及各子目录 文档同步说明新的位置与边界。
71 lines
3.1 KiB
Bash
Executable File
71 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Formatting has to be reproducible across contributor machines and CI, so the
|
|
# formatter version is pinned here and installed from PyPI instead of being
|
|
# taken from whatever the host toolchain happens to ship. Apple, Debian and
|
|
# LLVM upstream all disagree about clang-format defaults between releases.
|
|
#
|
|
# Ported from MSIME-Linux, which has run this in CI since before the
|
|
# consolidation. Each component keeps its own .clang-format; --style=file picks
|
|
# up the nearest one, so server/, windows/, ui/, log/ and engine/ stay
|
|
# independent -- engine/voice/.clang-format widens the column limit for that
|
|
# subtree alone, and the nearest-file rule is what keeps it that way.
|
|
clang_format_version=18.1.8
|
|
|
|
project_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
venv_root=${METASEQUOIA_CLANG_FORMAT_VENV:-"${TMPDIR:-/tmp}/metasequoia-clang-format-$clang_format_version"}
|
|
clang_format="$venv_root/bin/clang-format"
|
|
|
|
if [[ ! -x "$clang_format" ]]; then
|
|
python3 -m venv "$venv_root"
|
|
"$venv_root/bin/pip" install --quiet "clang-format==$clang_format_version"
|
|
fi
|
|
|
|
mode=${1:---write}
|
|
case "$mode" in
|
|
--check) clang_format_arguments=(--dry-run --Werror) ;;
|
|
--write) clang_format_arguments=(-i) ;;
|
|
*)
|
|
echo "Usage: ${BASH_SOURCE[0]} [--check|--write]" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
cd "$project_root"
|
|
# --others --exclude-standard so a newly written file that has not been staged
|
|
# yet is still formatted. Without it the script reports a clean tree while
|
|
# skipping exactly the file being worked on.
|
|
#
|
|
# vendor/ and experiments/ are excluded: the first is third-party, the second is
|
|
# a scratch project that is not part of the shipped product.
|
|
#
|
|
# engine/ is covered here rather than by a script of its own. It used to be a
|
|
# separate repository with its own formatting gate; now that it is a directory
|
|
# of this one, a Windows-specific fix to it has to be held to the same standard
|
|
# as the code that calls it, and one entry point is what makes that automatic.
|
|
# The exclusions below are the ones that gate carried:
|
|
#
|
|
# - googlepinyinime-rev keeps its AOSP formatting and utfcpp is an upstream
|
|
# copy, so neither is ours to reformat; same for */third_party/ (miniaudio).
|
|
# - The four generated headers are emitted from JSON by
|
|
# contracts/{assets,dictionary,punctuation,webview}/generate.py, and CI
|
|
# re-runs each generator with --check. Reformatting the checked-in copy
|
|
# would only make it disagree with what the generator produces.
|
|
git ls-files --cached --others --exclude-standard \
|
|
'server/*.cpp' 'server/*.h' \
|
|
'windows/*.cpp' 'windows/*.h' \
|
|
'ui/*.cpp' 'ui/*.h' \
|
|
'log/*.cpp' 'log/*.h' \
|
|
'engine/*.cpp' 'engine/*.h' 'engine/*.hpp' \
|
|
| grep -v '/vendor/' \
|
|
| grep -vE '^engine/(googlepinyinime-rev|utfcpp)/' \
|
|
| grep -v '/third_party/' \
|
|
| grep -vxF \
|
|
-e engine/contracts/assets/assets.h \
|
|
-e engine/contracts/dictionary/format.h \
|
|
-e engine/contracts/punctuation/policy.h \
|
|
-e engine/contracts/webview/schema.h \
|
|
| sort -u \
|
|
| xargs "$clang_format" "${clang_format_arguments[@]}" --style=file
|