feat: 构建号按版本号(App_Ver)独立记录,避免回退旧版本号被 App Store 拒
将 versions.build_ver 单值改为 build_map(每个 App_Ver 独立记录已用到的最大 构建号)。App Store 的构建号唯一性按 MARKETING_VERSION 分别计算,改为单一全局 计数器时回退到打过包的旧版本号会重复(如 2.195.0 已到 .5,切 2.196.0 后再回退, 重置/沿用全局计数都会 < .5 而被拒)。 - config.py: 新增 _ensure_versions 迁移旧 build_ver → build_map;PUT /versions 不再重置构建号,改版本号仅切换当前 App_Ver,并支持可选手动设置 build_ver; GET /versions 返回 build_map 及当前版本号对应的 build_ver - build_service.py: App_Store 打包时在 build_map[app_ver] 自身上 +1 并回写 - ConfigView.vue: 打包设置页显示可编辑的 Build_Ver,修改 App_Ver 时自动切换为 该版本号已记录的构建号 - 迁移 config.json;更新前后端相关测试 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b6e56f5f9a
commit
91e9b027e8
@@ -613,23 +613,21 @@ async def generate_config(task_id: str, task, build_dir: Path) -> dict:
|
||||
|
||||
# 版本号由当前服务配置统一管理,不读取分支源码中的手动打包脚本。
|
||||
app_ver = versions.get("app_ver", "2.180.0")
|
||||
build_ver = versions.get("build_ver", "2.180.0.0")
|
||||
|
||||
# App_Store 打包时自动递增 Build_Ver 第四位版本号
|
||||
# 构建号按版本号独立记录:build_map[app_ver] 为该版本号已用到的最大第四位。
|
||||
build_map = versions.get("build_map", {}) or {}
|
||||
build_ver = f"{app_ver}.{int(build_map.get(app_ver, 0))}"
|
||||
|
||||
# App_Store 打包时,在该版本号自己的构建号上 +1(回退到旧版本号也从它自己的最大值继续)
|
||||
if task.build_type == "App_Store":
|
||||
async with _config_lock:
|
||||
parts = build_ver.split(".")
|
||||
if len(parts) >= 4:
|
||||
parts[3] = str(int(parts[3]) + 1)
|
||||
else:
|
||||
parts.append("1")
|
||||
build_ver = ".".join(parts)
|
||||
|
||||
config = load_config()
|
||||
config["versions"] = {
|
||||
"app_ver": app_ver,
|
||||
"build_ver": build_ver,
|
||||
}
|
||||
versions = config.setdefault("versions", {"app_ver": app_ver, "build_map": {}})
|
||||
build_map = versions.setdefault("build_map", {})
|
||||
n = int(build_map.get(app_ver, 0)) + 1
|
||||
build_map[app_ver] = n
|
||||
build_ver = f"{app_ver}.{n}"
|
||||
|
||||
from ..routers.config import save_config
|
||||
save_config(config)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user