Skip to content

Osx build script #34

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

Closed
wants to merge 3 commits into from
Closed

Osx build script #34

wants to merge 3 commits into from

Conversation

dunkelstern
Copy link

This adds OSX support to the build_script.py to allow using the same tests on OSX as on Linux.

Added paragraph to Readme with build instructions on OSX.

--test won't work on OSX currently, use the Xcode test target for testing on OSX

@mike-ferris
Copy link

Why not use Xcode (or xcodebuild) on OS X? I am reluctant to take a lot of change to support different ways of building and testing this on OS X, especially since there's no real intent for this library to actually be used on OS X. Having the Xcode project is a nice convenience for working on this for those of us who spend most of our time in OS X, even though the project itself is really meant for use on Linux. But I guess I am curious what problem adding this support to the build script is solving.

@dunkelstern
Copy link
Author

There is a simple intent: just having a unified build system on OSX and Linux.

If I want to implement tests that run on linux I have to use this XCTest library, if i try to run the same tests on OSX it fails because XCTest on OSX is not the same lib as XCTest on Linux.

Primarily I want my swift build command that builds a testing binary work on OSX too.

XCTest on OS X does not know XCTMain() and XCTestCase on OSX works differently in detecting test cases because of the ObjC runtime that is not available on Linux. (var allTests : [(String, () -> Void)] { return [ ... ] })

And to make installation work the same on OSX and Linux I think that the build script should run on both platforms.

@parkera
Copy link
Contributor

parkera commented Jan 12, 2016

Our intent here was to allow the API to be compatible, so that developers may use XCTest on OS X/iOS and swift-corelibs-xctest on other platforms.

@parkera
Copy link
Contributor

parkera commented Jan 12, 2016

The allTests API in swift-corelibs is something we acknowledge is different, but it would be ignored on XCTest on Darwin.

@dunkelstern
Copy link
Author

Correct, but currently the API it is not compatible completely and before someone comes up with a autodetection idea for tests it will stay that way, so why not allow using the lib on OSX until this has been sorted out?

@parkera
Copy link
Contributor

parkera commented Jan 12, 2016

Which part is not API compatible?

If your tests have to add something additional, which is used only on Linux (for example), but otherwise the same code can be built against the Xcode XCTest, then I see that as ok.

I really don't want to start us down the road of a fork at this time.

@mike-ferris
Copy link

For the aspect of this related to swift build (the package manager), I think this discussion is probably best had with the package manager folks involved. They are currently working on (and discussing early proposals for) how testing support will be integrated with the package manager.

I would like to hear more detail about the API not being compatible between Xcode XCTest and corelibs XCTest. As @parkera mentions, the goal here is for Xcode's XCTest to be used on OS X and corelibs XCTest to be used on other platforms.

I know there are rough edges here, but I also know that the package manager's tests, for example, are currently set up such that this works for them.

@dunkelstern
Copy link
Author

See the other pull request, i would call that an incompatability :( (setUp, tearDown and the override mess) As I am reading from that it might be possible that there has to be some back and forth with the Xcode XCTest team, and as I understand the roadmaps we will not have breaking changes there before swift 3.0?

The problem is: I want to use it now because I have some libs that build on linux and osx. If I can't use it now I will have to switch to something that works on all platforms the same way.

@modocache
Copy link
Contributor

Thanks for this, @dunkelstern. Sorry it's been sitting around for a while! I think we may have addressed your concerns in the meantime:

By linking SwiftXCTest.framework in your Xcode project target's "Link Binary with Libraries" build phase, it's possible to use this framework on OS X--in fact, the SwiftXCTestFunctionalTests target in this repository does just that! You can take a look there for an example.

Keep in mind, however, that this is not recommended, and that you cannot use this framework from within a "test target" in Xcode. Test targets are run automatically via Xcode and Apple XCTest. Instead, we recommend using the swift-package-manager and its new swift test command to run tests on OS X and Linux.

Feel free to comment here or send an email to the swift-dev or swift-corelibs-dev mailing lists if you have any additional comments/questions. In the meantime, we wish to continue using xcodebuild on OS X and build_script.py on other platforms. The changes in this pull request don't reflect that position, so unfortunately I'm going to close this. 🙇

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.

4 participants