Skip to content

Commit 458a472

Browse files
Merge pull request #3803 from SwiftPackageIndex/add-new-platforms
Add Wasm and Android platforms
2 parents 70bc047 + 848a5b8 commit 458a472

32 files changed

+309
-33
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let package = Package(
3232
.package(url: "https://github.com/SwiftPackageIndex/Plot.git", branch: "main"),
3333
.package(url: "https://github.com/SwiftPackageIndex/CanonicalPackageURL.git", from: "1.0.0"),
3434
.package(url: "https://github.com/SwiftPackageIndex/DependencyResolution.git", from: "1.1.2"),
35-
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "1.2.0"),
35+
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "1.9.0"),
3636
.package(url: "https://github.com/SwiftPackageIndex/SemanticVersion.git", from: "0.3.0"),
3737
.package(url: "https://github.com/SwiftPackageIndex/ShellOut.git", from: "3.1.4"),
3838
.package(url: "https://github.com/swiftlang/swift-package-manager.git", branch: "release/6.1"),

Sources/App/Commands/TriggerBuilds.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,17 @@ struct BuildPair {
383383
static let all = Build.Platform.allActive.flatMap { platform in
384384
SwiftVersion.allActive.compactMap { swiftVersion in
385385
switch platform {
386+
case .android:
387+
// Android is supported from Swift version 6.1+
388+
return swiftVersion >= .v6_1 ? BuildPair(platform, swiftVersion) : nil
386389
case .iOS, .linux, .macosSpm, .macosXcodebuild, .tvOS, .watchOS:
387390
return BuildPair(platform, swiftVersion)
388391
case .visionOS:
389392
// visionOS is only available for Swift versions 5.9+
390393
return swiftVersion >= .v5_9 ? BuildPair(platform, swiftVersion) : nil
394+
case .wasm:
395+
// Android is supported from Swift version 6.1+
396+
return swiftVersion >= .v6_1 ? BuildPair(platform, swiftVersion) : nil
391397
}
392398
}
393399
}

Sources/App/Controllers/CompatibilityMatrix.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ extension CompatibilityMatrix {
3636
case watchOS
3737
case tvOS
3838
case linux
39+
case wasm
40+
case android
3941

4042
static func <(lhs: Self, rhs: Self) -> Bool { allCases.firstIndex(of: lhs)! < allCases.firstIndex(of: rhs)! }
4143
}

Sources/App/Controllers/PackageController+ShowRoute.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ extension Array where Element == PackageController.BuildsRoute.BuildInfo {
5151
extension Build.Platform {
5252
func isCompatible(with other: CompatibilityMatrix.Platform) -> Bool {
5353
switch self {
54+
case .android:
55+
return other == .android
5456
case .iOS:
5557
return other == .iOS
5658
case .macosSpm, .macosXcodebuild:
5759
return other == .macOS
5860
case .tvOS:
5961
return other == .tvOS
62+
case .wasm:
63+
return other == .wasm
6064
case .watchOS:
6165
return other == .watchOS
6266
case .visionOS:

Sources/App/Core/Extensions/Badge.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ extension Badge {
124124
return .init(left: 4, right: "watchOS")
125125
case .linux:
126126
return .init(left: 5, right: "Linux")
127+
case .wasm:
128+
return .init(left: 6, right: "Wasm")
129+
case .android:
130+
return .init(left: 7, right: "Android")
127131
}
128132
}
129133
)

Sources/App/Core/Extensions/BuildPair+ext.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ extension BuildPair {
3232
return .visionOS
3333
case .watchOS:
3434
return .watchOS
35+
case .wasm:
36+
return .wasm
37+
case .android:
38+
return .android
3539
}
3640
}
3741

Sources/App/Core/PackageCollection+generate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ extension Array where Element == PackageCollection.Compatibility {
296296
private extension PackageCollection.Platform {
297297
init(platform: Build.Platform) {
298298
switch platform {
299-
case .iOS, .tvOS, .visionOS, .watchOS, .linux:
299+
case .android, .iOS, .tvOS, .visionOS, .watchOS, .linux, .wasm:
300300
self.init(name: platform.rawValue)
301301
case .macosSpm, .macosXcodebuild:
302302
self.init(name: "macos")

Sources/App/Core/SearchFilter/Filters/PlatformSearchFilter.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ struct PlatformSearchFilter: SearchFilterProtocol {
5757
private extension Package.PlatformCompatibility {
5858
var displayDescription: String {
5959
switch self {
60+
case .android:
61+
return "Android"
6062
case .iOS:
6163
return "iOS"
6264
case .macOS:
@@ -67,6 +69,8 @@ private extension Package.PlatformCompatibility {
6769
return "tvOS"
6870
case .visionOS:
6971
return "visionOS"
72+
case .wasm:
73+
return "Wasm"
7074
case .watchOS:
7175
return "watchOS"
7276
}

Sources/App/Models/Build+Platform.swift

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,67 @@ import SPIManifest
1717

1818
extension Build {
1919
enum Platform: String, Codable, Equatable, CaseIterable {
20+
case android
2021
case iOS = "ios"
2122
case linux
2223
case macosSpm = "macos-spm"
2324
case macosXcodebuild = "macos-xcodebuild"
2425
case tvOS = "tvos"
2526
case visionOS = "visionos"
27+
case wasm
2628
case watchOS = "watchos"
2729

2830
var name: String {
2931
switch self {
32+
case .android:
33+
return "Android"
3034
case .iOS:
3135
return "iOS"
36+
case .linux:
37+
return "Linux"
3238
case .macosSpm:
3339
return "macOS - SPM"
3440
case .macosXcodebuild:
3541
return "macOS - xcodebuild"
3642
case .tvOS:
3743
return "tvOS"
44+
case .wasm:
45+
return "Wasm"
3846
case .watchOS:
3947
return "watchOS"
4048
case .visionOS:
4149
return "visionOS"
42-
case .linux:
43-
return "Linux"
4450
}
4551
}
4652

4753
var displayName: String {
4854
switch self {
55+
case .android:
56+
return "Android"
4957
case .iOS:
5058
return "iOS"
59+
case .linux:
60+
return "Linux"
5161
case .macosSpm:
5262
return "macOS (SPM)"
5363
case .macosXcodebuild:
5464
return "macOS (Xcode)"
5565
case .tvOS:
5666
return "tvOS"
67+
case .wasm:
68+
return "Wasm"
5769
case .watchOS:
5870
return "watchOS"
5971
case .visionOS:
6072
return "visionOS"
61-
case .linux:
62-
return "Linux"
6373
}
6474
}
6575

6676
/// Currently supported build platforms
6777
static var allActive: [Self] {
6878
// The order of this array defines the platform order on the BuildIndex page. Keep this aliged with the
6979
// order in GetRoute.Model.PlatformResults (which is the order in the build matrix on the PackageShow page).
70-
let active: [Self] = [.iOS, .macosSpm, .macosXcodebuild, .visionOS, .tvOS, .watchOS, .linux]
80+
let active: [Self] = [.iOS, .macosSpm, .macosXcodebuild, .visionOS, .tvOS, .watchOS, .linux, .wasm, .android]
7181
assert(active.count == allCases.count, "mismatch in Build.Platform and active platform count")
7282
return active
7383
}
@@ -78,6 +88,8 @@ extension Build {
7888
/// - Parameter spiManifestPlatform: SPIManifest platform
7989
private init(_ spiManifestPlatform: SPIManifest.Platform) {
8090
switch spiManifestPlatform {
91+
case .android:
92+
self = .android
8193
case .iOS:
8294
self = .iOS
8395
case .linux:
@@ -90,6 +102,8 @@ extension Build {
90102
self = .tvOS
91103
case .visionOS:
92104
self = .visionOS
105+
case .wasm:
106+
self = .wasm
93107
case .watchOS:
94108
self = .watchOS
95109
}

0 commit comments

Comments
 (0)