diff --git a/Sources/SWBCore/PlatformRegistry.swift b/Sources/SWBCore/PlatformRegistry.swift index 16910753..013e76f7 100644 --- a/Sources/SWBCore/PlatformRegistry.swift +++ b/Sources/SWBCore/PlatformRegistry.swift @@ -546,13 +546,6 @@ public final class PlatformRegistry { var defaultSettings: [String: PropertyListItem] = [:] if case .plDict(let defaultSettingsItems)? = items["DefaultProperties"] { defaultSettings = defaultSettingsItems - - // Rev-lock: rdar://85769354 (Remove DEPLOYMENT_TARGET_CLANG_* properties from SDK) - for macroName in [ - "DEPLOYMENT_TARGET_CLANG_ENV_NAME", - "DEPLOYMENT_TARGET_CLANG_FLAG_NAME", - "DEPLOYMENT_TARGET_CLANG_FLAG_PREFIX", - ] { defaultSettings.removeValue(forKey: macroName) } } // Parse whether this is a deployment platform. diff --git a/Sources/SWBCore/SDKRegistry.swift b/Sources/SWBCore/SDKRegistry.swift index 3a8dc465..f7c584b8 100644 --- a/Sources/SWBCore/SDKRegistry.swift +++ b/Sources/SWBCore/SDKRegistry.swift @@ -383,7 +383,7 @@ public final class SDKVariant: PlatformInfoProvider, Sendable { self.validDeploymentTargets = validDeploymentTargets // The recommended deployment target is the default deployment target for the platform, unless we've overridden to a more specific value. - self.recommendedDeploymentTarget = (try? Version(supportedTargetDict["RecommendedDeploymentTarget"]?.stringValue ?? Self.fallbackRecommendedDeploymentTarget(variantName: name) ?? "")) ?? defaultDeploymentTarget + self.recommendedDeploymentTarget = (try? Version(supportedTargetDict["RecommendedDeploymentTarget"]?.stringValue ?? "")) ?? defaultDeploymentTarget self.llvmTargetTripleEnvironment = supportedTargetDict["LLVMTargetTripleEnvironment"]?.stringValue self.llvmTargetTripleSys = supportedTargetDict["LLVMTargetTripleSys"]?.stringValue @@ -398,90 +398,17 @@ public final class SDKVariant: PlatformInfoProvider, Sendable { self.targetOSMacroName = nil } - self.deviceFamilies = try DeviceFamilies(families: PropertyList.decode([DeviceFamily].self, from: supportedTargetDict["DeviceFamilies"] ?? Self.fallbackDeviceFamiliesData(variantName: name))) + self.deviceFamilies = try DeviceFamilies(families: PropertyList.decode([DeviceFamily].self, from: supportedTargetDict["DeviceFamilies"] ?? [])) - self.clangRuntimeLibraryPlatformName = supportedTargetDict["ClangRuntimeLibraryPlatformName"]?.stringValue ?? Self.fallbackClangRuntimeLibraryPlatformName(variantName: name) + self.clangRuntimeLibraryPlatformName = supportedTargetDict["ClangRuntimeLibraryPlatformName"]?.stringValue - let (os, concurrency, span) = Self.fallbackSwiftVersions(variantName: name) - self.minimumOSForSwiftInTheOS = try (supportedTargetDict["SwiftOSRuntimeMinimumDeploymentTarget"]?.stringValue ?? os).map { try Version($0) } - self.minimumOSForSwiftConcurrency = try (supportedTargetDict["SwiftConcurrencyMinimumDeploymentTarget"]?.stringValue ?? concurrency).map { try Version($0) } - self.minimumOSForSwiftSpan = try (supportedTargetDict["SwiftSpanMinimumDeploymentTarget"]?.stringValue ?? span).map { try Version($0) } + self.minimumOSForSwiftInTheOS = try (supportedTargetDict["SwiftOSRuntimeMinimumDeploymentTarget"]?.stringValue).map { try Version($0) } + self.minimumOSForSwiftConcurrency = try (supportedTargetDict["SwiftConcurrencyMinimumDeploymentTarget"]?.stringValue).map { try Version($0) } + self.minimumOSForSwiftSpan = try (supportedTargetDict["SwiftSpanMinimumDeploymentTarget"]?.stringValue).map { try Version($0) } self.systemPrefix = supportedTargetDict["SystemPrefix"]?.stringValue ?? "" } - private static func fallbackDeviceFamiliesData(variantName name: String) throws -> PropertyListItem { - switch name { - case "macos", "macosx": - return .plArray([ - .plDict([ - "Name": .plString("mac"), - "DisplayName": .plString("Mac"), - ]) - ]) - case MacCatalystInfo.sdkVariantName: - return .plArray([ - .plDict([ - "Identifier": .plInt(2), - "Name": .plString("pad"), - "DisplayName": .plString("iPad"), - ]), - .plDict([ - "Identifier": .plInt(6), - "Name": .plString("mac"), - "DisplayName": .plString("Mac"), - ]) - ]) - default: - // Other platforms don't have device families - return .plArray([]) - } - } - - private static func fallbackClangRuntimeLibraryPlatformName(variantName name: String) -> String? { - switch name { - case "macos", "macosx", MacCatalystInfo.sdkVariantName: - return "osx" - default: - return nil - } - } - - private static func fallbackSwiftVersions(variantName name: String) -> (os: String?, concurrency: String?, span: String?) { - switch name { - case "macos", "macosx": - return ("10.14.4", "12.0", "26.0") - default: - return (nil, nil, "26.0") - } - } - - private static func fallbackRecommendedDeploymentTarget(variantName name: String) -> String? { - switch name { - // 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. - case "macos", "macosx": - return "10.14.6" - case "iphoneos", "iphonesimulator": - return "12.5" - case "appletvos", "appletvsimulator": - return "12.4" - case "watchos", "watchsimulator": - return "5.3" - - // No Summer 2019 aligned versions since these were first introduced on or after Fall 2019, so simply use the minimum versions. - case "driverkit": - return "19.0" - case MacCatalystInfo.sdkVariantName: - return "13.1" - case "xros", "xrsimulator": - return "1.0" - - // Fall back to the default deployment target, which is equal to the SDK version. - default: - return nil - } - } - /// Perform late binding of the build settings. This is a private function that may only be invoked once for any given SDK variant. /// - Parameters: /// - associatedTypesForKeysMatching: Passed to `MacroNamespace.parseTable` - refer there for more info. @@ -761,14 +688,12 @@ public final class SDKRegistry: SDKRegistryLookup, CustomStringConvertible, Send var defaultSettings: [String: PropertyListItem] = [:] if case .plDict(let settingsItems)? = items["DefaultProperties"] { defaultSettings = filteredSettings(settingsItems) - .filter { $0.key != "TEST_FRAMEWORK_DEVELOPER_VARIANT_SUBPATH" } // rdar://107954685 (Remove watchOS special case for testing framework paths) } // Parse the custom properties settings. var overrideSettings: [String: PropertyListItem] = [:] if case .plDict(let settingsItems)? = items["CustomProperties"] { overrideSettings = filteredSettings(settingsItems) - .filter { !$0.key.hasPrefix("SWIFT_MODULE_ONLY_") } // Rev-lock: don't set SWIFT_MODULE_ONLY_ in SDKs } // 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. diff --git a/Sources/SWBCore/Settings/BuiltinMacros.swift b/Sources/SWBCore/Settings/BuiltinMacros.swift index 49adb0f5..a150cc57 100644 --- a/Sources/SWBCore/Settings/BuiltinMacros.swift +++ b/Sources/SWBCore/Settings/BuiltinMacros.swift @@ -120,6 +120,7 @@ public final class BuiltinMacros { public static let HOST_PLATFORM = BuiltinMacros.declareStringMacro("HOST_PLATFORM") public static let IOS_UNZIPPERED_TWIN_PREFIX_PATH = BuiltinMacros.declareStringMacro("IOS_UNZIPPERED_TWIN_PREFIX_PATH") public static let IPHONEOS_DEPLOYMENT_TARGET = BuiltinMacros.declareStringMacro("IPHONEOS_DEPLOYMENT_TARGET") + public static let MACOS_UNZIPPERED_TWIN_PREFIX_PATH = BuiltinMacros.declareStringMacro("MACOS_UNZIPPERED_TWIN_PREFIX_PATH") public static let MACOSX_DEPLOYMENT_TARGET = BuiltinMacros.declareStringMacro("MACOSX_DEPLOYMENT_TARGET") public static let NATIVE_ARCH = BuiltinMacros.declareStringMacro("NATIVE_ARCH") public static let NATIVE_ARCH_32_BIT = BuiltinMacros.declareStringMacro("NATIVE_ARCH_32_BIT") @@ -1993,6 +1994,7 @@ public final class BuiltinMacros { MACOS_CREATOR_ARG, MACOS_TYPE, MACOS_TYPE_ARG, + MACOS_UNZIPPERED_TWIN_PREFIX_PATH, MAC_OS_X_PRODUCT_BUILD_VERSION, MAC_OS_X_VERSION_ACTUAL, MAC_OS_X_VERSION_MAJOR, diff --git a/Sources/SWBCore/Settings/Settings.swift b/Sources/SWBCore/Settings/Settings.swift index cc6f3283..4ab5f84d 100644 --- a/Sources/SWBCore/Settings/Settings.swift +++ b/Sources/SWBCore/Settings/Settings.swift @@ -2524,6 +2524,11 @@ private class SettingsBuilder: ProjectMatchLookup { platformTable.push(BuiltinMacros.PLATFORM_DEVELOPER_USR_DIR, Static { BuiltinMacros.namespace.parseString("$(DEVELOPER_USR_DIR)") }) platformTable.push(BuiltinMacros.PLATFORM_DEVELOPER_BIN_DIR, Static { BuiltinMacros.namespace.parseString("$(DEVELOPER_BIN_DIR)") }) platformTable.push(BuiltinMacros.PLATFORM_DEVELOPER_SDK_DIR, Static { BuiltinMacros.namespace.parseString("$(DEVELOPER_SDK_DIR)") }) + + // Set twin prefix paths in macOS for Mac Catalyst. + platformTable.push(BuiltinMacros.MACOS_UNZIPPERED_TWIN_PREFIX_PATH, literal: "") + platformTable.push(BuiltinMacros.IOS_UNZIPPERED_TWIN_PREFIX_PATH, literal: "/System/iOSSupport") + } else { platformTable.push(BuiltinMacros.PLATFORM_DEVELOPER_APPLICATIONS_DIR, literal: "\(platform.path.str)/Developer/Applications") platformTable.push(BuiltinMacros.PLATFORM_DEVELOPER_TOOLS_DIR, literal: "\(platform.path.str)/Developer/Tools") @@ -2585,11 +2590,6 @@ private class SettingsBuilder: ProjectMatchLookup { sdkTable.pushContentsOf(defaultSettingsTable) } - // Set IOS_UNZIPPERED_TWIN_PREFIX_PATH to the Mac Catalyst variant's prefix path, even for the macOS variant. - if let macCatalystVariant = sdk.variant(for: MacCatalystInfo.sdkVariantName) { - sdkTable.push(BuiltinMacros.IOS_UNZIPPERED_TWIN_PREFIX_PATH, literal: macCatalystVariant.systemPrefix) - } - // Add the settings provided by the SDK variant, if there is one. if let variant { // Late-bound by `SDKRegistry.loadExtendedInfo` and may be nil if an error (which will have already been reported) was encountered during loading. diff --git a/Sources/SWBTaskConstruction/ProductPlanning/ProductPlan.swift b/Sources/SWBTaskConstruction/ProductPlanning/ProductPlan.swift index db7e6c7e..166fa406 100644 --- a/Sources/SWBTaskConstruction/ProductPlanning/ProductPlan.swift +++ b/Sources/SWBTaskConstruction/ProductPlanning/ProductPlan.swift @@ -467,6 +467,10 @@ package final class GlobalProductPlan: GlobalTargetInfoProvider } let settings = buildRequestContext.getCachedSettings(configuredTarget.parameters, target: configuredTarget.target, provisioningTaskInputs: provisioningInputs[configuredTarget]) let scope = settings.globalScope + let specLookupContext = SpecLookupCtxt(specRegistry: workspaceContext.core.specRegistry, platform: settings.platform) + guard let artifactBundleFileType = specLookupContext.lookupFileType(identifier: "wrapper.artifactbundle") else { + continue + } // Parse artifact bundle info from any bundles this target directly depends upon. // @@ -480,7 +484,8 @@ package final class GlobalProductPlan: GlobalTargetInfoProvider guard case .reference(let referenceGUID) = buildFile.buildableItem else { continue } guard let reference = workspaceContext.workspace.lookupReference(for: referenceGUID) else { continue } let resolvedPath = settings.filePathResolver.resolveAbsolutePath(reference) - if resolvedPath.fileExtension == "artifactbundle" { + // TODO: Remove the fileExtension check once SwiftPM has been updated to consistently set the file type on artifact bundle references in PIF + if resolvedPath.fileExtension == "artifactbundle" || specLookupContext.lookupFileType(reference: reference)?.conformsTo(artifactBundleFileType) == true { do { let metadata = try metadataCache.getOrInsert(resolvedPath) { try ArtifactBundleMetadata.parse(at: resolvedPath, fileSystem: buildRequestContext.fs) diff --git a/Sources/SWBUniversalPlatform/Specs/Clang.xcspec b/Sources/SWBUniversalPlatform/Specs/Clang.xcspec index 38df870c..89e1aa1a 100644 --- a/Sources/SWBUniversalPlatform/Specs/Clang.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Clang.xcspec @@ -3257,6 +3257,7 @@ Architectures = ( x86_64, x86_64h, + aarch64, arm64, arm64e, ); diff --git a/Sources/SWBUniversalPlatform/Specs/Ld.xcspec b/Sources/SWBUniversalPlatform/Specs/Ld.xcspec index 40022fee..6f0b4f32 100644 --- a/Sources/SWBUniversalPlatform/Specs/Ld.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Ld.xcspec @@ -609,6 +609,7 @@ Architectures = ( x86_64, x86_64h, + aarch64, arm64, arm64e, ); @@ -628,6 +629,7 @@ Architectures = ( x86_64, x86_64h, + aarch64, arm64, arm64e, ); diff --git a/Sources/SWBUniversalPlatform/Specs/Swift.xcspec b/Sources/SWBUniversalPlatform/Specs/Swift.xcspec index ba60e9b1..384b099b 100644 --- a/Sources/SWBUniversalPlatform/Specs/Swift.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Swift.xcspec @@ -1253,6 +1253,7 @@ Architectures = ( x86_64, x86_64h, + aarch64, arm64, arm64e, ); diff --git a/Sources/SwiftBuild/ConsoleCommands/SWBServiceConsoleBuildCommandProtocol.swift b/Sources/SwiftBuild/ConsoleCommands/SWBServiceConsoleBuildCommandProtocol.swift index c1ca969a..585b9c43 100644 --- a/Sources/SwiftBuild/ConsoleCommands/SWBServiceConsoleBuildCommandProtocol.swift +++ b/Sources/SwiftBuild/ConsoleCommands/SWBServiceConsoleBuildCommandProtocol.swift @@ -24,20 +24,44 @@ public enum SwiftBuildMessage { /// Event indicating that the service is about to start a planning operation. public struct PlanningOperationStartedInfo { public let planningOperationID: String + + @_spi(Testing) + public init(planningOperationID: String) { + self.planningOperationID = planningOperationID + } } /// Event indicating that the service finished running a planning operation. public struct PlanningOperationCompletedInfo { public let planningOperationID: String + + @_spi(Testing) + public init(planningOperationID: String) { + self.planningOperationID = planningOperationID + } } public struct ReportBuildDescriptionInfo { public let buildDescriptionID: String + + @_spi(Testing) + public init(buildDescriptionID: String) { + self.buildDescriptionID = buildDescriptionID + } } public struct ReportPathMapInfo { public let copiedPathMap: [AbsolutePath: AbsolutePath] public let generatedFilesPathMap: [AbsolutePath: AbsolutePath] + + @_spi(Testing) + public init( + copiedPathMap: [AbsolutePath: AbsolutePath], + generatedFilesPathMap: [AbsolutePath: AbsolutePath] + ) { + self.copiedPathMap = copiedPathMap + self.generatedFilesPathMap = generatedFilesPathMap + } } /// Wrapper for information provided about a 'prepare-for-index' operation. @@ -45,10 +69,24 @@ public enum SwiftBuildMessage { public struct ResultInfo { /// The timestamp of the 'prepare-for-index' marker node. public let timestamp: Date + + @_spi(Testing) + public init(timestamp: Date) { + self.timestamp = timestamp + } } public let targetGUID: String public let resultInfo: ResultInfo + + @_spi(Testing) + public init( + targetGUID: String, + resultInfo: ResultInfo + ) { + self.targetGUID = targetGUID + self.resultInfo = resultInfo + } } public enum LocationContext { @@ -62,6 +100,15 @@ public enum SwiftBuildMessage { // Consider replacing with a target signature in the future. public let targetID: Int? public let taskSignature: String? + + @_spi(Testing) + public init( + targetID: Int? = nil, + taskSignature: String? = nil + ) { + self.targetID = targetID + self.taskSignature = taskSignature + } } /// Wrapper for information provided about a diagnostic during the build. @@ -103,6 +150,15 @@ public enum SwiftBuildMessage { public struct BuildFileAndPhase { public let buildFileGUID: String public let buildPhaseGUID: String + + @_spi(Testing) + public init( + buildFileGUID: String, + buildPhaseGUID: String + ) { + self.buildFileGUID = buildFileGUID + self.buildPhaseGUID = buildPhaseGUID + } } /// Represents a build file diagnostic location, within a particular target and project. @@ -135,6 +191,21 @@ public enum SwiftBuildMessage { public let startColumn: Int public let endLine: Int public let endColumn: Int + + @_spi(Testing) + public init( + path: String, + startLine: Int, + startColumn: Int, + endLine: Int, + endColumn: Int + ) { + self.path = path + self.startLine = startLine + self.startColumn = startColumn + self.endLine = endLine + self.endColumn = endColumn + } } public let sourceRanges: [SourceRange] @@ -145,9 +216,45 @@ public enum SwiftBuildMessage { /// The new text to replace the range. May be an empty string for pure delete. public let textToInsert: String + + @_spi(Testing) + public init( + sourceRange: SourceRange, + textToInsert: String + ) { + self.sourceRange = sourceRange + self.textToInsert = textToInsert + } } public let fixIts: [FixIt] + + @_spi(Testing) + public init( + kind: Kind, + location: Location, + locationContext: LocationContext, + locationContext2: LocationContext2, + component: Component, + message: String, + optionName: String? = nil, + appendToOutputStream: Bool, + childDiagnostics: [DiagnosticInfo] = [], + sourceRanges: [SourceRange] = [], + fixIts: [FixIt] = [] + ) { + self.kind = kind + self.location = location + self.locationContext = locationContext + self.locationContext2 = locationContext2 + self.component = component + self.message = message + self.optionName = optionName + self.appendToOutputStream = appendToOutputStream + self.childDiagnostics = childDiagnostics + self.sourceRanges = sourceRanges + self.fixIts = fixIts + } } public struct OutputInfo { @@ -156,15 +263,40 @@ public enum SwiftBuildMessage { @available(*, deprecated, message: "Use locationContext2 instead") public let locationContext: LocationContext public let locationContext2: LocationContext2 + + @_spi(Testing) + public init( + data: Data, + locationContext: LocationContext, + locationContext2: LocationContext2 + ) { + self.data = data + self.locationContext = locationContext + self.locationContext2 = locationContext2 + } } public struct BuildStartedInfo { public let baseDirectory: AbsolutePath public let derivedDataPath: AbsolutePath? + + @_spi(Testing) + public init( + baseDirectory: AbsolutePath, + derivedDataPath: AbsolutePath? = nil + ) { + self.baseDirectory = baseDirectory + self.derivedDataPath = derivedDataPath + } } public struct BuildDiagnosticInfo { public let message: String + + @_spi(Testing) + public init(message: String) { + self.message = message + } } public struct BuildOperationMetrics { @@ -172,6 +304,15 @@ public enum SwiftBuildMessage { /// The key is the first component of task rule info, a.k.a. the rule info type public let taskCounters: [String: [String: Int]] + + @_spi(Testing) + public init( + counters: [String: Int], + taskCounters: [String: [String: Int]] + ) { + self.counters = counters + self.taskCounters = taskCounters + } } public struct BuildCompletedInfo { @@ -184,14 +325,31 @@ public enum SwiftBuildMessage { public let result: Result public let metrics: BuildOperationMetrics? + + @_spi(Testing) + public init( + result: Result, + metrics: BuildOperationMetrics? = nil + ) { + self.result = result + self.metrics = metrics + } } public struct BuildOutputInfo { public let data: String + + @_spi(Testing) + public init(data: String) { + self.data = data + } } /// Event indicating that the "build preparation" phase is complete. public struct PreparationCompleteInfo { + @_spi(Testing) + public init() { + } } /// Event indicating a high-level status message and percentage completion across the entire build operation, suitable for display in a user interface. @@ -200,11 +358,29 @@ public enum SwiftBuildMessage { public let percentComplete: Double public let showInLog: Bool public let targetName: String? + + @_spi(Testing) + public init( + message: String, + percentComplete: Double, + showInLog: Bool, + targetName: String? = nil + ) { + self.message = message + self.percentComplete = percentComplete + self.showInLog = showInLog + self.targetName = targetName + } } /// Event indicating that a target was already up to date and did not need to be built. public struct TargetUpToDateInfo { public let guid: PIF.GUID + + @_spi(Testing) + public init(guid: PIF.GUID) { + self.guid = guid + } } /// Event indicating that a target has started building. @@ -250,16 +426,57 @@ public enum SwiftBuildMessage { /// The canonical name of the SDK in use, if any. public let sdkroot: String? + + @_spi(Testing) + public init( + targetID: Int, + targetGUID: PIF.GUID, + targetName: String, + type: Kind, + projectName: String, + projectPath: AbsolutePath, + projectIsPackage: Bool, + projectNameIsUniqueInWorkspace: Bool, + configurationName: String, + configurationIsDefault: Bool, + sdkroot: String? = nil + ) { + self.targetID = targetID + self.targetGUID = targetGUID + self.targetName = targetName + self.type = type + self.projectName = projectName + self.projectPath = projectPath + self.projectIsPackage = projectIsPackage + self.projectNameIsUniqueInWorkspace = projectNameIsUniqueInWorkspace + self.configurationName = configurationName + self.configurationIsDefault = configurationIsDefault + self.sdkroot = sdkroot + } } public struct TargetOutputInfo { public let targetID: Int public let data: String + + @_spi(Testing) + public init( + targetID: Int, + data: String + ) { + self.targetID = targetID + self.data = data + } } /// Event indicating that a target has finished building. public struct TargetCompleteInfo { public let targetID: Int + + @_spi(Testing) + public init(targetID: Int) { + self.targetID = targetID + } } /// Event indicating that a task was already up to date and did not need to be built. @@ -271,6 +488,17 @@ public enum SwiftBuildMessage { public let targetID: Int? public let taskSignature: String public let parentTaskID: Int? + + @_spi(Testing) + public init( + targetID: Int? = nil, + taskSignature: String, + parentTaskID: Int? = nil + ) { + self.targetID = targetID + self.taskSignature = taskSignature + self.parentTaskID = parentTaskID + } } /// Event indicating that a task has started building. @@ -305,6 +533,29 @@ public enum SwiftBuildMessage { /// The set of paths to clang-format serialized diagnostics files, if used. public let serializedDiagnosticsPaths: [AbsolutePath] + + @_spi(Testing) + public init( + taskID: Int, + targetID: Int? = nil, + taskSignature: String, + parentTaskID: Int? = nil, + ruleInfo: String, + interestingPath: AbsolutePath? = nil, + commandLineDisplayString: String? = nil, + executionDescription: String, + serializedDiagnosticsPaths: [AbsolutePath] = [] + ) { + self.taskID = taskID + self.targetID = targetID + self.taskSignature = taskSignature + self.parentTaskID = parentTaskID + self.ruleInfo = ruleInfo + self.interestingPath = interestingPath + self.commandLineDisplayString = commandLineDisplayString + self.executionDescription = executionDescription + self.serializedDiagnosticsPaths = serializedDiagnosticsPaths + } } public struct TaskDiagnosticInfo { @@ -312,11 +563,33 @@ public enum SwiftBuildMessage { public let taskSignature: String public let targetID: Int? public let message: String + + @_spi(Testing) + public init( + taskID: Int, + taskSignature: String, + targetID: Int? = nil, + message: String + ) { + self.taskID = taskID + self.taskSignature = taskSignature + self.targetID = targetID + self.message = message + } } public struct TaskOutputInfo { public let taskID: Int public let data: String + + @_spi(Testing) + public init( + taskID: Int, + data: String + ) { + self.taskID = taskID + self.data = data + } } /// Event indicating that a task has finished building. @@ -333,6 +606,21 @@ public enum SwiftBuildMessage { public let maxRSS: UInt64 public let wcStartTime: UInt64 public let wcDuration: UInt64 + + @_spi(Testing) + public init( + utime: UInt64, + stime: UInt64, + maxRSS: UInt64, + wcStartTime: UInt64, + wcDuration: UInt64 + ) { + self.utime = utime + self.stime = stime + self.maxRSS = maxRSS + self.wcStartTime = wcStartTime + self.wcDuration = wcDuration + } } public let taskID: Int @@ -340,11 +628,35 @@ public enum SwiftBuildMessage { public let result: Result public let signalled: Bool public let metrics: Metrics? + + @_spi(Testing) + public init( + taskID: Int, + taskSignature: String, + result: Result, + signalled: Bool, + metrics: Metrics? = nil + ) { + self.taskID = taskID + self.taskSignature = taskSignature + self.result = result + self.signalled = signalled + self.metrics = metrics + } } public struct TargetDiagnosticInfo { public let targetID: Int public let message: String + + @_spi(Testing) + public init( + targetID: Int, + message: String + ) { + self.targetID = targetID + self.message = message + } } case planningOperationStarted(PlanningOperationStartedInfo) diff --git a/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift b/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift index 0a7c1617..4d6b0fc9 100644 --- a/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift +++ b/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift @@ -1045,7 +1045,7 @@ fileprivate struct UnitTestBuildOperationTests: CoreBasedTests { /// Test building an application and a UI test target for iOS for both the device and the simulator. @Test(.requireSDKs(.iOS)) - func uITestTarget_iOS() async throws { + func uiTestTarget_iOS() async throws { // Creates and returns a tester for a given test. func makeTester(_ tmpDir: Path) async throws -> BuildOperationTester { let testWorkspace = try await TestWorkspace( diff --git a/Tests/SWBCoreTests/SDKRegistryTests.swift b/Tests/SWBCoreTests/SDKRegistryTests.swift index 368da32d..73d1b6bf 100644 --- a/Tests/SWBCoreTests/SDKRegistryTests.swift +++ b/Tests/SWBCoreTests/SDKRegistryTests.swift @@ -538,7 +538,12 @@ import SWBMacro "CanonicalName": "macosbork", "IsBaseSDK": "YES", "SupportedTargets": [ - "iosmac": [] as PropertyListItem + "iosmac": [ + "DeviceFamilies": [ + ["DisplayName": "iPad", "Identifier": "2", "Name": "pad"], + ["DisplayName": "Mac", "Identifier": "6", "Name": "mac"], + ] + ] as PropertyListItem ] ]) diff --git a/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift index 7b43ae69..a5629288 100644 --- a/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift @@ -69,12 +69,12 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { } } - @Test(.requireSDKs(.macOS)) + @Test(.requireSDKs(.macOS), .requireXcode26()) func swiftAppBasics_preSwiftOS() async throws { try await _testSwiftAppBasics(deploymentTargetVersion: "10.14.0", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: false, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true) } - @Test(.requireSDKs(.macOS)) + @Test(.requireSDKs(.macOS), .requireXcode26()) func swiftAppBasics_postSwiftOS() async throws { try await _testSwiftAppBasics(deploymentTargetVersion: "12.0", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: false, shouldBackDeploySwiftSpan: true, missingSpanCompatibilitySuppressesRPath: true) } @@ -84,22 +84,22 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { try await _testSwiftAppBasics(deploymentTargetVersion: "26.0", shouldEmitSwiftRPath: false, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: false, shouldBackDeploySwiftSpan: false) } - @Test(.requireSDKs(.macOS)) + @Test(.requireSDKs(.macOS), .requireXcode26()) func swiftAppBasics_preSwiftOSDeploymentTarget_postSwiftOSTargetDevice() async throws { try await _testSwiftAppBasics(deploymentTargetVersion: "10.14.0", targetDeviceOSVersion: "11.0", targetDevicePlatformName: "macosx", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true) } - @Test(.requireSDKs(.macOS)) + @Test(.requireSDKs(.macOS), .requireXcode26()) func swiftAppBasics_preSwiftOSDeploymentTarget_postSwiftOSTargetDevice_mixedPlatform() async throws { try await _testSwiftAppBasics(deploymentTargetVersion: "10.14.0", targetDeviceOSVersion: "14.0", targetDevicePlatformName: "iphoneos", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: false, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true) } - @Test(.requireSDKs(.macOS)) + @Test(.requireSDKs(.macOS), .requireXcode26()) func swiftAppBasics_postSwiftOSDeploymentTarget_preSwiftConcurrencySupportedNatively() async throws { try await _testSwiftAppBasics(deploymentTargetVersion: "11.0", shouldEmitSwiftRPath: true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true) } - @Test(.requireSDKs(.macOS), .userDefaults(["AllowRuntimeSearchPathAdditionForSwiftConcurrency": "0"])) + @Test(.requireSDKs(.macOS), .requireXcode26(), .userDefaults(["AllowRuntimeSearchPathAdditionForSwiftConcurrency": "0"])) func swiftAppBasics_postSwiftOSDeploymentTarget_preSwiftConcurrencySupportedNatively_DisallowRpathInjection() async throws { try await _testSwiftAppBasics(deploymentTargetVersion: "11.0", shouldEmitSwiftRPath:true, shouldFilterSwiftLibs: true, shouldBackDeploySwiftConcurrency: true, shouldBackDeploySwiftSpan: true, missingSpanCompatibilitySuppressesRPath: true) diff --git a/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift index f818fbef..f40399a3 100644 --- a/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift @@ -2800,8 +2800,8 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { /// 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. /// /// 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. - @Test(.requireSDKs(.macOS, .iOS)) - func uITestTarget_iOS() async throws { + @Test(.requireSDKs(.macOS, .iOS), .requireXcode26()) + func uiTestTarget_iOS() async throws { let testProject = try await TestProject( "aProject", groupTree: TestGroup(