Skip to content

feat: Add Target.validatedSources to filter the sources that are invalid #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2025

Conversation

pepicrft
Copy link
Contributor

Tuist was previously using Target.supportsSources to check whether a target supports or not sources, but it turns out it's not just a binary decision based on the product. For instance, .metal files can be added as sources to bundle targets.

This PR deprecates Target.supportsSources in favor of a more flexible alternative, Target.validatedSources.

@pepicrft pepicrft requested review from fortmarek and a team March 13, 2025 14:40
@pepicrft pepicrft self-assigned this Mar 13, 2025
@pepicrft pepicrft requested review from waltflanagan and removed request for a team March 13, 2025 14:40
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Mar 13, 2025
Comment on lines 221 to 224
/// This function validates the sources against other target metadata returning which sources from the list
/// are valid and invalid.
/// - Returns: A list of valid and invalid sources.
public func validatedSources() -> (valid: [SourceFile], invalid: [SourceFile]) {
Copy link
Member

Choose a reason for hiding this comment

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

wdyt about moving this to tuist/tuist instead? I don't see this as high value having in XcodeGraph and any convenience function we end up having here means we need to keep backwards compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I removed it from here and marked the existing supportsSources as deprecated.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Mar 18, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 18, 2025
@pepicrft pepicrft force-pushed the validated-sources branch from af21ee5 to c285443 Compare March 19, 2025 13:56
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 19, 2025
@pepicrft pepicrft merged commit dcd44e7 into main Mar 19, 2025
6 of 7 checks passed
@pepicrft pepicrft deleted the validated-sources branch March 19, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants