Support index-while-building when building with Bazel
When using the swift.index_while_building feature, Bazel will produce index stores while building. We should enable that feature by default in _xcodeproj_transition (though once we have multiple configs, we should only enable it for build, not index) and:
- Add the outputs to the
buildoutput group - Use index-import to copy the index files into Xcode's index store
- We will want to use
-import-output-fileto only copy over what's needed for each library - Though if using
swift.use_global_index_store, the per-library index store should already be only what's needed? If so, we could pass that feature as well/instead - If we do this based on the need to run
stubs/swiftc.py, then we can reduce the amount of copying further, asstubs/swiftc.pywill only run when something has changed
- We will want to use
With Hybrid BwX, and eventually Focused Projects, the need for this is going up.
Non-swift targets will probably need https://github.com/bazelbuild/bazel/issues/15983.
Without this there is no indexing data for unfocused targets. Even with that, I'm removing it as a blocker for 0.7.0, as there are performance considerations I want to deeply investigate, including being able to remove index-while-building from the Index Build and SwiftUI Previews builds.
https://github.com/buildbuddy-io/rules_xcodeproj/issues/1060
#1040 resolved this.