apple_thinned_package

Device-specific Apple application archive.

Description#

Produces an application archive thinned for one Apple device model. The target accepts one device build from apple_application, runs Xcode's thinning tool, re-signs the resulting bundle with an ad-hoc signature, and packages it in an archive with the .ipa extension.

This target is intended for services such as Sentry application size analysis, which expects the application to be thinned before upload. One target produces variants for one device model so each model has an independent cache key.

Attributes#

AttributeTypeRequiredDefaultDescription
device_modelstringyesOne non-empty Apple device model identifier, such as iPhone17,1; all is reserved (not configurable)

Dependency Edges#

EdgeAcceptsDescription
depsapple_applicationExactly one device application to thin and package

The application must set platform = "ios" and sdk_variant = "device". Simulator and desktop applications fail during graph analysis.

Providers#

The target emits apple_thinned_package.

Capabilities#

CapabilityOutput groupsRequires
builddefault, ipas, manifest

Outputs#

OutputLocation
Device-specific archives.once/out/<target>/ipas/*.ipa
Package manifest.once/out/<target>/thinned-packages.json

Archive names contain the product and device model. Runs of characters outside English letters, numbers, ., _, and - become one -, and leading or trailing hyphens are removed. For example, iPhone17,1 becomes iPhone17-1. When Xcode returns multiple records, every archive receives a one-based suffix such as -1 or -2.

The manifest uses the once.apple.thinned-package.v1 schema. It records the requested device model, every generated archive, and the installation targets reported by Xcode without retaining Xcode's host-specific temporary paths.

Example#

toml
[[target]]
name = "HelloDevice"
kind = "apple_application"
srcs = ["Sources/**/*.swift"]
[target.attrs]
platform = "ios"
sdk_variant = "device"
bundle_id = "dev.once.Hello"
minimum_os = "17.0"
[[target]]
name = "HelloSizeAnalysis"
kind = "apple_thinned_package"
deps = ["./HelloDevice"]
[target.attrs]
device_model = "iPhone17,1"

Build the archive with:

bash
once build apps/Hello/HelloSizeAnalysis

Limitations#

The output is ad-hoc signed for size analysis. It is not a distribution-signed archive and cannot replace the provisioning and signing flow used to install an application on physical devices or submit it to an application store.

Xcode exposes thinning through ipatool, an internal interface that may change between Xcode releases. Once validates that the requested model produced a variant, includes the Xcode build version in the action cache identity, and fails without emitting a universal archive when thinning produces no match.