compare-bundles

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Compare Bundles

应用包对比

Quick Start

快速开始

You'll typically receive two bundle identifiers. Follow these steps:
  1. Run
    tuist bundle list --json
    to find bundles on each branch.
  2. Run
    tuist bundle show <bundle-id> --json
    for both base and head bundles.
  3. Compare artifact trees with
    tuist bundle artifact list <bundle-id> --json
    .
  4. Compare install size, download size, and other metadata.
  5. Summarize size changes with actionable recommendations.
你通常会拿到两个bundle标识符,按照以下步骤操作:
  1. 运行
    tuist bundle list --json
    查找每个分支上的应用包。
  2. 分别对基准包和对比包执行
    tuist bundle show <bundle-id> --json
    命令。
  3. 执行
    tuist bundle artifact list <bundle-id> --json
    对比产物树。
  4. 对比安装体积、下载体积和其他元数据。
  5. 总结体积变化,给出可落地的优化建议。

Step 1: Resolve Bundles

步骤1:解析应用包

If base/head are bundle IDs or dashboard URLs

如果基准/对比包是bundle ID或仪表盘URL

Fetch each directly:
bash
tuist bundle show <base-id> --json
tuist bundle show <head-id> --json
直接拉取信息即可:
bash
tuist bundle show <base-id> --json
tuist bundle show <head-id> --json

If base/head are branch names

如果基准/对比包是分支名称

List recent bundles on each branch and pick the latest:
bash
tuist bundle list --git-branch <base-branch> --json
tuist bundle list --git-branch <head-branch> --json
Then fetch full details with
tuist bundle show <id> --json
.
列出每个分支上的最近应用包,选择最新版本:
bash
tuist bundle list --git-branch <base-branch> --json
tuist bundle list --git-branch <head-branch> --json
然后执行
tuist bundle show <id> --json
拉取完整详情。

Defaults

默认规则

  • If no base is provided, use the project's default branch (usually
    main
    ).
  • If no head is provided, detect the current git branch.
  • 若未提供基准包,使用项目的默认分支(通常是
    main
    )。
  • 若未提供对比包,自动检测当前git分支。

Step 2: Compare Artifact Trees

步骤2:对比产物树

After fetching both bundles with
tuist bundle show <id> --json
, compare the individual artifacts:
bash
tuist bundle artifact list <base-id> --json
tuist bundle artifact list <head-id> --json
Match artifacts by name across both bundles. Look for:
  • New artifacts added in the head bundle (potential size contributors)
  • Removed artifacts (explain size decreases)
  • Size changes in existing artifacts
通过
tuist bundle show <id> --json
拉取两个应用包的信息后,对比单个产物:
bash
tuist bundle artifact list <base-id> --json
tuist bundle artifact list <head-id> --json
按名称匹配两个应用包的产物,重点关注:
  • 对比包中新增的产物(可能是体积增长的原因)
  • 移除的产物(可解释体积减少的原因)
  • 现有产物的体积变化

Step 3: Compare Top-Level Metrics

步骤3:对比核心指标

After fetching both bundles, compare:
MetricWhat to check
install_size
Flag if head is >5% larger
download_size
Flag if head is >5% larger
version
Note version changes
supported_platforms
Note platform changes
app_bundle_id
Should match between base and head
Compute deltas:
  • Install size delta:
    head_install_size - base_install_size
  • Download size delta:
    head_download_size - base_download_size
  • Percentage change:
    delta / base_size * 100
拉取两个应用包的信息后,对比以下内容:
指标检查要点
install_size
如果对比包体积超出基准包5%则标记
download_size
如果对比包体积超出基准包5%则标记
version
记录版本变化
supported_platforms
记录支持平台的变化
app_bundle_id
基准包和对比包的该字段应该一致
计算差值:
  • 安装体积差值:
    head_install_size - base_install_size
  • 下载体积差值:
    head_download_size - base_download_size
  • 变化百分比:
    delta / base_size * 100

Step 4: Analyze Size Changes

步骤4:分析体积变化

If size increased significantly (>5%):
  1. Check if
    version
    changed, which might explain expected size growth.
  2. Check if
    supported_platforms
    changed (adding a platform increases size).
  3. Look at the
    artifacts
    field in the bundle details for individual artifact sizes.
Common causes of size increases:
  • New frameworks or libraries added
  • Asset catalogs grew (new images, videos)
  • Unoptimized resources (large PNGs instead of compressed formats)
  • Debug symbols included in release builds
  • New localizations added
Common causes of size decreases:
  • Removed unused frameworks
  • Optimized assets
  • Tree shaking or dead code elimination improvements
  • Moved functionality to on-demand resources
如果体积增长明显(超过5%):
  1. 检查
    version
    是否变更,这可能是预期的体积增长原因。
  2. 检查
    supported_platforms
    是否变更(新增支持平台会增加体积)。
  3. 查看应用包详情中的
    artifacts
    字段,了解单个产物的体积。
体积增长的常见原因:
  • 新增了框架或依赖库
  • 资源包体积增大(新增图片、视频)
  • 资源未优化(使用未压缩的大PNG而非压缩格式)
  • Release构建中包含了调试符号
  • 新增了多语言支持
体积减少的常见原因:
  • 移除了未使用的框架
  • 资源优化
  • Tree shaking或dead code elimination优化
  • 将功能迁移到按需加载资源

Summary Format

总结格式

Produce a summary with:
  1. Overall verdict: Size increased, decreased, or stable.
  2. Install size: Absolute and percentage change.
  3. Download size: Absolute and percentage change.
  4. Version: Note if version changed.
  5. Platforms: Note any platform changes.
  6. Recommendations: Actionable next steps for size regressions.
Example:
Bundle Comparison: base (v2.1.0 on main) vs head (v2.2.0 on feature-x)

Install Size: 45.2 MB -> 52.8 MB (+16.8%) -- REGRESSION
Download Size: 28.1 MB -> 32.4 MB (+15.3%) -- REGRESSION
Version: 2.1.0 -> 2.2.0
Platforms: iOS, macOS (unchanged)

The install size increased by 7.6 MB. This is a significant increase
that may affect user download and storage experience.

Recommendations:
- Review new frameworks or assets added in this version
- Check for uncompressed resources or oversized image assets
- Consider using asset compression or on-demand resources
- Run `xcrun bitcode_strip` analysis to check for unnecessary bitcode
产出的总结需要包含以下内容:
  1. 整体结论:体积增长、减少或保持稳定。
  2. 安装体积:绝对值和百分比变化。
  3. 下载体积:绝对值和百分比变化。
  4. 版本:记录版本是否变更。
  5. 支持平台:记录平台的任何变化。
  6. 优化建议:针对体积回归的可落地后续步骤。
示例:
Bundle Comparison: base (v2.1.0 on main) vs head (v2.2.0 on feature-x)

Install Size: 45.2 MB -> 52.8 MB (+16.8%) -- REGRESSION
Download Size: 28.1 MB -> 32.4 MB (+15.3%) -- REGRESSION
Version: 2.1.0 -> 2.2.0
Platforms: iOS, macOS (unchanged)

The install size increased by 7.6 MB. This is a significant increase
that may affect user download and storage experience.

Recommendations:
- Review new frameworks or assets added in this version
- Check for uncompressed resources or oversized image assets
- Consider using asset compression or on-demand resources
- Run `xcrun bitcode_strip` analysis to check for unnecessary bitcode

Done Checklist

完成清单

  • Resolved both base and head bundles
  • Compared artifact trees using
    tuist bundle artifact list
  • Compared install and download sizes
  • Analyzed root causes of size changes
  • Provided actionable recommendations
  • 已解析基准包和对比包
  • 已使用
    tuist bundle artifact list
    对比产物树
  • 已对比安装体积和下载体积
  • 已分析体积变化的根本原因
  • 已给出可落地的优化建议