Skip to content

Comments

fix(cli): fix bundle accessor for Obj-C external static frameworks with resources#9210

Merged
pepicrft merged 4 commits intomainfrom
fix/external-static-framework-bundle-accessor
Jan 22, 2026
Merged

fix(cli): fix bundle accessor for Obj-C external static frameworks with resources#9210
pepicrft merged 4 commits intomainfrom
fix/external-static-framework-bundle-accessor

Conversation

@pepicrft
Copy link
Contributor

@pepicrft pepicrft commented Jan 22, 2026

Summary

This PR fixes the BundleNotFound exception for external packages configured as static frameworks with resources (like SVProgressHUD or CLImageEditor).

What changed

  1. Aligned local and external static framework embedding: External static frameworks with resources are now embedded, just like local ones. Previously, I had reverted embedding for external dependencies thinking it was causing issues, but the actual problem was that the Info.plist generated for those frameworks had an incorrect bundle identifier.

  2. Simplified bundle generation logic: Static frameworks (both local and external) no longer generate separate resource bundles. Resources stay inside the framework, which gets embedded.

  3. Updated the Obj-C bundle accessor: The accessor now mirrors SwiftPM's approach while adding Tuist-specific framework locations. It first checks for embedded .framework bundles (where Tuist places resources for static frameworks), then falls back to looking for .bundle files (SwiftPM's standard approach). This maintains backward compatibility while supporting Tuist's static framework resource embedding.

Assumptions

This assumes that external dependencies are using the generated bundle accessor to find their resources, which is a safe assumption since that's how SwiftPM packages access their resources.

Test plan

  • Added an acceptance test fixture with SVProgressHUD configured as a staticFramework to prevent regressions

Closes #9156

@dosubot dosubot bot added size:L For issues that take up to a day to implement domain:dependencies For issues and PRs related to integrating third-party dependencies type:bug Something isn't working labels Jan 22, 2026
@tuist
Copy link

tuist bot commented Jan 22, 2026

🛠️ Tuist Run Report 🛠️

Tests 🧪

Scheme Status Cache hit rate Tests Skipped Ran Commit
TuistCacheEEAcceptanceTests 60 % 14 0 14 189ee3d20
TuistCacheEEUnitTests 60 % 110 0 110 d3b9bbe13
TuistDependenciesAcceptanceTests 61 % 17 0 17 79417f9f2
TuistGeneratorAcceptanceTests 61 % 71 0 71 79417f9f2
TuistKitAcceptanceTests 0 % 46 0 46 79417f9f2
TuistUnitTests 61 % 1037 22 1015 ef3981845

Builds 🔨

Scheme Status Duration Commit
TuistAutomationAcceptanceTests 2m 17s 79417f9f2
TuistCacheEEAcceptanceTests 38.8s 79417f9f2
TuistCacheEEUnitTests 2m 39s d3b9bbe13
TuistDependenciesAcceptanceTests 2m 19s 79417f9f2
TuistGeneratorAcceptanceTests 2m 4s 79417f9f2
TuistKitAcceptanceTests 2m 9s 79417f9f2
TuistUnitTests 44.4s ef3981845

@pepicrft pepicrft force-pushed the fix/external-static-framework-bundle-accessor branch from 858ffee to 254c196 Compare January 22, 2026 10:54
if target.product.isDynamic { return true }
if target.product == .staticFramework, target.containsResources || target.containsMetalFiles {
return graphTarget.project.type == .local
return true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As mentioned in the description, I wrongly assumed that the issue that we had with external packages was not a bug but some assumptions in third-party packages regarding how bundles are accessed, but it turned out that wasn't the case, and it was just how we generated the Info.plist, so I'm reverting it.

…th resources

The Obj-C bundle accessor was failing to find resource bundles at runtime
for external packages configured as static frameworks. This happened because
the accessor was only searching for standalone .bundle files, not for bundles
embedded inside the framework directory.

When an external Obj-C package (like SVProgressHUD) is configured as a
staticFramework, its resources are placed inside the framework at
<Framework.framework>/<Target.bundle>. The accessor now searches this
path first before falling back to standalone bundle locations.

Closes #9156
@pepicrft pepicrft force-pushed the fix/external-static-framework-bundle-accessor branch from 254c196 to 2906a73 Compare January 22, 2026 11:01
…static frameworks

- Align ObjC bundle accessor with SwiftPM's approach while supporting Tuist's embedded framework resources
- Update unit test to expect external static frameworks with resources to be embeddable
- Fix linting issues
try await setUpFixture("generated_app_with_objc_static_framework_with_resources")
try await run(InstallCommand.self)
try await run(GenerateCommand.self)
try await run(BuildCommand.self, "App")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to find a way to run the app and check that it doesn't blow up.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 22, 2026
- Add back the #import "TuistBundle+<target>.h" header that was accidentally removed
- Update ViewController to load SVProgressHUD resources on launch
- Update acceptance test to run the app on simulator and verify it doesn't crash
@pepicrft pepicrft merged commit fa465f1 into main Jan 22, 2026
16 of 18 checks passed
@pepicrft pepicrft deleted the fix/external-static-framework-bundle-accessor branch January 22, 2026 18:33
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

domain:dependencies For issues and PRs related to integrating third-party dependencies lgtm This PR has been approved by a maintainer size:L For issues that take up to a day to implement type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BundleNotFound exception for StaticFrameworks since 4.128.2

2 participants