Skip to content

Comments

fix(cli): restore static framework resources without regressions#9081

Merged
pepicrft merged 14 commits intomainfrom
fix/static-framework-resources
Jan 13, 2026
Merged

fix(cli): restore static framework resources without regressions#9081
pepicrft merged 14 commits intomainfrom
fix/static-framework-resources

Conversation

@pepicrft
Copy link
Contributor

@pepicrft pepicrft commented Jan 9, 2026

Summary

  • Restore static framework resource handling so resources stay on the framework target and Xcode can synthesize asset types.
  • Fix static framework bundle accessors (Swift + ObjC) to search framework/app bundle locations with a safe fallback.
  • Add acceptance fixture/test for local SPM dependency with asset catalogs to prevent regressions.

Testing

  • mise x -- tuist test TuistGeneratorAcceptanceTests (completed; test action reported no tests to run in this scheme)

Related

@dosubot dosubot bot added the size:XL For issues that need several days to implement label Jan 9, 2026
@dosubot
Copy link

dosubot bot commented Jan 9, 2026

Related Documentation

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

How did I do? Any feedback?  Join Discord

@dosubot dosubot bot added domain:generated-projects Issues related to the project-generation features type:bug Something isn't working labels Jan 9, 2026
@pepicrft pepicrft changed the title fix: restore static framework resources without regressions fix(cli): restore static framework resources without regressions Jan 9, 2026
@tuist
Copy link

tuist bot commented Jan 9, 2026

🛠️ Tuist Run Report 🛠️

Previews 📦

App Commit Open on device
Tuist 8418865b2

Tests 🧪

Scheme Status Cache hit rate Tests Skipped Ran Commit
TuistApp 77 % 21 0 21 3bd0ce070
TuistAutomationAcceptanceTests 77 % 33 0 33 cb33c450b
TuistCacheEEAcceptanceTests 75 % 11 0 11 8418865b2
TuistCacheEEUnitTests 75 % 109 0 109 3bd0ce070
TuistDependenciesAcceptanceTests 77 % 16 0 16 8418865b2
TuistGeneratorAcceptanceTests 77 % 71 0 71 8418865b2
TuistKitAcceptanceTests 77 % 46 0 46 8418865b2
TuistUnitTests 77 % 1040 22 1018 8418865b2

Builds 🔨

Scheme Status Duration Commit
TuistApp 3m 36s 8418865b2
TuistAutomationAcceptanceTests 2m 17s 8418865b2
TuistCacheEEAcceptanceTests 33.2s 8418865b2
TuistCacheEEUnitTests 2m 9s 3bd0ce070
TuistDependenciesAcceptanceTests 1m 31s 8418865b2
TuistGeneratorAcceptanceTests 2m 21s 8418865b2
TuistKitAcceptanceTests 2m 0.3s 8418865b2
TuistUnitTests 46.0s 8418865b2

Bundles 🧰

Bundle Commit Install size Download size
Tuist 8418865b2
25.9 MB
Δ -583.8 KB (-2.20%)
14.3 MB
Δ -183.4 KB (-1.26%)

@pepicrft pepicrft requested review from a team, cschmatzler and fortmarek and removed request for a team January 9, 2026 14:38
@pepicrft pepicrft self-assigned this Jan 9, 2026
Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

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

Manually tested this with the generated_ios_app_with_static_frameworks_with_resources and generated_local_spm_dependency_with_assets examples and, including caching, everything looked good.

I think this one is worth writing a short community post for and post it in #general, as the change is significant enough that we want folks to be aware of it.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 9, 2026
@nicorichard
Copy link

I've been looking at Tuist for our very large brownfield project. We use local swift packages as the vehicle for modularity, and also happen to use generated accessors across many different modules.

This will do so much towards allowing us to evaluate Tuist without bloodshed. Thank you.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL For issues that need several days to implement labels Jan 13, 2026
@pepicrft pepicrft force-pushed the fix/static-framework-resources branch from 1d97088 to 81a997b Compare January 13, 2026 09:12
@dosubot dosubot bot added size:L For issues that take up to a day to implement and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Jan 13, 2026
@pepicrft
Copy link
Contributor Author

I've been looking at Tuist for our very large brownfield project. We use local swift packages as the vehicle for modularity, and also happen to use generated accessors across many different modules.

@nicorichard I'll have this one merged today ;)

@dosubot dosubot bot added size:XL For issues that need several days to implement and removed size:L For issues that take up to a day to implement labels Jan 13, 2026
@pepicrft pepicrft merged commit 6d931fb into main Jan 13, 2026
18 of 22 checks passed
@pepicrft pepicrft deleted the fix/static-framework-resources branch January 13, 2026 18:02
@nicorichard
Copy link

nicorichard commented Jan 13, 2026

Just reporting back to say that I pulled the new release (CLI 4.122.2) and my codebase just ran its first successful build using a Tuist generated project 🎉

@adarhef
Copy link

adarhef commented Jan 15, 2026

@pepicrft @fortmarek Thank you for doing this! I've been waiting for this for a long time.

After testing this change I spotted a couple of issues I think you might want to take a look at though.

One thing is I think there's an issue with the generated module Bundle extension in unit tests.
The check for canImport(XCTest) fails when running from a test target even if it explicitly depends on xctest. It only passes if the main target depends on xctest. I think a more robust choice would be to check if ProcessInfo.processInfo.processName == "xctest".
If I manually change the check so it passes, the logic for stepping outside into the build folder to find the bundle seems incorrect as well.
I think Bundle(for: UnitTestBundleFinder.self) seems to return the main bundle in a static framework (which is the test bundle in an XCTest). Then resourceURL?.appendingPathComponent("..") steps out one level from the Resources folder, which puts you in the Contents folder of the test bundle.
If we start with the bundleURL.appending(component: ".."), it finds the framework successfully from a unit test.

Another issue seems to be with Metal files in a static framework. A framework with Metal files will also contain a default.metallib as a generated resource, therefore the framework needs to be copied into the app bundle, but it currently isn't.

@pepicrft
Copy link
Contributor Author

Thanks @adarhef. I'm taking a look at it.

@barbaramartina
Copy link

Hello. Would some of you help me with a link to documentation about how to set the resources synthesiser?
Unfortunately Strings catalog resources are not generated. I read that as long as string catalogs are in the resources configured folder, Tuist should automatically generate accessors.
Is that correct?

This is my configuration:

  • Tuist CLI 4.130.2
  • Static frameworks
  • String catalogs under Resources folder
  • String catalogs are properly included in the Bundle Copy phase of the framework.
  • if I use String(localized: “my.string.key”, bundle: .module) the translation is properly read
  • I can not use Text(MyFrameworkNameReources.Strings.myStringkey) since Strings are not generated at all.

If someone could hint me with ideas that would be great.

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:generated-projects Issues related to the project-generation features lgtm This PR has been approved by a maintainer size:XL For issues that need several days to implement type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XcodeProj: Unable to build main target with local SPM dependency with Image assets

5 participants