Skip to content

Enforce VALID_ARCHS for simulator platforms #538

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
May 30, 2025
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
2 changes: 1 addition & 1 deletion Sources/SWBApplePlatform/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ struct AppleSettingsBuilderExtension: SettingsBuilderExtension {
func addPlatformSDKSettings(_ platform: SWBCore.Platform?, _ sdk: SDK, _ sdkVariant: SDKVariant?) -> [String : String] { [:] }
func xcconfigOverrideData(fromParameters: BuildParameters) -> ByteString { ByteString() }
func getTargetTestingSwiftPluginFlags(_ scope: MacroEvaluationScope, toolchainRegistry: ToolchainRegistry, sdkRegistry: SDKRegistry, activeRunDestination: RunDestinationInfo?, project: SWBCore.Project?) -> [String] { [] }
func shouldSkipPopulatingValidArchs(platform: SWBCore.Platform) -> Bool { false }
func shouldSkipPopulatingValidArchs(platform: SWBCore.Platform, sdk: SDK?) -> Bool { false }
func shouldDisableXOJITPreviews(platformName: String, sdk: SDK?) -> Bool { false }
func overridingBuildSettings(_: MacroEvaluationScope, platform: SWBCore.Platform?, productType: ProductTypeSpec) -> [String : String] { [:] }
}
8 changes: 0 additions & 8 deletions Sources/SWBApplePlatform/Specs/iOSSimulator.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
SortNumber = 107;
},

{
_Domain = iphonesimulator;
Type = Architecture;
Identifier = arm64e;
PerArchBuildSettingName = "arm64e";
SortNumber = 108;
},

// DEPRECATED

{
Expand Down
8 changes: 0 additions & 8 deletions Sources/SWBApplePlatform/Specs/tvOSSimulator.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@
SortNumber = 107;
},

{
_Domain = appletvsimulator;
Type = Architecture;
Identifier = arm64e;
PerArchBuildSettingName = "arm64e";
SortNumber = 108;
},

// DEPRECATED

{
Expand Down
8 changes: 0 additions & 8 deletions Sources/SWBApplePlatform/Specs/watchOSSimulator.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@
SortNumber = 107;
},

{
_Domain = watchsimulator;
Type = Architecture;
Identifier = arm64e;
PerArchBuildSettingName = "arm64e";
SortNumber = 108;
},

// DEPRECATED

{
Expand Down
8 changes: 0 additions & 8 deletions Sources/SWBApplePlatform/Specs/xrOSSimulator.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
SortNumber = 107;
},

{
_Domain = xrsimulator;
Type = Architecture;
Identifier = arm64e;
PerArchBuildSettingName = "arm64e";
SortNumber = 108;
},

// DEPRECATED

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public protocol SettingsBuilderExtension {
// Provides a list of flags to configure testing plugins
func getTargetTestingSwiftPluginFlags(_ scope: MacroEvaluationScope, toolchainRegistry: ToolchainRegistry, sdkRegistry: SDKRegistry, activeRunDestination: RunDestinationInfo?, project: Project?) -> [String]
// Override valid architectures enforcement for a platform
func shouldSkipPopulatingValidArchs(platform: Platform) -> Bool
func shouldSkipPopulatingValidArchs(platform: Platform, sdk: SDK?) -> Bool

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

Expand Down
12 changes: 4 additions & 8 deletions Sources/SWBCore/Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2626,23 +2626,19 @@ private class SettingsBuilder {
core.pluginManager.extensions(of: SettingsBuilderExtensionPoint.self)
}

func shouldPopulateValidArchs(platform: Platform) -> Bool {
func shouldPopulateValidArchs(platform: Platform, sdk: SDK?) -> Bool {
// For now, we only do this for some platforms to avoid behavior changes.
// Later, we should extend this to more SDKs via <rdar://66001997>
switch platform.name {
case "macosx",
"iphoneos",
"iphonesimulator",
"appletvos",
"appletvsimulator",
"watchos",
"watchsimulator",
"xros",
"xrsimulator":
"xros":
return false
default:
for settingsExtension in settingsExtensions() {
if settingsExtension.shouldSkipPopulatingValidArchs(platform: platform) {
if settingsExtension.shouldSkipPopulatingValidArchs(platform: platform, sdk: sdk) {
return false
}
}
Expand All @@ -2651,7 +2647,7 @@ private class SettingsBuilder {
}

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

Expand Down