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
Weaken the dependency on XCTest #146
Conversation
This is really awesome! It looks like the build failed because CircleCI doesn't support the latest swift compiler (but I'm not 100% sure). |
Would it make sense to apply this to a different branch (master?) instead? |
Don't worry about CircleCI, it doesn't support Swift 2.0 yet, so it's always red for the Hey @briancroom, are you doing something special to get Nimble working without XCTest? I've tried importing Nimble as an app dependency in a demo app as an example (using carthage or cocoapods), but it doesn't work.
|
That's interesting, @jeffh, I hadn't tried running inspecting the Nimble binary with otool. I've done some more digging, and it seems that the
I have also pushed a branch that shows an example of using Nimble without XCTest to briancroom/Nimble@0d3721f To be fair, I haven't attempted this with pulling in the framework via Cocoapods or Carthage yet. I'm anticipating that Carthage will work, but it may take some additional work to get Cocoapods to build it correctly. |
Ah, I see...there's more going on here than I realized. The example app I linked to was included in the Nimble workspace. It links with a copy of the Nimble framework that isn't embedded in the final app, which meant that I tested it with Carthage now and encountered the same problem that @jeffh saw, presumably. I'm going to need to experiment a bit more to determine what other approaches may be feasible to work around this. |
A couple more findings...
|
cbaeedf
to
d2b4eba
Compare
A couple updates:
[1]
|
@jeffh I've pushed a usage example of this: https://github.com/briancroom/NimbleWithCarthageExample |
Hey @briancroom, would this script be safe to run in always or does this cause surprising failures when XCTest should automatically be linked, but isn't? I'm wondering if this is something more automatic or documentation that needs to mention how to run Nimble without XCTest. Sorry, I haven't been spending significant time on Nimble since it's annoying that Xcode 7 beta 5 crashes on Nimble's test suite. |
Thanks for bringing up documentation @jeffh. I've added a section to the README indicating how this works. |
This is really cool! 👍 Code looks good to me, but I'll defer to @jeffh to merge. If this is the direction Nimble is taking, I'd love to explore whether Quick could also use weak linking. |
Hey @briancroom, In Xcode 7 beta 5, it doesn't seem like 'SWIFT_STDLIB_TOOL_DESTINATION_DIR' exists? |
@jeffh I just gave it another try on beta 5 and it seemed to be working. If the script isn't finding the environment variable, maybe check to make sure that you selected the right target in the script's "Provide build settings from" dropdown? When working on this, I was putting the following line in the script to see what I had available:
Do you see the expected build settings env vars from that? |
Oh never mind, I configured it incorrectly. My bad. But I still seem to get failure when running. This could be because I'm now running Xcode 7 beta 6. Sorry for the long turnaround. I've also uploaded my repo that I've been using to test: https://github.com/jeffh/NimbleCocoaPodsExample. I'll raise this issue to a higher priority so I can respond more regularly. |
This allows using Nimble without pulling XCTest into your process.
…est is not available
When strongly linking XCTest, Cocoapods automatically adds a framework search path to allow the framework to be found. When weakly linking, it must be manually specified.
89fba37
to
9cba9f1
Compare
Hey @jeffh , thanks for that repo. That was useful for testing just now. I just found some time to get this rebased to include the new commits on the swift-2.0 branch. After doing so, I was able to get your example repo working by using the following Podfile:
When you get a few minutes, could you take another look? |
I'll take a look tonight. Thanks. — On Wed, Sep 2, 2015 at 10:56 AM, Brian Croom notifications@github.com
|
Thanks @briancroom, I've gotten it to work. Although, I'm not sure if it was cache cleaning, cocoapods update, or xcode update that's related to the original issues i've been having. |
Weaken the dependency on XCTest
I had some good success working on what seems like a great solution to #144. The weak linking seems to be working successfully. The process dies with a dylib error the instant that you try to instantiate
NimbleXCTestHandler
without the XCTest framework+lib around, so I added some code to prevent that form happening. We could potentially try to add a non-crashing fallback assertion handler for this situation as well.Thoughts? @jeffh @tjarratt