Skip to content

Commit b14a3bd

Browse files
committed
Remove some workarounds used to support very old SDKs
Only OS version 26 and above SDKs (and DriverKit version 25) are supported now.
1 parent ab57912 commit b14a3bd

File tree

6 files changed

+21
-98
lines changed

6 files changed

+21
-98
lines changed

Sources/SWBCore/PlatformRegistry.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,6 @@ public final class PlatformRegistry {
546546
var defaultSettings: [String: PropertyListItem] = [:]
547547
if case .plDict(let defaultSettingsItems)? = items["DefaultProperties"] {
548548
defaultSettings = defaultSettingsItems
549-
550-
// Rev-lock: rdar://85769354 (Remove DEPLOYMENT_TARGET_CLANG_* properties from SDK)
551-
for macroName in [
552-
"DEPLOYMENT_TARGET_CLANG_ENV_NAME",
553-
"DEPLOYMENT_TARGET_CLANG_FLAG_NAME",
554-
"DEPLOYMENT_TARGET_CLANG_FLAG_PREFIX",
555-
] { defaultSettings.removeValue(forKey: macroName) }
556549
}
557550

558551
// Parse whether this is a deployment platform.

Sources/SWBCore/SDKRegistry.swift

Lines changed: 6 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public final class SDKVariant: PlatformInfoProvider, Sendable {
383383
self.validDeploymentTargets = validDeploymentTargets
384384

385385
// The recommended deployment target is the default deployment target for the platform, unless we've overridden to a more specific value.
386-
self.recommendedDeploymentTarget = (try? Version(supportedTargetDict["RecommendedDeploymentTarget"]?.stringValue ?? Self.fallbackRecommendedDeploymentTarget(variantName: name) ?? "")) ?? defaultDeploymentTarget
386+
self.recommendedDeploymentTarget = (try? Version(supportedTargetDict["RecommendedDeploymentTarget"]?.stringValue ?? "")) ?? defaultDeploymentTarget
387387

388388
self.llvmTargetTripleEnvironment = supportedTargetDict["LLVMTargetTripleEnvironment"]?.stringValue
389389
self.llvmTargetTripleSys = supportedTargetDict["LLVMTargetTripleSys"]?.stringValue
@@ -398,90 +398,17 @@ public final class SDKVariant: PlatformInfoProvider, Sendable {
398398
self.targetOSMacroName = nil
399399
}
400400

401-
self.deviceFamilies = try DeviceFamilies(families: PropertyList.decode([DeviceFamily].self, from: supportedTargetDict["DeviceFamilies"] ?? Self.fallbackDeviceFamiliesData(variantName: name)))
401+
self.deviceFamilies = try DeviceFamilies(families: PropertyList.decode([DeviceFamily].self, from: supportedTargetDict["DeviceFamilies"] ?? []))
402402

403-
self.clangRuntimeLibraryPlatformName = supportedTargetDict["ClangRuntimeLibraryPlatformName"]?.stringValue ?? Self.fallbackClangRuntimeLibraryPlatformName(variantName: name)
403+
self.clangRuntimeLibraryPlatformName = supportedTargetDict["ClangRuntimeLibraryPlatformName"]?.stringValue
404404

405-
let (os, concurrency, span) = Self.fallbackSwiftVersions(variantName: name)
406-
self.minimumOSForSwiftInTheOS = try (supportedTargetDict["SwiftOSRuntimeMinimumDeploymentTarget"]?.stringValue ?? os).map { try Version($0) }
407-
self.minimumOSForSwiftConcurrency = try (supportedTargetDict["SwiftConcurrencyMinimumDeploymentTarget"]?.stringValue ?? concurrency).map { try Version($0) }
408-
self.minimumOSForSwiftSpan = try (supportedTargetDict["SwiftSpanMinimumDeploymentTarget"]?.stringValue ?? span).map { try Version($0) }
405+
self.minimumOSForSwiftInTheOS = try (supportedTargetDict["SwiftOSRuntimeMinimumDeploymentTarget"]?.stringValue).map { try Version($0) }
406+
self.minimumOSForSwiftConcurrency = try (supportedTargetDict["SwiftConcurrencyMinimumDeploymentTarget"]?.stringValue).map { try Version($0) }
407+
self.minimumOSForSwiftSpan = try (supportedTargetDict["SwiftSpanMinimumDeploymentTarget"]?.stringValue).map { try Version($0) }
409408

410409
self.systemPrefix = supportedTargetDict["SystemPrefix"]?.stringValue ?? ""
411410
}
412411

413-
private static func fallbackDeviceFamiliesData(variantName name: String) throws -> PropertyListItem {
414-
switch name {
415-
case "macos", "macosx":
416-
return .plArray([
417-
.plDict([
418-
"Name": .plString("mac"),
419-
"DisplayName": .plString("Mac"),
420-
])
421-
])
422-
case MacCatalystInfo.sdkVariantName:
423-
return .plArray([
424-
.plDict([
425-
"Identifier": .plInt(2),
426-
"Name": .plString("pad"),
427-
"DisplayName": .plString("iPad"),
428-
]),
429-
.plDict([
430-
"Identifier": .plInt(6),
431-
"Name": .plString("mac"),
432-
"DisplayName": .plString("Mac"),
433-
])
434-
])
435-
default:
436-
// Other platforms don't have device families
437-
return .plArray([])
438-
}
439-
}
440-
441-
private static func fallbackClangRuntimeLibraryPlatformName(variantName name: String) -> String? {
442-
switch name {
443-
case "macos", "macosx", MacCatalystInfo.sdkVariantName:
444-
return "osx"
445-
default:
446-
return nil
447-
}
448-
}
449-
450-
private static func fallbackSwiftVersions(variantName name: String) -> (os: String?, concurrency: String?, span: String?) {
451-
switch name {
452-
case "macos", "macosx":
453-
return ("10.14.4", "12.0", "26.0")
454-
default:
455-
return (nil, nil, "26.0")
456-
}
457-
}
458-
459-
private static func fallbackRecommendedDeploymentTarget(variantName name: String) -> String? {
460-
switch name {
461-
// Late Summer 2019 aligned, except iOS which got one final 12.x update in Winter 2020, making this version set the last minor update series of the Fall 2018 aligned releases.
462-
case "macos", "macosx":
463-
return "10.14.6"
464-
case "iphoneos", "iphonesimulator":
465-
return "12.5"
466-
case "appletvos", "appletvsimulator":
467-
return "12.4"
468-
case "watchos", "watchsimulator":
469-
return "5.3"
470-
471-
// No Summer 2019 aligned versions since these were first introduced on or after Fall 2019, so simply use the minimum versions.
472-
case "driverkit":
473-
return "19.0"
474-
case MacCatalystInfo.sdkVariantName:
475-
return "13.1"
476-
case "xros", "xrsimulator":
477-
return "1.0"
478-
479-
// Fall back to the default deployment target, which is equal to the SDK version.
480-
default:
481-
return nil
482-
}
483-
}
484-
485412
/// Perform late binding of the build settings. This is a private function that may only be invoked once for any given SDK variant.
486413
/// - Parameters:
487414
/// - associatedTypesForKeysMatching: Passed to `MacroNamespace.parseTable` - refer there for more info.
@@ -761,14 +688,12 @@ public final class SDKRegistry: SDKRegistryLookup, CustomStringConvertible, Send
761688
var defaultSettings: [String: PropertyListItem] = [:]
762689
if case .plDict(let settingsItems)? = items["DefaultProperties"] {
763690
defaultSettings = filteredSettings(settingsItems)
764-
.filter { $0.key != "TEST_FRAMEWORK_DEVELOPER_VARIANT_SUBPATH" } // rdar://107954685 (Remove watchOS special case for testing framework paths)
765691
}
766692

767693
// Parse the custom properties settings.
768694
var overrideSettings: [String: PropertyListItem] = [:]
769695
if case .plDict(let settingsItems)? = items["CustomProperties"] {
770696
overrideSettings = filteredSettings(settingsItems)
771-
.filter { !$0.key.hasPrefix("SWIFT_MODULE_ONLY_") } // Rev-lock: don't set SWIFT_MODULE_ONLY_ in SDKs
772697
}
773698

774699
// Parse the Variants array and the SupportedTargets dictionary, then create the SDKVariant objects from them. Note that it is not guaranteed that any variant will have both sets of data, so we don't the presence of either one.

Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ fileprivate struct UnitTestBuildOperationTests: CoreBasedTests {
10451045

10461046
/// Test building an application and a UI test target for iOS for both the device and the simulator.
10471047
@Test(.requireSDKs(.iOS))
1048-
func uITestTarget_iOS() async throws {
1048+
func uiTestTarget_iOS() async throws {
10491049
// Creates and returns a tester for a given test.
10501050
func makeTester(_ tmpDir: Path) async throws -> BuildOperationTester {
10511051
let testWorkspace = try await TestWorkspace(

Tests/SWBCoreTests/SDKRegistryTests.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,12 @@ import SWBMacro
538538
"CanonicalName": "macosbork",
539539
"IsBaseSDK": "YES",
540540
"SupportedTargets": [
541-
"iosmac": [] as PropertyListItem
541+
"iosmac": [
542+
"DeviceFamilies": [
543+
["DisplayName": "iPad", "Identifier": "2", "Name": "pad"],
544+
["DisplayName": "Mac", "Identifier": "6", "Name": "mac"],
545+
]
546+
] as PropertyListItem
542547
]
543548
])
544549

Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
6969
}
7070
}
7171

72-
@Test(.requireSDKs(.macOS))
72+
@Test(.requireSDKs(.macOS), .requireXcode26())
7373
func swiftAppBasics_preSwiftOS() async throws {
7474
try await _testSwiftAppBasics(deploymentTargetVersion: "10.14.0", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: false, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true)
7575
}
7676

77-
@Test(.requireSDKs(.macOS))
77+
@Test(.requireSDKs(.macOS), .requireXcode26())
7878
func swiftAppBasics_postSwiftOS() async throws {
7979
try await _testSwiftAppBasics(deploymentTargetVersion: "12.0", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: false, shouldBackDeploySwiftSpan: true, missingSpanCompatibilitySuppressesRPath: true)
8080
}
@@ -84,22 +84,22 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
8484
try await _testSwiftAppBasics(deploymentTargetVersion: "26.0", shouldEmitSwiftRPath: false, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: false, shouldBackDeploySwiftSpan: false)
8585
}
8686

87-
@Test(.requireSDKs(.macOS))
87+
@Test(.requireSDKs(.macOS), .requireXcode26())
8888
func swiftAppBasics_preSwiftOSDeploymentTarget_postSwiftOSTargetDevice() async throws {
8989
try await _testSwiftAppBasics(deploymentTargetVersion: "10.14.0", targetDeviceOSVersion: "11.0", targetDevicePlatformName: "macosx", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true)
9090
}
9191

92-
@Test(.requireSDKs(.macOS))
92+
@Test(.requireSDKs(.macOS), .requireXcode26())
9393
func swiftAppBasics_preSwiftOSDeploymentTarget_postSwiftOSTargetDevice_mixedPlatform() async throws {
9494
try await _testSwiftAppBasics(deploymentTargetVersion: "10.14.0", targetDeviceOSVersion: "14.0", targetDevicePlatformName: "iphoneos", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: false, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true)
9595
}
9696

97-
@Test(.requireSDKs(.macOS))
97+
@Test(.requireSDKs(.macOS), .requireXcode26())
9898
func swiftAppBasics_postSwiftOSDeploymentTarget_preSwiftConcurrencySupportedNatively() async throws {
9999
try await _testSwiftAppBasics(deploymentTargetVersion: "11.0", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true)
100100
}
101101

102-
@Test(.requireSDKs(.macOS), .userDefaults(["AllowRuntimeSearchPathAdditionForSwiftConcurrency": "0"]))
102+
@Test(.requireSDKs(.macOS), .requireXcode26(), .userDefaults(["AllowRuntimeSearchPathAdditionForSwiftConcurrency": "0"]))
103103
func swiftAppBasics_postSwiftOSDeploymentTarget_preSwiftConcurrencySupportedNatively_DisallowRpathInjection() async throws {
104104
try await _testSwiftAppBasics(deploymentTargetVersion: "11.0", shouldEmitSwiftRPath:true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true,
105105
missingSpanCompatibilitySuppressesRPath: true)

Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,8 +2800,8 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests {
28002800
/// Test task construction for a UI test target for iOS. Both debug and install builds are tested for the device, and a debug build is tested for the simulator.
28012801
///
28022802
/// This test is primarily intended to validate that building for iOS works, to check that the different bundle packaging for iOS is being handled, and to check some ways in which building for iOS differs from building for macOS. The corresponding macOS test dives deeper into checking details of the tasks.
2803-
@Test(.requireSDKs(.macOS, .iOS))
2804-
func uITestTarget_iOS() async throws {
2803+
@Test(.requireSDKs(.macOS, .iOS), .requireXcode26())
2804+
func uiTestTarget_iOS() async throws {
28052805
let testProject = try await TestProject(
28062806
"aProject",
28072807
groupTree: TestGroup(

0 commit comments

Comments
 (0)