Import based on compilation outputs (#53)
Import based on compilation outputs (#53)

This PR adds the capability to import output files from a compilation:
to improve performance and experiment with using a "global shared index"
while remote caching a subset for lib. The github issue has some overall
mentions of this https://github.com/bazelbuild/rules_swift/issues/561

Index while building is performant in clang and swift becauase it
conditionally writes data based on files in a global index cache reused
across all clang/swift invocations in the build. The overhead of 3-5%
performance hit in the whitepaper of "Index while building" was hinged
on the fact it'd be using a global index cache.  With the per library
index as rules_swift implemented this feature, "Index while building"
adds a 300% increase in build times in my testing.

Longer term, can add flags to clang and swift indexing to be aware of
remote compilation and caching, this is a quick hack incase that doesn't
ever happen.

Remote build possibilities:

The plan is to be able to use a global index on compilation fix
compilation performance and minimize the O ( M imports * N modules )
disk usage. I'd then intend to use this code to import a subset of the
global index material into the remote cache by putting it in `bazel-out`
at `swift_library`'s "index-store" path. Eventually a feature can be
added to rules_cc following the same pattern for .m, .cpp

Local build possibilities:

I plan to import swift_library cache remote cache hits from `bazel-out`
into Xcode's index.

However, importing output files as a capability is useful even if that
doesn't play out: if we orient index-import around output files, then it
doesn't have to enumerate and process an entire index ever again.
Another build related program ran aas an aspect or via BEP could read
outputs and then invoke index-import with these outputs.
MobileNativeFoundation/index-import,MobileNativeFoundation/index-import,MobileNativeFoundation/index-import,MobileNativeFoundation/index-import