Skip to content

Commit 55006dc

Browse files
authored
Add PackageDescription platform constants for the 2023 Apple OS versions (#6636)
* Add platform constants for each of the Apple platforms, to match those in the WWDC 2023 Xcode beta release. * Add a package loading unit test for checking the platform versions allowed in tools version 5.9. rdar://107794704
1 parent 30306df commit 55006dc

File tree

3 files changed

+71
-7
lines changed

3 files changed

+71
-7
lines changed

Sources/PackageDescription/SupportedPlatforms.swift

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift open source project
44
//
5-
// Copyright (c) 2018-2022 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2018-2023 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See http://swift.org/LICENSE.txt for license information
@@ -336,6 +336,12 @@ extension SupportedPlatform {
336336
/// - Since: First available in PackageDescription 5.7.
337337
@available(_PackageDescription, introduced: 5.7)
338338
public static let v13: MacOSVersion = .init(string: "13.0")
339+
340+
/// The value that represents macOS 14.0.
341+
///
342+
/// - Since: First available in PackageDescription 5.9.
343+
@available(_PackageDescription, introduced: 5.9)
344+
public static let v14: MacOSVersion = .init(string: "14.0")
339345
}
340346

341347
/// The supported tvOS version.
@@ -397,6 +403,12 @@ extension SupportedPlatform {
397403
/// - Since: First available in PackageDescription 5.7.
398404
@available(_PackageDescription, introduced: 5.7)
399405
public static let v16: TVOSVersion = .init(string: "16.0")
406+
407+
/// The value that represents tvOS 17.0.
408+
///
409+
/// - Since: First available in PackageDescription 5.9.
410+
@available(_PackageDescription, introduced: 5.9)
411+
public static let v17: TVOSVersion = .init(string: "17.0")
400412
}
401413

402414
/// The supported Mac Catalyst version.
@@ -434,6 +446,12 @@ extension SupportedPlatform {
434446
/// - Since: First available in PackageDescription 5.7.
435447
@available(_PackageDescription, introduced: 5.7)
436448
public static let v16: MacCatalystVersion = .init(string: "16.0")
449+
450+
/// The value that represents Mac Catalyst 17.0.
451+
///
452+
/// - Since: First available in PackageDescription 5.9.
453+
@available(_PackageDescription, introduced: 5.9)
454+
public static let v17: MacCatalystVersion = .init(string: "17.0")
437455
}
438456

439457
/// The supported iOS version.
@@ -501,6 +519,12 @@ extension SupportedPlatform {
501519
/// - Since: First available in PackageDescription 5.7.
502520
@available(_PackageDescription, introduced: 5.7)
503521
public static let v16: IOSVersion = .init(string: "16.0")
522+
523+
/// The value that represents iOS 17.0.
524+
///
525+
/// - Since: First available in PackageDescription 5.9.
526+
@available(_PackageDescription, introduced: 5.9)
527+
public static let v17: IOSVersion = .init(string: "17.0")
504528
}
505529

506530
/// The supported watchOS version.
@@ -562,6 +586,12 @@ extension SupportedPlatform {
562586
/// - Since: First available in PackageDescription 5.7.
563587
@available(_PackageDescription, introduced: 5.7)
564588
public static let v9: WatchOSVersion = .init(string: "9.0")
589+
590+
/// The value that represents watchOS 10.0.
591+
///
592+
/// - Since: First available in PackageDescription 5.9.
593+
@available(_PackageDescription, introduced: 5.9)
594+
public static let v10: WatchOSVersion = .init(string: "10.0")
565595
}
566596

567597
/// The supported DriverKit version.
@@ -599,6 +629,12 @@ extension SupportedPlatform {
599629
/// - Since: First available in PackageDescription 5.7.
600630
@available(_PackageDescription, introduced: 5.7)
601631
public static let v22: DriverKitVersion = .init(string: "22.0")
632+
633+
/// The value that represents DriverKit 23.0.
634+
///
635+
/// - Since: First available in PackageDescription 5.9.
636+
@available(_PackageDescription, introduced: 5.9)
637+
public static let v23: DriverKitVersion = .init(string: "23.0")
602638
}
603639

604640
/// A supported custom platform version.

Tests/PackageLoadingTests/PD_5_9_LoadingTests.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,34 @@ class PackageDescription5_9LoadingTests: PackageDescriptionLoadingTests {
2121
.v5_9
2222
}
2323

24+
func testPlatforms() throws {
25+
let content = """
26+
import PackageDescription
27+
let package = Package(
28+
name: "Foo",
29+
platforms: [
30+
.macOS(.v14), .iOS(.v17),
31+
.tvOS(.v17), .watchOS(.v10),
32+
.macCatalyst(.v17), .driverKit(.v23),
33+
]
34+
)
35+
"""
36+
37+
let observability = ObservabilitySystem.makeForTesting()
38+
let (manifest, validationDiagnostics) = try loadAndValidateManifest(content, observabilityScope: observability.topScope)
39+
XCTAssertNoDiagnostics(observability.diagnostics)
40+
XCTAssertNoDiagnostics(validationDiagnostics)
41+
42+
XCTAssertEqual(manifest.platforms, [
43+
PlatformDescription(name: "macos", version: "14.0"),
44+
PlatformDescription(name: "ios", version: "17.0"),
45+
PlatformDescription(name: "tvos", version: "17.0"),
46+
PlatformDescription(name: "watchos", version: "10.0"),
47+
PlatformDescription(name: "maccatalyst", version: "17.0"),
48+
PlatformDescription(name: "driverkit", version: "23.0"),
49+
])
50+
}
51+
2452
func testMacroTargets() throws {
2553
let content = """
2654
import CompilerPluginSupport

Tests/WorkspaceTests/ManifestSourceGenerationTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,12 @@ class ManifestSourceGenerationTests: XCTestCase {
432432
let package = Package(
433433
name: "MyPackage",
434434
platforms: [
435-
.macOS(.v13),
436-
.iOS(.v16),
437-
.tvOS(.v16),
438-
.watchOS(.v9),
439-
.macCatalyst(.v16),
440-
.driverKit(.v22)
435+
.macOS(.v14),
436+
.iOS(.v17),
437+
.tvOS(.v17),
438+
.watchOS(.v10),
439+
.macCatalyst(.v17),
440+
.driverKit(.v23)
441441
],
442442
targets: [
443443
]

0 commit comments

Comments
 (0)