fix: 补齐 Readoor 打包工具链并准确报告脚本缺失
This commit is contained in:
@@ -108,6 +108,7 @@ COPY_ITEMS = [
|
||||
"readoorTests",
|
||||
"Vendor",
|
||||
"AutoPacking",
|
||||
"iOSGuardIntegration",
|
||||
"Podfile",
|
||||
"Pods",
|
||||
"Podfile.lock",
|
||||
|
||||
@@ -164,7 +164,7 @@ def _resolve_provisioning_profile(profile_reference: str) -> tuple[str, str]:
|
||||
_ERROR_RULES = [
|
||||
(["No signing certificate", "Signing certificate \"", "Code Signing Error",
|
||||
"Code Sign error", "errSecInternalComponent", "CSSMERR_TP_NOT_TRUSTED",
|
||||
"iPhone Distribution", "iPhone Developer: no identity found"],
|
||||
"iPhone Distribution: no identity found", "iPhone Developer: no identity found"],
|
||||
"certificate", "签名证书问题:证书过期、未安装或不匹配,请检查钥匙串中的证书"),
|
||||
(["Provisioning profile", "No matching provisioning profiles",
|
||||
"embedded.mobileprovision", "PROVISIONING_PROFILE_SPECIFIER",
|
||||
@@ -209,6 +209,10 @@ def _classify_build_error(output_lines: list, step: str) -> tuple:
|
||||
"""
|
||||
output_text = "\n".join(output_lines)
|
||||
|
||||
missing_script = re.search(r"""can't open file ['"]([^'"]+)['"]: \[Errno 2\] No such file or directory""", output_text)
|
||||
if missing_script:
|
||||
return "config", f"构建脚本缺失:{missing_script.group(1)},请检查源码拷贝配置"
|
||||
|
||||
for keywords, category, hint in _ERROR_RULES:
|
||||
for kw in keywords:
|
||||
if kw.lower() in output_text.lower():
|
||||
@@ -663,6 +667,12 @@ async def copy_source_code(task_id: str, task, source_dir: Path, definition: dic
|
||||
await log_streamer.emit(task_id, "代码拷贝完成")
|
||||
return build_dir
|
||||
|
||||
# 旧项目配置可能早于 Route 2 集成,按分支实际内容补齐快照。
|
||||
if (project_id == LEGACY_PROJECT_ID or definition.get("patcher") == PATCHER_READOOR) and (
|
||||
source_dir / "iOSGuardIntegration"
|
||||
).is_dir() and "iOSGuardIntegration" not in copy_items:
|
||||
copy_items = [*copy_items, "iOSGuardIntegration"]
|
||||
|
||||
build_dir.mkdir(parents=True)
|
||||
for item in copy_items:
|
||||
src = source_dir / item
|
||||
@@ -673,7 +683,7 @@ async def copy_source_code(task_id: str, task, source_dir: Path, definition: dic
|
||||
dst = build_dir / item
|
||||
if src.is_dir():
|
||||
await log_streamer.emit(task_id, f"拷贝目录: {item}")
|
||||
shutil.copytree(src, dst, ignore=shutil.ignore_patterns(".git", "DerivedData"))
|
||||
shutil.copytree(src, dst, symlinks=True, ignore=shutil.ignore_patterns(".git", "DerivedData"))
|
||||
elif src.is_file():
|
||||
await log_streamer.emit(task_id, f"拷贝文件: {item}")
|
||||
shutil.copy2(src, dst)
|
||||
@@ -979,6 +989,15 @@ async def build_project(task_id: str, task, config_data: dict, build_dir: Path,
|
||||
else:
|
||||
raise BuildError("项目未配置 Xcode workspace 或 project", category="config")
|
||||
|
||||
if scheme in ("readoor31", "readoor31OtherPay"):
|
||||
project_file = build_dir / "readoor.xcodeproj" / "project.pbxproj"
|
||||
if project_file.is_file():
|
||||
project_text = project_file.read_text(encoding="utf-8")
|
||||
for script in ("ig_ld_wrapper.py", "ig_guard_frameworks_phase.py"):
|
||||
relative = Path("iOSGuardIntegration/toolchain/tools/xcode_archive") / script
|
||||
if str(relative) in project_text and not (build_dir / relative).is_file():
|
||||
raise BuildError(f"源码快照缺少工程引用的脚本:{relative}", category="config")
|
||||
|
||||
export_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# 清理
|
||||
|
||||
Reference in New Issue
Block a user