fix: 补齐 Readoor 打包工具链并准确报告脚本缺失
This commit is contained in:
@@ -22,6 +22,8 @@ from backend.services.build_service import (
|
||||
_cleanup_old_builds,
|
||||
_mark_superseded_tasks,
|
||||
_resolve_provisioning_profile,
|
||||
_classify_build_error,
|
||||
BuildError,
|
||||
)
|
||||
from backend.services.log_streamer import LogStreamer
|
||||
|
||||
@@ -202,14 +204,45 @@ async def test_copy_source_code(tmp_dirs, log_streamer):
|
||||
assert result.exists()
|
||||
assert (result / "readoor" / "AppDelegate.swift").exists()
|
||||
assert (result / "Pods").exists()
|
||||
assert (result / "Podfile").exists()
|
||||
assert not (result / "podfile").exists()
|
||||
names = {entry.name for entry in result.iterdir()}
|
||||
assert "Podfile" in names
|
||||
assert "podfile" not in names
|
||||
assert (result / "Podfile.lock").exists()
|
||||
assert (result / "readoor.xcworkspace").exists()
|
||||
assert (result / "Vendor" / "RDEpubReaderView" / "RDEpubReaderView.podspec").exists()
|
||||
assert (result / "AutoPacking" / "obfuscation" / "generate_image_whitelist.py").exists()
|
||||
|
||||
|
||||
async def test_legacy_copy_items_include_guard_with_relative_links(tmp_dirs):
|
||||
source, builds = tmp_dirs
|
||||
toolchain = source / "iOSGuardIntegration" / "toolchain"
|
||||
toolchain.mkdir(parents=True)
|
||||
(toolchain / "readoor-test").symlink_to("../..")
|
||||
definition = {"copy_items": ["readoor"]}
|
||||
with patch("backend.services.build_service.BUILD_BASE_DIR", builds):
|
||||
snapshot = await copy_source_code("guard", MagicMock(), source, definition)
|
||||
link = snapshot / "iOSGuardIntegration/toolchain/readoor-test"
|
||||
assert link.is_symlink() and link.resolve() == snapshot
|
||||
assert definition["copy_items"] == ["readoor"]
|
||||
|
||||
|
||||
async def test_missing_guard_script_fails_before_archive(tmp_dirs):
|
||||
source, _ = tmp_dirs
|
||||
relative = "iOSGuardIntegration/toolchain/tools/xcode_archive/ig_guard_frameworks_phase.py"
|
||||
(source / "readoor.xcodeproj/project.pbxproj").write_text(relative)
|
||||
with pytest.raises(BuildError, match="ig_guard_frameworks_phase.py"):
|
||||
await build_project("guard", MagicMock(), {"SCHEME": "readoor31OtherPay"}, source,
|
||||
{"workspace": "readoor.xcworkspace"})
|
||||
|
||||
|
||||
def test_missing_script_with_normal_signing_identity():
|
||||
lines = ["Signing Identity: iPhone Distribution: Example",
|
||||
"python3: can't open file '/tmp/guard.py': [Errno 2] No such file or directory"]
|
||||
category, hint = _classify_build_error(lines, "archive")
|
||||
assert category == "config" and "/tmp/guard.py" in hint
|
||||
assert _classify_build_error(["No signing certificate found"], "archive")[0] == "certificate"
|
||||
|
||||
|
||||
async def test_copy_source_code_normalizes_lowercase_podfile(tmp_dirs, log_streamer):
|
||||
"""旧分支的 podfile 也必须复制为 Pods 工程引用的 Podfile。"""
|
||||
source_dir, build_dir_parent = tmp_dirs
|
||||
|
||||
Reference in New Issue
Block a user