Skip to content
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

Allow any "Tests"-suffixed directories to be ignored from swift build. #16

Closed
wants to merge 1 commit into from

Conversation

inamiy
Copy link

@inamiy inamiy commented Dec 4, 2015

According to Documentation/SourceLayouts.md, only directory named "Tests" can be ignored from swift build, but Xcode normally generates directory name e.g. MyFrameworkTests, and I want to ignore this as well.

BTW, it will be even better if we can specify test directory names in Package.swift 😊

natestedman added a commit to natestedman/Result that referenced this pull request Dec 4, 2015
If this pull request is merged into the Swift
build tool:

swiftlang/swift-package-manager#16

This commit can be reverted.
@natestedman
Copy link

In general, the ability to filter arbitrary directories would be useful - for example, the package manager currently considers a Carthage directory to be a package, and attempts to build it. This goes... poorly.

Unless this is intentional, and the desired practice is to put files in Sources if you have .swift files anywhere else that you don't want built. That's reasonable, "one and only one obvious way", etc.

natestedman added a commit to natestedman/ReactiveCocoa that referenced this pull request Dec 4, 2015
If this pull request is merged into the Swift
build tool:

swiftlang/swift-package-manager#16

This commit can be reverted.
@mxcl
Copy link
Contributor

mxcl commented Dec 4, 2015

BTW, it will be even better if we can specify test directory names in Package.swift

The ability to exclude is planned.

Probably this is a correct route however, but I'd like to stew on it and involve @ddunbar in the discussion.

@emish
Copy link
Contributor

emish commented Dec 4, 2015

I think it would be interesting for the "Tests" directory to be the canonical location for test targets and source files.

@mattt
Copy link
Contributor

mattt commented Dec 4, 2015

I agree with @emish, that specifying Tests as the canonical location for all tests for a package is a good convention to have. It's simple, easy to explain, and creates symmetry with the Sources directory convention. Multiple groups of tests of additional subdivisions should be something handled by configuration in the manifest.

The logic for checking for the existence of a suffix gets complicated quickly, as it would need to accept or reject different cases ("Tests" / "tests" / "TESTS") in a way that is consistent with substrings ("Contests" vs. "ConTests" vs. "CONTests"... which ones create a module, and which ones become tests?). Rather than go to the trouble of worrying about all of the possible ways this could break, it's much better for both the developer and the end user to set a simple default convention and provide a way to configure around it.

@mxcl
Copy link
Contributor

mxcl commented Dec 4, 2015

In the interest of backwards compatibility with how Xcode tends to encourage layout of files, and considering the huge number of Xcode projects out there that are almost in the right shape, I think we should have some support for this, even if it is opt-in in some easy-ish manner.

@inamiy
Copy link
Author

inamiy commented Dec 5, 2015

Thank you for reply.
As @mattt points out, this patch will increase complexity, so please feel free to close this issue once backward compatibility is supported.

P.S.
Though this may be another topic, I also want future Xcode to generate swift-package-manager-flavored directory structure by default. Would you take this into consideration as well?

@mattt
Copy link
Contributor

mattt commented Dec 5, 2015

@mxcl That's a very good point. One possible solution would be to delegate responsibility for migrating Xcode projects to Xcode itself. This has the advantage of allowing Xcode to make better decisions based on its own knowledge of existing test targets and the directories they use.

@mxcl
Copy link
Contributor

mxcl commented Dec 7, 2015

I think the way we should do this is to have an exclusion mechanism, and asap.

@mxcl mxcl closed this Dec 7, 2015
natestedman added a commit to natestedman/Result that referenced this pull request Dec 22, 2015
If this pull request is merged into the Swift
build tool:

swiftlang/swift-package-manager#16

This commit can be reverted.
aciidgh pushed a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
sergiocampama pushed a commit that referenced this pull request Apr 20, 2020
Sync with SwiftPM trunk
MaxDesiatov pushed a commit to MaxDesiatov/swift-package-manager that referenced this pull request Jul 6, 2020
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.

5 participants