Only fetch swiftc target info when needed. #8992
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We added fetching of the swift compiler version using swiftc -print-target-info in the init of UserToolchain so that it can be passed to the PrebuiltsManager to calculate the manifest and prebuilts zip file names.
However, there are cases where we pass in the triple for the current SDK which was intended to avoid the call to swiftc. We now call it all the time which causes an extra call to swiftc that isn't always needed.
To address this, we make the calculation of the target info lazy and move the call to fetch the swift version to the point we need it in the PrebuiltsManager. If prebuilts aren't required, the call is avoided.
To properly test this we need to run a test that calls out to swiftc. However, we don't have integration tests yet for prebuilts since they would take a long time to execute. I have instead manually tested this using a staged version of the prebuilts.