@@ -1926,6 +1926,13 @@ class PackageGraphTests: XCTestCase {
1926
1926
" openbsd " : " 0.0 "
1927
1927
]
1928
1928
1929
+ let customXCTestMinimumDeploymentTargets = [
1930
+ PackageModel . Platform. macOS: PlatformVersion ( " 10.15 " ) ,
1931
+ PackageModel . Platform. iOS: PlatformVersion ( " 11.0 " ) ,
1932
+ PackageModel . Platform. tvOS: PlatformVersion ( " 11.0 " ) ,
1933
+ PackageModel . Platform. watchOS: PlatformVersion ( " 4.0 " ) ,
1934
+ ]
1935
+
1929
1936
do {
1930
1937
// One platform with an override.
1931
1938
let manifest = Manifest . createRootManifest (
@@ -1947,13 +1954,6 @@ class PackageGraphTests: XCTestCase {
1947
1954
]
1948
1955
)
1949
1956
1950
- let customXCTestMinimumDeploymentTargets = [
1951
- PackageModel . Platform. macOS: PlatformVersion ( " 10.15 " ) ,
1952
- PackageModel . Platform. iOS: PlatformVersion ( " 11.0 " ) ,
1953
- PackageModel . Platform. tvOS: PlatformVersion ( " 11.0 " ) ,
1954
- PackageModel . Platform. watchOS: PlatformVersion ( " 4.0 " ) ,
1955
- ]
1956
-
1957
1957
let observability = ObservabilitySystem . makeForTesting ( )
1958
1958
let graph = try loadPackageGraph (
1959
1959
fileSystem: fs,
@@ -2093,6 +2093,59 @@ class PackageGraphTests: XCTestCase {
2093
2093
}
2094
2094
}
2095
2095
}
2096
+
2097
+ do {
2098
+ // Test MacCatalyst overriding behavior.
2099
+ let manifest = Manifest . createRootManifest (
2100
+ name: " pkg " ,
2101
+ platforms: [
2102
+ PlatformDescription ( name: " ios " , version: " 15.0 " ) ,
2103
+ ] ,
2104
+ products: [
2105
+ try ProductDescription ( name: " cbar " , type: . library( . automatic) , targets: [ " cbar " ] ) ,
2106
+ ] ,
2107
+ targets: [
2108
+ try TargetDescription ( name: " cbar " ) ,
2109
+ try TargetDescription ( name: " test " , type: . test)
2110
+ ]
2111
+ )
2112
+
2113
+ let observability = ObservabilitySystem . makeForTesting ( )
2114
+ let graph = try loadPackageGraph (
2115
+ fileSystem: fs,
2116
+ manifests: [ manifest] ,
2117
+ customXCTestMinimumDeploymentTargets: customXCTestMinimumDeploymentTargets,
2118
+ observabilityScope: observability. topScope
2119
+ )
2120
+ XCTAssertNoDiagnostics ( observability. diagnostics)
2121
+
2122
+ PackageGraphTester ( graph) { result in
2123
+ let expectedDeclaredPlatforms = [
2124
+ " ios " : " 15.0 " ,
2125
+ ]
2126
+
2127
+ var expectedDerivedPlatforms = defaultDerivedPlatforms. merging ( expectedDeclaredPlatforms, uniquingKeysWith: { lhs, rhs in rhs } )
2128
+ var expectedDerivedPlatformsForTests = defaultDerivedPlatforms. merging ( customXCTestMinimumDeploymentTargets. map { ( $0. name, $1. versionString) } , uniquingKeysWith: { lhs, rhs in rhs } )
2129
+ expectedDerivedPlatformsForTests [ " ios " ] = expectedDeclaredPlatforms [ " ios " ]
2130
+
2131
+ // Gets derived to be the same as the declared iOS deployment target.
2132
+ expectedDerivedPlatforms [ " maccatalyst " ] = expectedDeclaredPlatforms [ " ios " ]
2133
+ expectedDerivedPlatformsForTests [ " maccatalyst " ] = expectedDeclaredPlatforms [ " ios " ]
2134
+
2135
+ result. checkTarget ( " test " ) { target in
2136
+ target. checkDeclaredPlatforms ( expectedDeclaredPlatforms)
2137
+ target. checkDerivedPlatforms ( expectedDerivedPlatformsForTests)
2138
+ }
2139
+ result. checkTarget ( " cbar " ) { target in
2140
+ target. checkDeclaredPlatforms ( expectedDeclaredPlatforms)
2141
+ target. checkDerivedPlatforms ( expectedDerivedPlatforms)
2142
+ }
2143
+ result. checkProduct ( " cbar " ) { product in
2144
+ product. checkDeclaredPlatforms ( expectedDeclaredPlatforms)
2145
+ product. checkDerivedPlatforms ( expectedDerivedPlatforms)
2146
+ }
2147
+ }
2148
+ }
2096
2149
}
2097
2150
2098
2151
func testCustomPlatforms( ) throws {
0 commit comments