Skip to content

Commit 0d89241

Browse files
committed
Enforce VALID_ARCHS for simulator platforms
This allows projects to build more smoothly across platforms when architectures like arm64e are unconditionally appended to ARCHS. Simulators have never supported arm64e in any capacity. rdar://123839235
1 parent bce6ce7 commit 0d89241

File tree

7 files changed

+6
-42
lines changed

7 files changed

+6
-42
lines changed

Sources/SWBApplePlatform/Plugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ struct AppleSettingsBuilderExtension: SettingsBuilderExtension {
239239
func addPlatformSDKSettings(_ platform: SWBCore.Platform?, _ sdk: SDK, _ sdkVariant: SDKVariant?) -> [String : String] { [:] }
240240
func xcconfigOverrideData(fromParameters: BuildParameters) -> ByteString { ByteString() }
241241
func getTargetTestingSwiftPluginFlags(_ scope: MacroEvaluationScope, toolchainRegistry: ToolchainRegistry, sdkRegistry: SDKRegistry, activeRunDestination: RunDestinationInfo?, project: SWBCore.Project?) -> [String] { [] }
242-
func shouldSkipPopulatingValidArchs(platform: SWBCore.Platform) -> Bool { false }
242+
func shouldSkipPopulatingValidArchs(platform: SWBCore.Platform, sdk: SDK?) -> Bool { false }
243243
func shouldDisableXOJITPreviews(platformName: String, sdk: SDK?) -> Bool { false }
244244
func overridingBuildSettings(_: MacroEvaluationScope, platform: SWBCore.Platform?, productType: ProductTypeSpec) -> [String : String] { [:] }
245245
}

Sources/SWBApplePlatform/Specs/iOSSimulator.xcspec

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@
4040
SortNumber = 107;
4141
},
4242

43-
{
44-
_Domain = iphonesimulator;
45-
Type = Architecture;
46-
Identifier = arm64e;
47-
PerArchBuildSettingName = "arm64e";
48-
SortNumber = 108;
49-
},
50-
5143
// DEPRECATED
5244

5345
{

Sources/SWBApplePlatform/Specs/tvOSSimulator.xcspec

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@
4949
SortNumber = 107;
5050
},
5151

52-
{
53-
_Domain = appletvsimulator;
54-
Type = Architecture;
55-
Identifier = arm64e;
56-
PerArchBuildSettingName = "arm64e";
57-
SortNumber = 108;
58-
},
59-
6052
// DEPRECATED
6153

6254
{

Sources/SWBApplePlatform/Specs/watchOSSimulator.xcspec

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@
4848
SortNumber = 107;
4949
},
5050

51-
{
52-
_Domain = watchsimulator;
53-
Type = Architecture;
54-
Identifier = arm64e;
55-
PerArchBuildSettingName = "arm64e";
56-
SortNumber = 108;
57-
},
58-
5951
// DEPRECATED
6052

6153
{

Sources/SWBApplePlatform/Specs/xrOSSimulator.xcspec

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@
4040
SortNumber = 107;
4141
},
4242

43-
{
44-
_Domain = xrsimulator;
45-
Type = Architecture;
46-
Identifier = arm64e;
47-
PerArchBuildSettingName = "arm64e";
48-
SortNumber = 108;
49-
},
50-
5143
// DEPRECATED
5244

5345
{

Sources/SWBCore/Extensions/SettingsBuilderExtension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public protocol SettingsBuilderExtension {
4848
// Provides a list of flags to configure testing plugins
4949
func getTargetTestingSwiftPluginFlags(_ scope: MacroEvaluationScope, toolchainRegistry: ToolchainRegistry, sdkRegistry: SDKRegistry, activeRunDestination: RunDestinationInfo?, project: Project?) -> [String]
5050
// Override valid architectures enforcement for a platform
51-
func shouldSkipPopulatingValidArchs(platform: Platform) -> Bool
51+
func shouldSkipPopulatingValidArchs(platform: Platform, sdk: SDK?) -> Bool
5252

5353
func shouldDisableXOJITPreviews(platformName: String, sdk: SDK?) -> Bool
5454

Sources/SWBCore/Settings/Settings.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,23 +2626,19 @@ private class SettingsBuilder {
26262626
core.pluginManager.extensions(of: SettingsBuilderExtensionPoint.self)
26272627
}
26282628

2629-
func shouldPopulateValidArchs(platform: Platform) -> Bool {
2629+
func shouldPopulateValidArchs(platform: Platform, sdk: SDK?) -> Bool {
26302630
// For now, we only do this for some platforms to avoid behavior changes.
26312631
// Later, we should extend this to more SDKs via <rdar://66001997>
26322632
switch platform.name {
26332633
case "macosx",
26342634
"iphoneos",
2635-
"iphonesimulator",
26362635
"appletvos",
2637-
"appletvsimulator",
26382636
"watchos",
2639-
"watchsimulator",
2640-
"xros",
2641-
"xrsimulator":
2637+
"xros":
26422638
return false
26432639
default:
26442640
for settingsExtension in settingsExtensions() {
2645-
if settingsExtension.shouldSkipPopulatingValidArchs(platform: platform) {
2641+
if settingsExtension.shouldSkipPopulatingValidArchs(platform: platform, sdk: sdk) {
26462642
return false
26472643
}
26482644
}
@@ -2651,7 +2647,7 @@ private class SettingsBuilder {
26512647
}
26522648

26532649
// VALID_ARCHS should be based on the SDK's SupportedTargets dictionary.
2654-
if let archs = sdkVariant?.archs, !archs.isEmpty, let platform, shouldPopulateValidArchs(platform: platform) {
2650+
if let archs = sdkVariant?.archs, !archs.isEmpty, let platform, shouldPopulateValidArchs(platform: platform, sdk: sdk) {
26552651
table.push(BuiltinMacros.VALID_ARCHS, literal: archs)
26562652
}
26572653

0 commit comments

Comments
 (0)