Skip to content

Comments

fix(cli): embed cached static xcframeworks with resources transitively#9419

Merged
pepicrft merged 4 commits intomainfrom
static-framework-with-resources
Feb 12, 2026
Merged

fix(cli): embed cached static xcframeworks with resources transitively#9419
pepicrft merged 4 commits intomainfrom
static-framework-with-resources

Conversation

@pepicrft
Copy link
Contributor

Summary

When tuist cache replaces a local static framework with a precompiled xcframework, the xcframework needs to be embedded in the app so its resources are accessible at runtime. The previous fix (5c3c85f) handled this for direct dependencies only. This PR extends the traversal to also find static xcframeworks that are transitive dependencies through other static targets, ensuring their resources are embedded in the host app.

The change switches from a direct-only dependency lookup to a recursive filterDependencies traversal that stops at dynamic targets and targets that can embed frameworks.

Test plan

  • Added unit test test_embeddableFrameworks_when_transitiveStaticXCFrameworkThroughStaticTarget
  • Existing test test_embeddableFrameworks_when_dependencyIsStaticXCFramework still passes (direct case)
  • Existing test test_embeddableFrameworks_when_dependencyIsTransitiveStaticXCFramework still passes (dynamic framework blocks traversal)
  • Existing acceptance test test_app_with_objc_static_framework_with_resources_from_cache covers the end-to-end cache flow

@dosubot dosubot bot added the size:M For issues that take a handful of hours to implement label Feb 11, 2026
@dosubot
Copy link

dosubot bot commented Feb 11, 2026

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@dosubot dosubot bot added the type:bug Something isn't working label Feb 11, 2026
@tuist
Copy link

tuist bot commented Feb 11, 2026

🛠️ Tuist Run Report 🛠️

Tests 🧪

Scheme Status Cache hit rate Tests Skipped Ran Commit
TuistCacheEEAcceptanceTests 74 % 14 0 14 544142c5b
TuistCacheEEUnitTests 74 % 119 0 119 02a906fb8
TuistDependenciesAcceptanceTests 76 % 18 0 18 544142c5b
TuistGeneratorAcceptanceTests 76 % 73 0 73 544142c5b
TuistKitAcceptanceTests 76 % 44 0 44 02a906fb8
TuistUnitTests 76 % 2207 1 2206 544142c5b

Builds 🔨

Scheme Status Duration Commit
TuistAutomationAcceptanceTests 1m 58s 544142c5b
TuistCacheEEAcceptanceTests 45.5s 544142c5b
TuistCacheEEUnitTests 51.1s 544142c5b
TuistDependenciesAcceptanceTests 3m 17s 544142c5b
TuistGeneratorAcceptanceTests 2m 31s 544142c5b
TuistKitAcceptanceTests 2m 32s 02a906fb8
TuistUnitTests 1m 49s 544142c5b

@pepicrft pepicrft self-assigned this Feb 11, 2026
@pepicrft pepicrft requested review from a team, cschmatzler and fortmarek and removed request for a team February 11, 2026 12:29
let got = subject.embeddableFrameworks(path: project.path, name: app.name).sorted()

// Then
XCTAssertEqual(got, [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This embeds both, the product of the static framework (direct dependency), and the transitive static XCFramework

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 11, 2026
The previous fix (5c3c85f) only checked direct dependencies for
static xcframeworks needing embedding. When a cached static xcframework
with resources was a transitive dependency through another static
target, it was not embedded and its resources were inaccessible at
runtime.

Switch from a direct-only lookup to a recursive filterDependencies
traversal that stops at dynamic targets and targets that can embed
frameworks. This ensures static xcframeworks with .framework bundles
are embedded regardless of their position in the dependency chain.
The staticXCFrameworksWithResources traversal was not skipping macro
targets, causing their transitive xcframework dependencies (like
SwiftSyntax) to be incorrectly embedded in the app bundle.
…n canary tests

The canary test trait was running OrganizationCreateCommand before
overwriting the fixture's Tuist.swift with the correct server URL.
Fixtures like generated_project_with_caching_enabled have
url: "http://localhost:8080" hardcoded, causing notAuthenticated
errors in CI where no local server exists.
@pepicrft pepicrft force-pushed the static-framework-with-resources branch from aec4d4d to 9f1c636 Compare February 12, 2026 11:21
@pepicrft pepicrft merged commit a80615d into main Feb 12, 2026
19 of 20 checks passed
@pepicrft pepicrft deleted the static-framework-with-resources branch February 12, 2026 11:24
pepicrft added a commit that referenced this pull request Feb 13, 2026
This reverts the static framework resource embedding feature that was
introduced across multiple PRs (#9081, #9141, #9210, #9240, #9317,
#9382, #9419 and related fixes). Resources for static frameworks go
back to being placed in separate .bundle targets instead of being
embedded inside the framework itself.

The cache version is bumped to invalidate artifacts built with the
old embedding approach.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M For issues that take a handful of hours to implement type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants