Skip to content

Commit f75817c

Browse files
authored
generator: Do not attempt to download toolchain if it is not needed (#177)
SDKs now do not include the host toolchain by default, but the generator still checks for host toolchains before deciding it does not need to download them. Skipping this check when a host toolchain is not requested removes the unnecessary network request. This saves a couple of seconds but also makes it possible to run the generator offline, if building from a container image which is already available locally.
1 parent b72dcca commit f75817c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Sources/SwiftSDKGenerator/SwiftSDKRecipes/LinuxRecipe.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,14 @@ public struct LinuxRecipe: SwiftSDKRecipe {
224224
generator.pathsConfiguration
225225
)
226226

227-
try await generator.downloadArtifacts(
228-
client,
229-
engine,
230-
downloadableArtifacts: &downloadableArtifacts,
231-
itemsToDownload: { artifacts in itemsToDownload(from: artifacts) }
232-
)
227+
if hostSwiftSource != .preinstalled {
228+
try await generator.downloadArtifacts(
229+
client,
230+
engine,
231+
downloadableArtifacts: &downloadableArtifacts,
232+
itemsToDownload: { artifacts in itemsToDownload(from: artifacts) }
233+
)
234+
}
233235

234236
if !self.shouldUseDocker {
235237
guard case let .ubuntu(version) = linuxDistribution else {

0 commit comments

Comments
 (0)