Bug: Unit Test fails to run on focused project
Description
Unit test execution fails due to missing xcframework in Xcode project generated with unit test target as a focused target
Reproduction steps
Repro steps are provided in the following change : https://github.com/MobileNativeFoundation/rules_xcodeproj/pull/2165
Expected behavior
Tests should succeed
rules_xcodeproj version
7efb52807d2ff37be1ed161f992c0ec1c635b1d0
Xcode version
14.1
Bazel version
6.1
rules_apple version
n/a
rules_swift version
n/a
Additional information
No response
We saw this bug as well. The reason is because the test_host for the test target is unfocused, so I believe it doesn't get copied into Xcode. The workaround is to add the test_host (in your example //iOSApp/Source:iOSApp) to focused_targets. That should fix it. In any case, there's probably something we can do on our side here to add the test_host automatically to focused_targets or copy them directly.
Yeah, similar to how in BwX mode we require various dependencies to stay focused, we probably need to unconditionally keep the test host of a target focused as well.