Skip to content

Conversation

@fortmarek
Copy link
Member

@fortmarek fortmarek commented Feb 13, 2025

This PR adds new functionality to XcodeGraphMapper that converts local package targets referenced by the Xcode project to Xcode targets. This translation is lossy in some cases – in other words, the Target representation is not a perfect representation of the package target.

However, it's been the most straightforward way to unlock selective testing or tuist graph to be usable also for local packages.

The alternative to mapping a SwiftPM target to an Xcode target was to modify Graph to not only hold projects, but also localPackages. The models in the localPackages property would then be idiomatic to SwiftPM. However, in tuist/tuist, this would mean a ton of refactoring to bring selective testing and graph for that part of the graph – as the graphTraverser currently works only with Xcode Targets.

We can still consider doing that down the line, but I believe the current strategy brings the most value while being a good enough approximation of the SwiftPM part of the graph.

@fortmarek fortmarek force-pushed the feat/local-package-mapping branch 2 times, most recently from 0f53da1 to ccb443c Compare February 14, 2025 09:46
Base automatically changed from fix/map-xctestplan to main February 14, 2025 09:54
@fortmarek fortmarek force-pushed the feat/local-package-mapping branch 5 times, most recently from 462e749 to c1703c8 Compare February 14, 2025 12:25
@fortmarek fortmarek force-pushed the feat/local-package-mapping branch from c1703c8 to 7c326d6 Compare February 14, 2025 14:24
packages: [String: AbsolutePath],
path: AbsolutePath
) async throws -> Target {
// Some of the products, such as "regular" are approximations until XcodeGraph supports these SwiftPM-specific products
Copy link
Member Author

Choose a reason for hiding this comment

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

This is probably the weakest part of the PR. It might have been better to completely skip some targets like .plugin, but then they would not be represented for the hashing that should happen in selective testing. I'd rather not have ideal mapping here than skip those targets.

@fortmarek fortmarek marked this pull request as ready for review February 14, 2025 14:33
Copy link
Member Author

Choose a reason for hiding this comment

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

This is taken from tuist/tuist where it will be removed in favor of the definition here.

@fortmarek fortmarek merged commit 6b3571d into main Feb 17, 2025
7 checks passed
@fortmarek fortmarek deleted the feat/local-package-mapping branch February 17, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants