Skip to content

Commit b777e12

Browse files
committed
Rename getDerived to getSupportedPlatform
1 parent 9387af3 commit b777e12

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

Sources/Build/BuildDescription/ProductBuildDescription.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription
284284
// When deploying to macOS prior to macOS 12, add an rpath to the
285285
// back-deployed concurrency libraries.
286286
if useStdlibRpath, self.buildParameters.targetTriple.isMacOSX {
287-
let macOSSupportedPlatform = self.package.getDerived(for: .macOS, usingXCTest: product.isLinkingXCTest)
287+
let macOSSupportedPlatform = self.package.getSupportedPlatform(for: .macOS, usingXCTest: product.isLinkingXCTest)
288288
if macOSSupportedPlatform.version.major < 12 {
289289
let backDeployedStdlib = try buildParameters.toolchain.macosSwiftStdlib
290290
.parentDirectory

Sources/Build/BuildPlan/BuildPlan.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ extension BuildParameters {
133133
// Compute the triple string for Darwin platform using the platform version.
134134
if targetTriple.isDarwin() {
135135
let platform = buildEnvironment.platform
136-
let supportedPlatform = target.getDerived(for: platform, usingXCTest: target.type == .test)
136+
let supportedPlatform = target.getSupportedPlatform(for: platform, usingXCTest: target.type == .test)
137137
args += [targetTriple.tripleString(forPlatformVersion: supportedPlatform.version.versionString)]
138138
} else {
139139
args += [targetTriple.tripleString]
@@ -409,8 +409,8 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
409409
) throws {
410410
// Supported platforms are defined at the package level.
411411
// This will need to become a bit complicated once we have target-level or product-level platform support.
412-
let productPlatform = product.getDerived(for: .macOS, usingXCTest: product.isLinkingXCTest)
413-
let targetPlatform = target.getDerived(for: .macOS, usingXCTest: target.type == .test)
412+
let productPlatform = product.getSupportedPlatform(for: .macOS, usingXCTest: product.isLinkingXCTest)
413+
let targetPlatform = target.getSupportedPlatform(for: .macOS, usingXCTest: target.type == .test)
414414

415415
// Check if the version requirement is satisfied.
416416
//

Sources/PackageGraph/Resolution/PlatformVersionProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public struct PlatformVersionProvider: Hashable {
4646
switch implementation {
4747
case .mergingFromTargets(let targets):
4848
let platforms = targets.reduce(into: [SupportedPlatform]()) { partial, item in
49-
merge(into: &partial, platforms: [item.getDerived(for: declared, usingXCTest: item.type == .test)])
49+
merge(into: &partial, platforms: [item.getSupportedPlatform(for: declared, usingXCTest: item.type == .test)])
5050
}
5151
return platforms.first!.version
5252

Sources/PackageGraph/Resolution/ResolvedPackage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public final class ResolvedPackage {
7373
self.platformVersionProvider = platformVersionProvider
7474
}
7575

76-
public func getDerived(for platform: Platform, usingXCTest: Bool) -> SupportedPlatform {
76+
public func getSupportedPlatform(for platform: Platform, usingXCTest: Bool) -> SupportedPlatform {
7777
self.platformVersionProvider.getDerived(
7878
declared: self.supportedPlatforms,
7979
for: platform,

Sources/PackageGraph/Resolution/ResolvedProduct.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public final class ResolvedProduct {
115115
)
116116
}
117117

118-
public func getDerived(for platform: Platform, usingXCTest: Bool) -> SupportedPlatform {
118+
public func getSupportedPlatform(for platform: Platform, usingXCTest: Bool) -> SupportedPlatform {
119119
self.platformVersionProvider.getDerived(
120120
declared: self.supportedPlatforms,
121121
for: platform,

Sources/PackageGraph/Resolution/ResolvedTarget.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public final class ResolvedTarget {
158158
self.platformVersionProvider = platformVersionProvider
159159
}
160160

161-
public func getDerived(for platform: Platform, usingXCTest: Bool) -> SupportedPlatform {
161+
public func getSupportedPlatform(for platform: Platform, usingXCTest: Bool) -> SupportedPlatform {
162162
self.platformVersionProvider.getDerived(
163163
declared: self.supportedPlatforms,
164164
for: platform,

Sources/SPMTestSupport/PackageGraphTester.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public final class ResolvedTargetResult {
182182
let derived = platforms.map {
183183
let platform = PlatformRegistry.default.platformByName[$0.key] ?? PackageModel.Platform
184184
.custom(name: $0.key, oldestSupportedVersion: $0.value)
185-
return self.target.getDerived(for: platform, usingXCTest: self.target.type == .test)
185+
return self.target.getSupportedPlatform(for: platform, usingXCTest: self.target.type == .test)
186186
}
187187
let targetPlatforms = Dictionary(
188188
uniqueKeysWithValues: derived
@@ -192,7 +192,7 @@ public final class ResolvedTargetResult {
192192
}
193193

194194
public func checkDerivedPlatformOptions(_ platform: PackageModel.Platform, options: [String], file: StaticString = #file, line: UInt = #line) {
195-
let platform = target.getDerived(for: platform, usingXCTest: target.type == .test)
195+
let platform = target.getSupportedPlatform(for: platform, usingXCTest: target.type == .test)
196196
XCTAssertEqual(platform.options, options, file: file, line: line)
197197
}
198198
}
@@ -240,14 +240,14 @@ public final class ResolvedProductResult {
240240
public func checkDerivedPlatforms(_ platforms: [String: String], file: StaticString = #file, line: UInt = #line) {
241241
let derived = platforms.map {
242242
let platform = PlatformRegistry.default.platformByName[$0.key] ?? PackageModel.Platform.custom(name: $0.key, oldestSupportedVersion: $0.value)
243-
return product.getDerived(for: platform, usingXCTest: product.isLinkingXCTest)
243+
return product.getSupportedPlatform(for: platform, usingXCTest: product.isLinkingXCTest)
244244
}
245245
let targetPlatforms = Dictionary(uniqueKeysWithValues: derived.map({ ($0.platform.name, $0.version.versionString) }))
246246
XCTAssertEqual(platforms, targetPlatforms, file: file, line: line)
247247
}
248248

249249
public func checkDerivedPlatformOptions(_ platform: PackageModel.Platform, options: [String], file: StaticString = #file, line: UInt = #line) {
250-
let platform = product.getDerived(for: platform, usingXCTest: product.isLinkingXCTest)
250+
let platform = product.getSupportedPlatform(for: platform, usingXCTest: product.isLinkingXCTest)
251251
XCTAssertEqual(platform.options, options, file: file, line: line)
252252
}
253253
}

Sources/XCBuildSupport/PIFBuilder.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ final class PackagePIFProjectBuilder: PIFProjectBuilder {
301301

302302
PlatformRegistry.default.knownPlatforms.forEach {
303303
guard let platform = PIF.BuildSettings.Platform.from(platform: $0) else { return }
304-
let supportedPlatform = package.getDerived(for: $0, usingXCTest: false)
304+
let supportedPlatform = package.getSupportedPlatform(for: $0, usingXCTest: false)
305305
if !supportedPlatform.options.isEmpty {
306306
settings[.SPECIALIZATION_SDK_OPTIONS, for: platform] = supportedPlatform.options
307307
}
@@ -1419,13 +1419,13 @@ extension Array where Element == ResolvedTarget.Dependency {
14191419

14201420
extension ResolvedPackage {
14211421
func deploymentTarget(for platform: PackageModel.Platform, usingXCTest: Bool = false) -> String? {
1422-
return self.getDerived(for: platform, usingXCTest: usingXCTest).version.versionString
1422+
return self.getSupportedPlatform(for: platform, usingXCTest: usingXCTest).version.versionString
14231423
}
14241424
}
14251425

14261426
extension ResolvedTarget {
14271427
func deploymentTarget(for platform: PackageModel.Platform, usingXCTest: Bool = false) -> String? {
1428-
return self.getDerived(for: platform, usingXCTest: usingXCTest).version.versionString
1428+
return self.getSupportedPlatform(for: platform, usingXCTest: usingXCTest).version.versionString
14291429
}
14301430
}
14311431

0 commit comments

Comments
 (0)