Skip to content

Commit 0dd7ae2

Browse files
committed
support multiple architectures for runtimes
1 parent 938adbc commit 0dd7ae2

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

.swiftpm/xcode/xcshareddata/xcschemes/xcodes.xcscheme

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,13 @@
128128
isEnabled = "NO">
129129
</CommandLineArgument>
130130
<CommandLineArgument
131-
argument = "runtimes install &quot;visionOS 1.0-beta1&quot;"
131+
argument = "runtimes install &quot;visionOS 26.0-beta3 arm64&quot;"
132132
isEnabled = "YES">
133133
</CommandLineArgument>
134+
<CommandLineArgument
135+
argument = "runtimes --include-betas"
136+
isEnabled = "NO">
137+
</CommandLineArgument>
134138
<CommandLineArgument
135139
argument = "install --help"
136140
isEnabled = "NO">

Sources/XcodesKit/Models+Runtimes.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public struct DownloadableRuntime: Decodable {
1212
let category: Category
1313
let simulatorVersion: SimulatorVersion
1414
let source: String?
15+
let architectures: [String]?
1516
let dictionaryVersion: Int
1617
let contentType: ContentType
1718
let platform: Platform
@@ -23,7 +24,7 @@ public struct DownloadableRuntime: Decodable {
2324
let authentication: Authentication?
2425

2526
var betaNumber: Int? {
26-
enum Regex { static let shared = try! NSRegularExpression(pattern: "b[0-9]+$") }
27+
enum Regex { static let shared = try! NSRegularExpression(pattern: "b[0-9]+") }
2728
guard var foundString = Regex.shared.firstString(in: identifier) else { return nil }
2829
foundString.removeFirst()
2930
return Int(foundString)!
@@ -34,7 +35,7 @@ public struct DownloadableRuntime: Decodable {
3435
}
3536

3637
var visibleIdentifier: String {
37-
return platform.shortName + " " + completeVersion
38+
return platform.shortName + " " + completeVersion + (architectures != nil ? " \(architectures?.joined(separator: "|") ?? "")" : "")
3839
}
3940
}
4041

@@ -53,6 +54,7 @@ struct SDKToSimulatorMapping: Decodable {
5354
let sdkBuildUpdate: String
5455
let simulatorBuildUpdate: String
5556
let sdkIdentifier: String
57+
let downloadableIdentifiers: [String]?
5658
}
5759

5860
extension DownloadableRuntime {

Sources/XcodesKit/RuntimeInstaller.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ public class RuntimeInstaller {
2828
betaNumber: downloadable.betaNumber,
2929
version: downloadable.simulatorVersion.version,
3030
build: downloadable.simulatorVersion.buildUpdate,
31-
kind: $0.kind))
31+
kind: $0.kind,
32+
architectures: downloadable.architectures))
3233
}
3334
} else {
3435
mappedRuntimes.append(PrintableRuntime(platform: downloadable.platform,
3536
betaNumber: downloadable.betaNumber,
3637
version: downloadable.simulatorVersion.version,
37-
build: downloadable.simulatorVersion.buildUpdate))
38+
build: downloadable.simulatorVersion.buildUpdate,
39+
architectures: downloadable.architectures))
3840
}
3941
}
4042

@@ -47,7 +49,8 @@ public class RuntimeInstaller {
4749
betaNumber: resolvedBetaNumber,
4850
version: runtime.version,
4951
build: runtime.build,
50-
kind: runtime.kind)
52+
kind: runtime.kind,
53+
architectures: nil)
5154

5255
mappedRuntimes.indices {
5356
result.visibleIdentifier == $0.visibleIdentifier
@@ -361,7 +364,7 @@ extension RuntimeInstaller {
361364
public var errorDescription: String? {
362365
switch self {
363366
case let .unavailableRuntime(version):
364-
return "Runtime \(version) is invalid or not downloadable"
367+
return "Runtime \(version) is invalid or not downloadable. Please include arm64 or x86_64 in the version string if shown."
365368
case .failedMountingDMG:
366369
return "Failed to mount image."
367370
case .rootNeeded:
@@ -384,13 +387,14 @@ fileprivate struct PrintableRuntime {
384387
let build: String
385388
var kind: InstalledRuntime.Kind? = nil
386389
var hasDuplicateVersion = false
390+
let architectures: [String]?
387391

388392
var completeVersion: String {
389393
makeVersion(for: version, betaNumber: betaNumber)
390394
}
391395

392396
var visibleIdentifier: String {
393-
return platform.shortName + " " + completeVersion
397+
return platform.shortName + " " + completeVersion + (architectures != nil ? " \(architectures?.joined(separator: "|") ?? "")" : "")
394398
}
395399
}
396400

0 commit comments

Comments
 (0)