Skip to content

Commit f49864e

Browse files
Merge pull request #650 from jakepetroules/merge-6.2
Merge release/6.2 into main
2 parents e1ed897 + d92cb98 commit f49864e

22 files changed

+231
-92
lines changed

Sources/SWBApplePlatform/Specs/MetalCompiler.xcspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@
252252
Metal30,
253253
Metal31,
254254
Metal32,
255+
Metal40,
255256
);
256257
Category = BuildOptions;
257258
},
@@ -272,6 +273,7 @@
272273
Metal30,
273274
Metal31,
274275
Metal32,
276+
Metal40,
275277
);
276278
CommandLineArgs = {
277279
UseDeploymentTarget = ( );
@@ -286,6 +288,7 @@
286288
Metal30 = ( "-std=metal3.0", );
287289
Metal31 = ( "-std=metal3.1", );
288290
Metal32 = ( "-std=metal3.2", );
291+
Metal40 = ( "-std=metal4.0", );
289292
};
290293
},
291294
{

Sources/SWBApplePlatform/Specs/MetalLinker.xcspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
Metal30 = ( "-std=metal3.0", );
8484
Metal31 = ( "-std=metal3.1", );
8585
Metal32 = ( "-std=metal3.2", );
86+
Metal40 = ( "-std=metal4.0", );
8687
};
8788
},
8889
{

Sources/SWBApplePlatform/Specs/en.lproj/com.apple.compilers.metal.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
"[MTL_LANGUAGE_REVISION]-description-[Metal31]" = "Metal 3.1";
9191
"[MTL_LANGUAGE_REVISION]-value-[Metal32]" = "Metal 3.2";
9292
"[MTL_LANGUAGE_REVISION]-description-[Metal32]" = "Metal 3.2";
93+
"[MTL_LANGUAGE_REVISION]-value-[Metal40]" = "Metal 4.0";
94+
"[MTL_LANGUAGE_REVISION]-description-[Metal40]" = "Metal 4.0";
9395

9496
"[MTL_ENABLE_DEBUG_INFO]-name" = "Produce Debugging Information";
9597
"[MTL_ENABLE_DEBUG_INFO]-description" = "Debugging information is required for shader debugging and profiling.";

Sources/SWBApplePlatform/Specs/macOSCoreBuildSystem.xcspec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
DefaultValue = "";
3131
Category = "Deployment";
3232
},
33+
{ Name = "REGISTER_APP_GROUPS";
34+
Type = Boolean;
35+
DefaultValue = NO;
36+
Category = "Code Signing";
37+
Description = "Register app groups in profiles.";
38+
},
3339
);
3440
},
3541

Sources/SWBApplePlatform/Specs/macOSNativeBuildSystem.xcspec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
Category = "Deployment";
3232
Description = "Path to a file specifying additional requirements for a product archive.";
3333
},
34+
{ Name = "REGISTER_APP_GROUPS";
35+
Type = Boolean;
36+
DefaultValue = NO;
37+
Category = "Code Signing";
38+
Description = "Register app groups in profiles.";
39+
},
3440
);
3541
}
3642
)

Sources/SWBCore/PlatformRegistry.swift

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ public final class Platform: Sendable {
7373
/// Minimum OS version for Swift-in-the-OS support. If this is `nil`, the platform does not support Swift-in-the-OS at all.
7474
fileprivate(set) var minimumOSForSwiftInTheOS: Version? = nil
7575

76-
/// Minimum OS version for built-in Swift concurrency support. If this is `nil`, the platform does not support Swift concurrency at all.
76+
/// Minimum OS version for Swift concurrency (Swift 5.5). If this is `nil`, the platform does not support Swift concurrency at all.
7777
fileprivate(set) var minimumOSForSwiftConcurrency: Version? = nil
7878

79+
/// Minimum OS version for Span in the standard library (Swift 6.2). If this is `nil`, Span, MutableSpan, and related types are not available.
80+
fileprivate(set) var minimumOSForSwiftSpan: Version? = nil
81+
7982
/// The canonical name of the public SDK for this platform.
8083
/// - remark: This does not mean that this SDK exists, just that this is its canonical name if it does exist.
8184
@_spi(Testing) public let sdkCanonicalName: String?
@@ -244,6 +247,11 @@ extension Platform {
244247
return self.minimumOSForSwiftConcurrency ?? self.correspondingDevicePlatform?.minimumOSForSwiftConcurrency ?? nil
245248
}
246249

250+
/// Determines the deployment version to use for Swift Span support.
251+
fileprivate func swiftOSSpanVersion(_ deploymentTarget: StringMacroDeclaration) -> Version? {
252+
return self.minimumOSForSwiftSpan ?? self.correspondingDevicePlatform?.minimumOSForSwiftSpan ?? nil
253+
}
254+
247255
/// Determines if the platform supports Swift in the OS.
248256
public func supportsSwiftInTheOS(_ scope: MacroEvaluationScope, forceNextMajorVersion: Bool = false, considerTargetDeviceOSVersion: Bool = true) -> Bool {
249257
guard let deploymentTarget = self.deploymentTargetMacro else { return false }
@@ -265,7 +273,7 @@ extension Platform {
265273
return version >= minimumSwiftInTheOSVersion
266274
}
267275

268-
/// Determines if the platform natively supports Swift concurrency. If `false`, then the Swift back-compat concurrency libs needs to be copied into the app/framework's bundle.
276+
/// Determines if the platform natively supports Swift concurrency. If `false`, then the Swift concurrency back-compat concurrency libs needs to be copied into the app/framework's bundle.
269277
public func supportsSwiftConcurrencyNatively(_ scope: MacroEvaluationScope, forceNextMajorVersion: Bool = false, considerTargetDeviceOSVersion: Bool = true) -> Bool? {
270278
guard let deploymentTarget = self.deploymentTargetMacro else { return false }
271279

@@ -287,6 +295,29 @@ extension Platform {
287295

288296
return version >= minimumSwiftConcurrencyVersion
289297
}
298+
299+
/// Determines if the platform natively supports Swift 6.2's Span type. If `false`, then the Swift Span back-compat lib needs to be copied into the app/framework's bundle.
300+
public func supportsSwiftSpanNatively(_ scope: MacroEvaluationScope, forceNextMajorVersion: Bool, considerTargetDeviceOSVersion: Bool) -> Bool? {
301+
guard let deploymentTarget = self.deploymentTargetMacro else { return false }
302+
303+
// If we have target device info and its platform matches the build platform, compare the device OS version
304+
let targetDeviceVersion: Version?
305+
if considerTargetDeviceOSVersion && scope.evaluate(BuiltinMacros.TARGET_DEVICE_PLATFORM_NAME) == self.name {
306+
targetDeviceVersion = try? Version(scope.evaluate(BuiltinMacros.TARGET_DEVICE_OS_VERSION))
307+
} else {
308+
targetDeviceVersion = nil
309+
}
310+
311+
// Otherwise fall back to comparing the minimum deployment target
312+
let deploymentTargetVersion = try? Version(scope.evaluate(deploymentTarget))
313+
314+
guard let version = targetDeviceVersion ?? deploymentTargetVersion else { return false }
315+
316+
// Return `nil` here as there is no metadata for the platform to allow downstream clients to be aware of this.
317+
guard let minimumSwiftSpanVersion = swiftOSSpanVersion(deploymentTarget) else { return nil }
318+
319+
return version >= minimumSwiftSpanVersion
320+
}
290321
}
291322

292323
extension Platform: CustomStringConvertible {
@@ -633,6 +664,7 @@ public final class PlatformRegistry {
633664
if let variant = platform.defaultSDKVariant {
634665
platform.minimumOSForSwiftInTheOS = variant.minimumOSForSwiftInTheOS
635666
platform.minimumOSForSwiftConcurrency = variant.minimumOSForSwiftConcurrency
667+
platform.minimumOSForSwiftSpan = variant.minimumOSForSwiftSpan
636668
}
637669
}
638670

Sources/SWBCore/SDKRegistry.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,12 @@ public final class SDKVariant: PlatformInfoProvider, Sendable {
313313
/// Minimum OS version for Swift-in-the-OS support. If this is `nil`, the platform does not support Swift-in-the-OS at all.
314314
public let minimumOSForSwiftInTheOS: Version?
315315

316-
/// Minimum OS version for built-in Swift concurrency support. If this is `nil`, the platform does not support Swift concurrency at all.
316+
/// Minimum OS version for built-in Swift concurrency support (Swift 5.5). If this is `nil`, the platform does not support Swift concurrency at all.
317317
public let minimumOSForSwiftConcurrency: Version?
318318

319+
/// Minimum OS version for built-in Swift Span support (Swift 6.2). If this is `nil`, the platform does not support Swift Span at all.
320+
public let minimumOSForSwiftSpan: Version?
321+
319322
/// The path prefix under which all built content produced by this SDK variant should be installed, relative to the system root.
320323
///
321324
/// Empty string if content should be installed directly into the system root (default).
@@ -392,9 +395,10 @@ public final class SDKVariant: PlatformInfoProvider, Sendable {
392395

393396
self.clangRuntimeLibraryPlatformName = supportedTargetDict["ClangRuntimeLibraryPlatformName"]?.stringValue ?? Self.fallbackClangRuntimeLibraryPlatformName(variantName: name)
394397

395-
let (os, concurrency) = Self.fallbackSwiftVersions(variantName: name)
398+
let (os, concurrency, span) = Self.fallbackSwiftVersions(variantName: name)
396399
self.minimumOSForSwiftInTheOS = try (supportedTargetDict["SwiftOSRuntimeMinimumDeploymentTarget"]?.stringValue ?? os).map { try Version($0) }
397400
self.minimumOSForSwiftConcurrency = try (supportedTargetDict["SwiftConcurrencyMinimumDeploymentTarget"]?.stringValue ?? concurrency).map { try Version($0) }
401+
self.minimumOSForSwiftSpan = try (supportedTargetDict["SwiftSpanMinimumDeploymentTarget"]?.stringValue ?? span).map { try Version($0) }
398402

399403
self.systemPrefix = supportedTargetDict["SystemPrefix"]?.stringValue ?? {
400404
switch name {
@@ -445,12 +449,12 @@ public final class SDKVariant: PlatformInfoProvider, Sendable {
445449
}
446450
}
447451

448-
private static func fallbackSwiftVersions(variantName name: String) -> (String?, String?) {
452+
private static func fallbackSwiftVersions(variantName name: String) -> (os: String?, concurrency: String?, span: String?) {
449453
switch name {
450454
case "macos", "macosx":
451-
return ("10.14.4", "12.0")
455+
return ("10.14.4", "12.0", "26.0")
452456
default:
453-
return (nil, nil)
457+
return (nil, nil, "26.0")
454458
}
455459
}
456460

Sources/SWBCore/SWBFeatureFlag.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,5 @@ public enum SWBFeatureFlag {
157157

158158
public static let enableCacheMetricsLogs = SWBFeatureFlagProperty("EnableCacheMetricsLogs", defaultValue: false)
159159

160-
public static let enableAppSandboxConflictingValuesEmitsWarning = SWBFeatureFlagProperty("AppSandboxConflictingValuesEmitsWarning", defaultValue: false)
160+
public static let enableAppSandboxConflictingValuesEmitsWarning = SWBFeatureFlagProperty("AppSandboxConflictingValuesEmitsWarning", defaultValue: true)
161161
}

Sources/SWBCore/Settings/BuiltinMacros.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ public final class BuiltinMacros {
602602
public static let DISABLE_INFOPLIST_PLATFORM_PROCESSING = BuiltinMacros.declareBooleanMacro("DISABLE_INFOPLIST_PLATFORM_PROCESSING")
603603
public static let DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING = BuiltinMacros.declareBooleanMacro("DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING")
604604
public static let DISABLE_STALE_FILE_REMOVAL = BuiltinMacros.declareBooleanMacro("DISABLE_STALE_FILE_REMOVAL")
605+
public static let DISABLE_SWIFT_SPAN_COMPATIBILITY_RPATH = BuiltinMacros.declareBooleanMacro("DISABLE_SWIFT_SPAN_COMPATIBILITY_RPATH")
605606
public static let DISABLE_TEST_HOST_PLATFORM_PROCESSING = BuiltinMacros.declareBooleanMacro("DISABLE_TEST_HOST_PLATFORM_PROCESSING")
606607
public static let DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION = BuiltinMacros.declareBooleanMacro("DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION")
607608
public static let DONT_CREATE_BUILT_PRODUCTS_DIR_SYMLINKS = BuiltinMacros.declareBooleanMacro("DONT_CREATE_BUILT_PRODUCTS_DIR_SYMLINKS")
@@ -1620,6 +1621,7 @@ public final class BuiltinMacros {
16201621
DISABLE_INFOPLIST_PLATFORM_PROCESSING,
16211622
DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING,
16221623
DISABLE_STALE_FILE_REMOVAL,
1624+
DISABLE_SWIFT_SPAN_COMPATIBILITY_RPATH,
16231625
DISABLE_TEST_HOST_PLATFORM_PROCESSING,
16241626
DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION,
16251627
DOCC_ARCHIVE_PATH,

Sources/SWBCore/Settings/Settings.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ fileprivate struct PreOverridesSettings {
146146
table.push(BuiltinMacros.LM_SKIP_METADATA_EXTRACTION, BuiltinMacros.namespace.parseString("YES"))
147147
}
148148

149+
// This is a hack to prevent Span back deployment from causing excessive test churn when using an older Xcode in Swift CI.
150+
if core.xcodeProductBuildVersion <= (try! ProductBuildVersion("17A1")) {
151+
table.push(BuiltinMacros.DISABLE_SWIFT_SPAN_COMPATIBILITY_RPATH, BuiltinMacros.namespace.parseString("YES"))
152+
}
153+
149154
// Add the "calculated" settings.
150155
addCalculatedUniversalDefaults(&table)
151156

0 commit comments

Comments
 (0)