feat: readoorDict 打包按版本轨道替换 IPA 版本号与构建号

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-11-03 12:04:32 +09:00
co-authored by Claude Opus 5.5
parent 11f4035da7
commit 311234bd74
2 changed files with 26 additions and 1 deletions
+15
View File
@@ -202,6 +202,20 @@ def _apply_dictionary_config(build_dir: Path, config: dict, messages: list[str])
messages.append("已替换词典版本配置")
def _apply_dictionary_version(build_dir: Path, config: dict, messages: list[str]):
"""词典包的 IPA 版本号与构建号同样按版本轨道写入工程(与 readoor31 一致,替换工程内全部构建配置)。"""
project = build_dir / "readoor.xcodeproj" / "project.pbxproj"
version, build_version = config.get("VERSION", ""), config.get("BUILD_VERSION", "")
replacements = [
("MARKETING_VERSION =", f"\t\t\t\tMARKETING_VERSION = {version};"),
("CURRENT_PROJECT_VERSION =", f"\t\t\t\tCURRENT_PROJECT_VERSION = {build_version};"),
]
missing = [keyword for keyword, line in replacements if _replace_lines(project, keyword, line) == 0]
if missing:
raise ProjectPatchError(f"未找到待替换配置: {', '.join(missing)}")
messages.append(f"已替换词典包版本: {version} ({build_version})")
def apply_project_config(build_dir: Path, config: dict, definition: dict = None) -> list[str]:
"""写入项目配置,返回适合实时日志展示的变更说明。
@@ -213,6 +227,7 @@ def apply_project_config(build_dir: Path, config: dict, definition: dict = None)
messages: list[str] = []
if config.get("SCHEME") == "readoorDict":
_apply_dictionary_config(build_dir, config, messages)
_apply_dictionary_version(build_dir, config, messages)
_write_export_options(build_dir, config)
return messages