Skip to content

Only fetch swiftc target info when needed. #8992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025

Conversation

dschaefer2
Copy link
Member

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.

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.
@dschaefer2
Copy link
Member Author

@swift-ci please test

@dschaefer2
Copy link
Member Author

@swift-ci please test macOS

@dschaefer2 dschaefer2 merged commit 943ca4b into swiftlang:main Aug 7, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants