Skip to content

Add constants for new OS versions #3537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Sources/PackageDescription/SupportedPlatforms.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ extension SupportedPlatform {
/// - Since: First available in PackageDescription 5.3
@available(_PackageDescription, introduced: 5.3)
public static let v11: MacOSVersion = .init(string: "11.0")

/// The value that represents macOS 12.0.
///
/// - Since: First available in PackageDescription 5.5
@available(_PackageDescription, introduced: 5.5)
public static let v12: MacOSVersion = .init(string: "12.0")
}

/// The supported tvOS version.
Expand Down Expand Up @@ -314,6 +320,12 @@ extension SupportedPlatform {
/// - Since: First available in PackageDescription 5.3
@available(_PackageDescription, introduced: 5.3)
public static let v14: TVOSVersion = .init(string: "14.0")

/// The value that represents tvOS 15.0.
///
/// - Since: First available in PackageDescription 5.5
@available(_PackageDescription, introduced: 5.5)
public static let v15: TVOSVersion = .init(string: "15.0")
}

/// The supported Mac Catalyst version.
Expand All @@ -339,6 +351,12 @@ extension SupportedPlatform {
/// - Since: First available in PackageDescription 5.5
@available(_PackageDescription, introduced: 5.5)
public static let v14: MacCatalystVersion = .init(string: "14.0")

/// The value that represents Mac Catalyst 15.0.
///
/// - Since: First available in PackageDescription 5.5
@available(_PackageDescription, introduced: 5.5)
public static let v15: MacCatalystVersion = .init(string: "15.0")
}

/// The supported iOS version.
Expand Down Expand Up @@ -389,6 +407,12 @@ extension SupportedPlatform {
/// - Since: First available in PackageDescription 5.3
@available(_PackageDescription, introduced: 5.3)
public static let v14: IOSVersion = .init(string: "14.0")

/// The value that represents iOS 15.0.
///
/// - Since: First available in PackageDescription 5.5
@available(_PackageDescription, introduced: 5.5)
public static let v15: IOSVersion = .init(string: "15.0")
}

/// The supported watchOS version.
Expand Down Expand Up @@ -434,6 +458,12 @@ extension SupportedPlatform {
/// - Since: First available in PackageDescription 5.3
@available(_PackageDescription, introduced: 5.3)
public static let v7: WatchOSVersion = .init(string: "7.0")

/// The value that represents watchOS 8.0.
///
/// - Since: First available in PackageDescription 5.5
@available(_PackageDescription, introduced: 5.5)
public static let v8: WatchOSVersion = .init(string: "8.0")
}

/// The supported DriverKit version.
Expand All @@ -455,6 +485,10 @@ extension SupportedPlatform {
/// The value that represents DriverKit 20.0.
@available(_PackageDescription, introduced: 5.5)
public static let v20: DriverKitVersion = .init(string: "20.0")

/// The value that represents DriverKit 21.0.
@available(_PackageDescription, introduced: 5.5)
public static let v21: DriverKitVersion = .init(string: "21.0")
}
}

Expand Down
26 changes: 26 additions & 0 deletions Tests/PackageLoadingTests/PD5_5LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,30 @@ class PackageDescription5_5LoadingTests: PackageDescriptionLoadingTests {
XCTAssertEqual(manifest.targets[0].sources, ["CountMeIn.swift"])
}
}

func testPlatforms() throws {
let stream = BufferedOutputByteStream()
stream <<< """
import PackageDescription
let package = Package(
name: "Foo",
platforms: [
.macOS(.v12), .iOS(.v15),
.tvOS(.v15), .watchOS(.v8),
.macCatalyst(.v15), .driverKit(.v21),
]
)
"""

loadManifest(stream.bytes) { manifest in
XCTAssertEqual(manifest.platforms, [
PlatformDescription(name: "macos", version: "12.0"),
PlatformDescription(name: "ios", version: "15.0"),
PlatformDescription(name: "tvos", version: "15.0"),
PlatformDescription(name: "watchos", version: "8.0"),
PlatformDescription(name: "maccatalyst", version: "15.0"),
PlatformDescription(name: "driverkit", version: "21.0"),
])
}
}
}