Skip to content

Commit 0d52feb

Browse files
Adjust targetSwift path to include swiftPlatform to identify the toolchain
- Otherwise weird things happen from the EndToEndTests when running tests that then need to re-download a new toolchain on top.
1 parent 492c9c9 commit 0d52feb

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

Sources/SwiftSDKGenerator/Artifacts/DownloadableArtifacts.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ struct DownloadableArtifacts: Sendable {
5454

5555
if hostTriple.os == .linux {
5656
// Amazon Linux 2 is chosen for its best compatibility with all Swift-supported Linux hosts
57-
let linuxArchSuffix =
57+
let hostArchSuffix =
5858
hostTriple.arch == .aarch64 ? "-\(Triple.Arch.aarch64.linuxConventionName)" : ""
5959
self.hostSwift = .init(
6060
remoteURL: versions.swiftDownloadURL(
61-
subdirectory: "amazonlinux2\(linuxArchSuffix)",
62-
platform: "amazonlinux2\(linuxArchSuffix)",
61+
subdirectory: "amazonlinux2\(hostArchSuffix)",
62+
platform: "amazonlinux2\(hostArchSuffix)",
6363
fileExtension: "tar.gz"
6464
),
6565
localPath: paths.artifactsCachePath
@@ -97,7 +97,9 @@ struct DownloadableArtifacts: Sendable {
9797
self.targetSwift = .init(
9898
remoteURL: versions.swiftDownloadURL(),
9999
localPath: paths.artifactsCachePath
100-
.appending("target_swift_\(versions.swiftVersion)_\(targetTriple.triple).tar.gz"),
100+
.appending(
101+
"target_swift_\(versions.swiftVersion)_\(versions.swiftPlatform)_\(targetTriple.archName).tar.gz"
102+
),
101103
isPrebuilt: true
102104
)
103105
}

Sources/SwiftSDKGenerator/PlatformModels/VersionsConfiguration.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,30 @@ public struct VersionsConfiguration: Sendable {
3737
var swiftPlatform: String {
3838
switch self.linuxDistribution {
3939
case let .ubuntu(ubuntu):
40-
return "ubuntu\(ubuntu.version)\(self.linuxArchSuffix)"
40+
return "ubuntu\(ubuntu.version)"
4141
case let .rhel(rhel):
42-
return "\(rhel.rawValue)\(self.linuxArchSuffix)"
42+
return rhel.rawValue
4343
}
4444
}
4545

46+
var swiftPlatformAndSuffix: String {
47+
return "\(self.swiftPlatform)\(self.linuxArchSuffix)"
48+
}
49+
4650
func swiftDistributionName(platform: String? = nil) -> String {
47-
"swift-\(self.swiftVersion)-\(platform ?? self.swiftPlatform)"
51+
return
52+
"swift-\(self.swiftVersion)-\(platform ?? self.swiftPlatformAndSuffix)"
4853
}
4954

5055
func swiftDownloadURL(
5156
subdirectory: String? = nil,
5257
platform: String? = nil,
5358
fileExtension: String = "tar.gz"
5459
) -> URL {
55-
let computedSubdirectory: String
56-
switch self.linuxDistribution {
57-
case let .ubuntu(ubuntu):
58-
computedSubdirectory =
59-
"ubuntu\(ubuntu.version.replacingOccurrences(of: ".", with: ""))\(self.linuxArchSuffix)"
60-
case let .rhel(rhel):
61-
computedSubdirectory = rhel.rawValue
62-
}
60+
let computedPlatform = platform ?? self.swiftPlatformAndSuffix
61+
let computedSubdirectory =
62+
subdirectory
63+
?? computedPlatform.replacingOccurrences(of: ".", with: "")
6364

6465
return URL(
6566
string: """

0 commit comments

Comments
 (0)