Skip to content

Comments

fix(cli): correct static xcframework paths when depending on cached targets#9203

Merged
fortmarek merged 8 commits intomainfrom
fix/static-xcframework-paths-with-cached-targets
Jan 22, 2026
Merged

fix(cli): correct static xcframework paths when depending on cached targets#9203
fortmarek merged 8 commits intomainfrom
fix/static-xcframework-paths-with-cached-targets

Conversation

@fortmarek
Copy link
Member

Summary

  • Fixes incorrect HEADER_SEARCH_PATHS and FRAMEWORK_SEARCH_PATHS being generated when an app depends on a cached framework target at a different project path
  • The bug occurred when: App → Cached framework target (at different path) → Dynamic xcframework → Static xcframework
  • Paths were incorrectly calculated relative to the cached target's location instead of the app's project

Changes

  1. GraphTraverser: Modified precompiledDynamicLibrariesAndFrameworks to also traverse target dependencies when looking for precompiled dynamic frameworks. This ensures xcframeworks are found through the entire dependency chain, not just direct dependencies.

  2. StaticXCFrameworkModuleMapGraphMapper: Added a check to skip combining settings from target dependencies at different project paths, since path-based settings would be incorrect for the current target.

Test plan

  • Added test_map_when_static_xcframework_linked_via_target_with_dynamic_xcframework_dependency to verify the fix
  • Added additional tests for cached xcframework scenarios at different paths
  • All existing tests pass

🤖 Generated with Claude Code

…argets

When an app depends on a cached framework target (at a different project
path), and that target depends on a dynamic xcframework which depends on
a static xcframework, the static xcframework's paths were incorrectly
calculated relative to the cached target's project path instead of the
app's project path.

This fix:
1. Modifies GraphTraverser to also traverse target dependencies when
   looking for precompiled dynamic frameworks, ensuring xcframeworks
   are found through the entire dependency chain.
2. Prevents combining settings from target dependencies at different
   project paths, since path-based settings would be incorrect.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dosubot dosubot bot added size:XL For issues that need several days to implement domain:generated-projects Issues related to the project-generation features p2 Should do type:bug Something isn't working labels Jan 21, 2026
@tuist
Copy link

tuist bot commented Jan 21, 2026

🛠️ Tuist Run Report 🛠️

Tests 🧪

Scheme Status Cache hit rate Tests Skipped Ran Commit
TuistCacheEEAcceptanceTests 60 % 14 0 14 e9d4bfe51
TuistCacheEEUnitTests 60 % 110 0 110 697437937
TuistDependenciesAcceptanceTests 61 % 16 0 16 e9d4bfe51
TuistGeneratorAcceptanceTests 61 % 71 0 71 e9d4bfe51
TuistKitAcceptanceTests 61 % 46 0 46 697437937
TuistUnitTests 61 % 471 23 448 03dbed639

Builds 🔨

Scheme Status Duration Commit
TuistAutomationAcceptanceTests 3m 29s e9d4bfe51
TuistCacheEEAcceptanceTests 50.7s e9d4bfe51
TuistCacheEEUnitTests 3m 10s 697437937
TuistDependenciesAcceptanceTests 3m 19s e9d4bfe51
TuistGeneratorAcceptanceTests 3m 28s e9d4bfe51
TuistKitAcceptanceTests 4m 6s e9d4bfe51
TuistUnitTests 41.5s 03dbed639

fortmarek and others added 2 commits January 22, 2026 08:43
…argets

Instead of skipping settings from cached targets at different project paths,
transform $(SRCROOT)-relative paths to be relative to the current target's
project. This ensures proper path resolution for HEADER_SEARCH_PATHS,
FRAMEWORK_SEARCH_PATHS, OTHER_C_FLAGS, and OTHER_SWIFT_FLAGS when depending
on cached framework targets that have static xcframework dependencies.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The fix is contained entirely in StaticXCFrameworkModuleMapGraphMapper.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
self == "-enable-experimental-feature"
}

fileprivate func resolvingSrcRootPath(
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't there an API in AbsolutePath to calculate the relative path?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, but the setting is a string, but I'm rewriting this a little bit.

Copy link
Contributor

@pepicrft pepicrft left a comment

Choose a reason for hiding this comment

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

The code and test cases look accurate.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 22, 2026
fortmarek and others added 5 commits January 22, 2026 11:53
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Address PR review feedback by using a more path-based approach instead of regex.
The implementation now splits the string at $(SRCROOT)/, uses RelativePath and
AbsolutePath APIs for the transformation, and reconstructs the string.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fix bug where $(SRCROOT) wasn't found because it was prefixed with a quote
character after splitting by /. Now properly handles the prefix and suffix
around the SRCROOT marker.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Switch lint job to namespace-profile-default-macos for faster execution.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@fortmarek fortmarek merged commit db85804 into main Jan 22, 2026
12 of 14 checks passed
@fortmarek fortmarek deleted the fix/static-xcframework-paths-with-cached-targets branch January 22, 2026 11:54
fortmarek added a commit that referenced this pull request Feb 19, 2026
PR #9446 (revert static framework resource embedding) accidentally
removed the resolvingSrcRootPaths logic from PR #9203 that corrects
$(SRCROOT)-relative paths when propagating settings from cached targets
at different project paths.

Without this fix, FRAMEWORK_SEARCH_PATHS and HEADER_SEARCH_PATHS
for external static xcframeworks are computed relative to the cached
target's location (.cache/tuist/Binaries/HASH/) instead of the
consuming app's project directory, producing broken paths.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
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 p2 Should do 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.

2 participants