rules_xcodeproj
rules_xcodeproj copied to clipboard
Bug: `ENABLE_TESTING_SEARCH_PATHS` build setting not set when `testonly = True`
Xcode provides ENABLE_TESTING_SEARCH_PATHS which will include Developer/Library/Frameworks to the builds search paths, so developers can use XCTest libraries in non-test targets.
Currently rules_swift sets that for everything, while Xcode makes it disabled-by-default.
Looks like it is only set when testonly is set: https://github.com/bazelbuild/rules_swift/commit/768bfe3fe885f92fbaea75488268e2612ab9ef9c#diff-b66f80b469020168d63d1079602ed95b2dd607240c182a4a1098b34eb865020eR267
So we have code to do this, and it's working for test targets. I wonder where it's failing for other targets? Do you have more details @erikkerber?
https://github.com/buildbuddy-io/rules_xcodeproj/blob/0e2b21635c7b2752940261d37c34b22e7a68348a/xcodeproj/internal/target.bzl#L734-L738
We did not have testonly applied to these targets before today, and I'll re-test.
They are testing helper targets that utilize XCTest, but not test targets themselves.
Given https://github.com/bazelbuild/rules_swift/commit/768bfe3fe885f92fbaea75488268e2612ab9ef9c#diff-b66f80b469020168d63d1079602ed95b2dd607240c182a4a1098b34eb865020eR267, how did they link correctly with Bazel?
I tested this and it does work if targets are applied with testonly = True
Closing 👍🏼
I tested this and it does work if targets are applied with
testonly = True
But bazel build works without testonly = True? If so, is there a bug with rules_swift? Ideally rules_xcodeproj would work without any workspace changes, even if it doesn't make sense.
Yes. My read in rules_swift, and I could be wrong, is that Developer/Library/Frameworks is added unconditionally.
That seems like a bug to me. Someone should fix it 😉.
Re-opening, as we need to change to mimic rules_swift, or (ideally) rules_swift needs to adjust to only add the framework search paths for test_only = True.
https://github.com/bazelbuild/rules_swift/pull/840 should address this from the rules_swift side.
@brentleyjones Can we close this issue now?
After we update to a released version with the fix.