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
Wrong source file filtering when source directory contains a subdirectory with name ends with Target.validSourceExtensions
#6186
Comments
Hey 👋 Yeah, that looks like a valid issue (I'm still being surprised every day by some of the decisions of package authors). Would you want to take a look? I wouldn't fix this at the |
Can't we check whether it's a file or a directory rather than relying on case? |
Yeah, we can, that's what I said we could also do 😄 I'm not sure how fast the If SPM/Xcode pick up files with |
I would probably do it directly in |
What happened?
Adding https://github.com/approvals/ApprovalTests.Swift as an external dependency via
Tuist/Package.swift
causestuist generate
to fail with error below.The package has a subdirectory named
ApprovalTests.Swift
under source root and Tuist considers this subdirectory as one of the source files. This is because Tuist filters source files with case insensitivepath.extension
compare and the directory nameApprovalTests.Swift
meets this requirement.This leads to an unintended early return in
ProjectFileElement.addElement
function since the pathTuist/.build/checkouts/ApprovalTests.Swift/ApprovalTests.Swift
has been already added to theelements
dictionary as a source file. And thus, the source files underApprovalTests.Swift
directory are being ignored and not added to theelements
dictionary.Adding a guard statement to filter out paths that are folders solves the problem but I'm not sure if this is the best place to filter invalid source file paths.
How do we reproduce it?
Tuist/Package.swift
ApprovalTest.Swift
as an external dependency to one of project targets.tuist install
tuist generate
Error log
macOS version
14.4.1
Tuist version
4.9.0
Xcode version
15.0
The text was updated successfully, but these errors were encountered: