修复打包签名并支持 App Store IPA 上传

This commit is contained in:
shenlei
2026-07-20 14:16:45 +09:00
parent 7fd3845447
commit 2661435273
6 changed files with 156 additions and 56 deletions
+18 -1
View File
@@ -2,6 +2,7 @@
import asyncio
import json
import os
import plistlib
import time
import shutil
import tempfile
@@ -17,6 +18,7 @@ from backend.services.build_service import (
build_project,
generate_config,
_cleanup_old_builds,
_resolve_provisioning_profile,
)
from backend.services.log_streamer import LogStreamer
@@ -233,7 +235,11 @@ async def test_generate_config(tmp_path, log_streamer):
"schemes": {"1": {"name": "testScheme", "ossFloder": "test"}},
}
with patch("backend.routers.config.load_config", return_value=mock_config):
with patch("backend.routers.config.load_config", return_value=mock_config), \
patch(
"backend.services.build_service._resolve_provisioning_profile",
return_value=("pro", "TEAM123"),
):
result = await generate_config("t1", task, build_dir)
assert result["APPID"] == "guid-123"
@@ -241,6 +247,8 @@ async def test_generate_config(tmp_path, log_streamer):
assert result["BUILD_TYPE"] == "Ad_Hoc"
assert result["BUNDLE_ID"] == "com.test.app"
assert result["CERTIFICATE"] == "cert"
assert result["PROVISIONING_NAME"] == "pro"
assert result["TEAM_ID"] == "TEAM123"
config_file = build_dir / "config_output.json"
assert config_file.exists()
@@ -248,6 +256,15 @@ async def test_generate_config(tmp_path, log_streamer):
assert saved["APPID"] == "guid-123"
def test_resolve_provisioning_profile_extracts_name_and_team(tmp_path):
profile_path = tmp_path / "profile.mobileprovision"
profile_path.write_bytes(b"signed profile")
decoded = plistlib.dumps({"Name": "a4YX061_adHoc", "TeamIdentifier": ["MG4Z7FU83W"]})
with patch("backend.services.build_service.subprocess.check_output", return_value=decoded):
assert _resolve_provisioning_profile(str(profile_path)) == ("a4YX061_adHoc", "MG4Z7FU83W")
async def test_generate_config_uses_saved_version(tmp_path, log_streamer):
"""从服务配置读取版本号,不依赖分支源码脚本"""
build_dir = tmp_path / "build"