Skip to content

[Build] Link XCTest with Foundation [AsyncXCTest 5/6] #177

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 1 commit into from
Mar 8, 2016

Conversation

modocache
Copy link
Contributor

This is the fifth of six pull requests necessary to introduce asynchronous testing to swift-corelibs-xctest. All of its dependencies have been merged, so this is ready to be reviewed and merged itself.

In order to implement asynchronous tests, swift-corelibs-xctest will take on a dependency upon swift-corelibs-foundation. To properly link the two:

  • Allow the package manager to take a path to a Foundation build.
  • Add the Foundation and CoreFoundation directories to the swiftc include paths.
  • While we're at it, remove the SWIFTPM_EXTRA_IMPORTS hack in favor of -Xswiftc.

@@ -84,7 +84,12 @@ Tests are an important part of the development and evolution of this project,
and new contributions are expected to include tests for any functionality
change. To run the tests, pass the `test` verb to the `bootstrap` script:

./Utilities/bootstrap --build-tests test
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep the old version that doesn't require any parameter in the readme? By making tools simpler we can lover entrance barrier for contributors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the old version work? I was unable to get Utilities/bootstrap to succeed, even on master, without passing in --swiftc, --sbt, and --xctest. I think we should include these in the README today, not just when this pull request is merged.

I may be missing something, though. Is it possible to successfully run just Utilities/bootstrap test?

Copy link
Contributor

Choose a reason for hiding this comment

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

By default Utilities/bootstrap uses swiftc and other tools from the Toolchains specified in the PATH and it works for me with latest toolchain on MacOS at least.
On linux it could fail because of this #158

I think it wold be useful to have both options described in readme, because often you need to use swiftc from maser.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do! It definitely took me a while to figure out how to test SwiftPM (the test invocation in the Swift build script isn't straightforward either), and I think more docs could help.

//
// This should be fixed such that it does not rely upon environment
// variables.
if let includes = getenv("SWIFTPM_EXTRA_IMPORTS") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any particular reason why this hack couldn't already be scrapped and replaced with additional -Xswiftc (or -Xcc? I'm not sure I understand which should be used when) parameters. Similar to #172

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha! Good catch, I'll give that a try!

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 call, @briancroom! This pull request is much nicer now. 🎁

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 FIXMEs-=1!

@modocache modocache force-pushed the xctest-foundation-dependency branch 2 times, most recently from 4ee0afd to 541c666 Compare March 7, 2016 01:24
@modocache modocache changed the title [DO NOT MERGE][Build] Link XCTest with Foundation [Build] Link XCTest with Foundation [AsyncXCTest 5/6] Mar 7, 2016
@aciidgh
Copy link
Contributor

aciidgh commented Mar 8, 2016

👍

@modocache
Copy link
Contributor Author

@mxcl or @ddunbar, it'd be awesome to get your thoughts on this. 🙇

@modocache
Copy link
Contributor Author

Could someone in the Apple org kick off CI for this pull request? @mike-ferris-apple, do you have the permissions to do so?

In order to implement asynchronous tests, swift-corelibs-xctest
will take on a dependency upon swift-corelibs-foundation. To
properly link the two:

- Allow the package manager to take a path to a Foundation build.
- Add the Foundation and CoreFoundation directories to the swiftc
  include paths.
- While we're at it, remove the SWIFTPM_EXTRA_IMPORTS hack in
  favor of -Xswiftc.
@modocache modocache force-pushed the xctest-foundation-dependency branch from 541c666 to 1cabbde Compare March 8, 2016 20:41
@mxcl
Copy link
Contributor

mxcl commented Mar 8, 2016

@swift-ci Please test

@modocache
Copy link
Contributor Author

Yay, the tests passed!

Any thoughts on this direction, though? Is the SwiftPM team fine with XCTest taking on a Foundation dependency? It'd be pretty great if that's the case--I'd love to see this merged and async tests in XCTest shipped.

@mxcl
Copy link
Contributor

mxcl commented Mar 8, 2016

I'm fine with whatever the XCTest folks want to do. I don't intend to add Foundation to SwiftPM yet though, as I have enough rev lock issues as it stands!

mxcl added a commit that referenced this pull request Mar 8, 2016
[Build] Link XCTest with Foundation [AsyncXCTest 5/6]
@mxcl mxcl merged commit 1224b1b into swiftlang:master Mar 8, 2016
@modocache modocache deleted the xctest-foundation-dependency branch March 8, 2016 22:47
@modocache
Copy link
Contributor Author

@mxcl Awesome! Yes, I'd read your comments on not wanting to include Foundation in SwiftPM, and so wanted to make double sure you were OK with (or at least not in staunch opposition to) this direction for XCTest. Thanks for the feedback!! 🙇

aciidgh pushed a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
[BuildSystem] Add an experimental feature to expose both views of a s…
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