fix: 统一打包副本 Podfile 大小写
This commit is contained in:
parent
2661435273
commit
2ad5f208ed
@ -105,7 +105,7 @@ COPY_ITEMS = [
|
||||
"readoor.xcodeproj",
|
||||
"readoorTests",
|
||||
"Vendor",
|
||||
"podfile",
|
||||
"Podfile",
|
||||
"Pods",
|
||||
"Podfile.lock",
|
||||
"readoor.xcworkspace",
|
||||
|
||||
@ -486,6 +486,10 @@ async def copy_source_code(task_id: str, task, source_dir: Path) -> Path:
|
||||
|
||||
for item in COPY_ITEMS:
|
||||
src = source_dir / item
|
||||
# 历史分支中该文件可能仍是小写 podfile;构建副本统一使用 Pods.xcodeproj
|
||||
# 引用的标准名称 Podfile,避免大小写敏感文件系统报路径不一致。
|
||||
if item == "Podfile" and not src.is_file():
|
||||
src = source_dir / "podfile"
|
||||
dst = build_dir / item
|
||||
if src.is_dir():
|
||||
await log_streamer.emit(task_id, f"拷贝目录: {item}")
|
||||
|
||||
@ -44,7 +44,7 @@ def tmp_dirs(tmp_path):
|
||||
vendor_dir.mkdir(parents=True)
|
||||
(vendor_dir / "RDEpubReaderView.podspec").write_text("Pod::Spec.new do |s| end")
|
||||
(source_dir / "readoorTests").mkdir()
|
||||
(source_dir / "podfile").write_text("pod 'AFNetworking'")
|
||||
(source_dir / "Podfile").write_text("pod 'AFNetworking'")
|
||||
|
||||
build_dir = tmp_path / "build"
|
||||
return source_dir, build_dir
|
||||
@ -154,12 +154,29 @@ 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()
|
||||
assert (result / "Podfile.lock").exists()
|
||||
assert (result / "readoor.xcworkspace").exists()
|
||||
assert (result / "Vendor" / "RDEpubReaderView" / "RDEpubReaderView.podspec").exists()
|
||||
assert not (result / "AutoPacking").exists()
|
||||
|
||||
|
||||
async def test_copy_source_code_normalizes_lowercase_podfile(tmp_dirs, log_streamer):
|
||||
"""旧分支的 podfile 也必须复制为 Pods 工程引用的 Podfile。"""
|
||||
source_dir, build_dir_parent = tmp_dirs
|
||||
(source_dir / "Podfile").unlink()
|
||||
(source_dir / "podfile").write_text("pod 'AFNetworking'")
|
||||
task = MagicMock(branch="main")
|
||||
|
||||
with patch("backend.services.build_service.BUILD_BASE_DIR", build_dir_parent):
|
||||
result = await copy_source_code("t1", task, source_dir)
|
||||
|
||||
copied_names = {path.name for path in result.iterdir()}
|
||||
assert "Podfile" in copied_names
|
||||
assert "podfile" not in copied_names
|
||||
|
||||
|
||||
async def test_copy_source_code_excludes_git(tmp_dirs, log_streamer):
|
||||
"""拷贝时排除 .git 目录"""
|
||||
source_dir, build_dir_parent = tmp_dirs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user