Build macOS frameworks in the versioned bundle layout #3084
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 599 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.383
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3084"
general
weight: 0.35
aaronsky
<!-- ccr-projects-attribution: {"github_login":"rickmark"} -->
_Requested by Rick_
Problem
macos_frameworkandmacos_dynamic_frameworkbuild flat bundles, iOS style: the binary,Info.plist,Headers,Modulesand resources all sit at the top ofFoo.framework. macOS frameworks are versioned bundles (Apple's Anatomy of Framework Bundles): the contents live inVersions/A,Versions/Currentlinks toA, and each top-level entry is a link toVersions/Current/<entry>.dyld,
codesign --verify --deep --strictand notarization all accept a flat framework. App Store Connect rejects an app that embeds one:So today a Mac App Store app can't ship a framework built by rules_apple.
Change
macOS frameworks are now built in the versioned layout. It's the default for every macOS framework, with no opt-in, because the flat layout isn't valid on macOS.
rule_support.bzl:_describe_bundle_locationsgainsbundle_version. The macOS framework descriptor usesVersions/Aas its contents directory, with resources inResources.processor.bzl: in a versioned bundle, files placed at the bundle root (Headers, Modules) go in the version directory. The control file lists the links to create:Versions/Current -> A, plus<entry> -> Versions/Current/<entry>for each top-level entry of the version._CodeSignatureis left out; codesign writes it inside the version.bundletool.pyandbundletool_experimental.py: a newbundle_symlinkscontrol key.bundletool.pywrites zip symlink entries; tree-artifact mode writes real links through the existing_write_symlink, with its bundle-escape checks.partials/resources.bzl: the rootInfo.plistgoes inVersions/A/Resources.macos_rules.bzl: the install name is@rpath/<Name>.framework/Versions/A/<Name>, which is what Xcode sets.Existing paths such as
Foo.framework/FooandFoo.framework/Headers/...still resolve, through the top-level links.Foo.framework/Info.plistand root-level resources move underResources/.Tests
test/starlark_tests/macos_framework_tests.bzlandmacos_dynamic_framework_tests.bzlnow expect:-
Info.plistand resources underResources/;- the versioned install name, both in the framework's
LC_ID_DYLIBand in apps'LC_LOAD_DYLIB.The
not_containsassertions moved to the new locations as well, so they still test something.verifier_scripts/versioned_framework_verifier.shchecks:-
Versions/Ais a real directory;-
Versions/Current -> A;- the binary is in
Versions/A, with a link at the top;-
Info.plistis inVersions/A/Resources;- every top-level entry except
Versionsis a link intoVersions/Current.It runs as
macos_framework_versioned_bundle_layout_testandmacos_dynamic_framework_versioned_bundle_layout_test.bundletool_testandbundletool_experimental_testcoverbundle_symlinks.On macOS (Xcode 26), all 169 tests in these targets pass:
On main without this change, 21 of the macOS framework tests fail against the new expectations. They were written for the flat layout.
I also checked a real app outside the test suite: an app embedding a
macos_frameworkbuilt with this change (applied to rules_apple 5.1.0, where it applies unchanged), archived for the Mac App Store. It passed App Store Connect validation.codesign --verify --deep --strictpassed on the archived app, and the app launched.I did not add a tree-artifact variant of the verifier test. I checked the tree-artifact output by hand and the links are real. But the test harness dereferences them when it stages a tree artifact into the sandbox, so the test can't see them.
A gap for reviewers
apple_xcframeworkgoes through the same processor. Its macOS slice now gets the versioned layout too, which matches Xcode-built XCFrameworks. Its install name, though, stays@rpath/<Name>.framework/<Name>: the rule links every platform with one set ofextra_linkopts, so the macOS slice can't get a different-install_namewithout per-platform linkopts. That name still resolves through the top-level link. I kept this PR to the macOS framework rules. I'm happy to add per-platform install names here, or in a follow-up, if you'd like.🤖 Generated with Claude Code