Closed matrush closed 3 years ago
Can I ask how you build OCMock? I'm asking because XCTest is explicitly linked in the .xcodeproj
file. Or does Apple's build system now optimise this and doesn't link a framework if nothing is referenced in it?
Can I ask how you build OCMock? I'm asking because XCTest is explicitly linked in the
.xcodeproj
file. Or does Apple's build system now optimise this and doesn't link a framework if nothing is referenced in it?
Hi @erikdoe, our projects were using BUCK to build projects from the source code which might be slightly different from the common flow. But I guess you can get the idea, if the built binary has XCTest
and was linked to another binary target (like Application), it will cause the issue. See some discussions here
Of course! I forgot you're at Facebook. Now this makes sense; you can change your Buck file to drop the dependency on XCTest, but you need the references in the source removed. I'll merge this PR but will leave this feature undocumented. It's such a niche use case. By the way, I remember discussing the pros and cons of monorepos and custom build systems with @shs96c years ago, and now it's arrived here.
During the merge I renamed the define. It's called OCM_DISABLE_XCTEST_FEATURES
now. I've also used this new define for the watchOS build because that also needed to skip the XCTest-based features.
We have some use cases needs to use
OCMock
without linkingXCTest
framework. E.g. In snapshot tests where a binary is expected to run with mock objects. LinkingXCTest
will cause the binary failed to run. The error is:I think adding a macro to support opt-out is probably a better idea for cases like this. By default the
XCTest
framework support is still on so most of the users won't be affected.