diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 76ff9e7a..6f64685f 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,6 +1,9 @@ name: Create PR to merge main into release branch -# In the first period after branching the release branch, we typically want to include many changes from `main` in the release branch. This workflow automatically creates a PR every Monday to merge main into the release branch. -# Later in the release cycle we should stop this practice to avoid landing risky changes by disabling this workflow. To do so, disable the workflow as described in https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/disabling-and-enabling-a-workflow +# In the first period after branching the release branch, +# we typically want to include many changes from `main` in the release branch. +# This workflow automatically creates a PR to merge the main branch into the release branch. +# Later in the release cycle we should stop this practice to avoid landing risky changes by disabling this workflow. +# To do so, disable the workflow as described in https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/disabling-and-enabling-a-workflow permissions: contents: read on: @@ -12,8 +15,8 @@ jobs: name: Create PR to merge main into release branch uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@main with: - head_branch: release/6.2 - base_branch: main + head_branch: main + base_branch: release/6.3 permissions: contents: write pull-requests: write diff --git a/Sources/SWBAndroidPlatform/Plugin.swift b/Sources/SWBAndroidPlatform/Plugin.swift index 5c8dad11..f282f26e 100644 --- a/Sources/SWBAndroidPlatform/Plugin.swift +++ b/Sources/SWBAndroidPlatform/Plugin.swift @@ -133,8 +133,6 @@ struct AndroidPlatformExtension: PlatformInfoExtension { "GENERATE_TEXT_BASED_STUBS": "NO", "GENERATE_INTERMEDIATE_TEXT_BASED_STUBS": "NO", - "CHOWN": "/usr/bin/chown", - "LIBTOOL": .plString(host.imageFormat.executableName(basename: "llvm-lib")), "AR": .plString(host.imageFormat.executableName(basename: "llvm-ar")), ] diff --git a/Sources/SWBApplePlatform/Specs/MetalCompiler.xcspec b/Sources/SWBApplePlatform/Specs/MetalCompiler.xcspec index 97b73fa9..6ef362eb 100644 --- a/Sources/SWBApplePlatform/Specs/MetalCompiler.xcspec +++ b/Sources/SWBApplePlatform/Specs/MetalCompiler.xcspec @@ -239,7 +239,7 @@ Name = "METAL_INDEX_STORE_ONLY_PROJECT_FILES"; Type = Boolean; DefaultValue = "$(INDEX_STORE_ONLY_PROJECT_FILES)"; - Condition = "$(MTL_ENABLE_INDEX_STORE)"; + Condition = "$(MTL_ENABLE_INDEX_STORE) && ( $(COMPILER_INDEX_STORE_ENABLE) == YES || ( $(COMPILER_INDEX_STORE_ENABLE) == Default && $(MTL_ENABLE_DEBUG_INFO) != NO ) )"; CommandLineArgs = { YES = ( // See corresponding definition in Clang.xcspec diff --git a/Sources/SWBCore/MacroConfigFileLoader.swift b/Sources/SWBCore/MacroConfigFileLoader.swift index d9153351..705f9940 100644 --- a/Sources/SWBCore/MacroConfigFileLoader.swift +++ b/Sources/SWBCore/MacroConfigFileLoader.swift @@ -248,7 +248,7 @@ final class MacroConfigFileLoader: Sendable { return MacroConfigFileParser(byteString: data, path: path, delegate: delegate) } - mutating func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { + mutating func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, pathRef: OrderedSet.Index, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { // Look up the macro name, creating it as a user-defined macro if it isn’t already known. let macro = table.namespace.lookupOrDeclareMacro(UserDefinedMacroDeclaration.self, macroName) @@ -259,8 +259,8 @@ final class MacroConfigFileLoader: Sendable { } // Parse the value in a manner consistent with the macro definition. - let location = MacroValueAssignmentLocation(path: path, startLine: startLine, endLine: endLine, startColumn: startColumn, endColumn: endColumn) - table.push(macro, table.namespace.parseForMacro(macro, value: value), conditions: conditionSet, location: location) + let locationRef = InternedMacroValueAssignmentLocation(pathRef: pathRef, startLine: startLine, endLine: endLine, startColumn: startColumn, endColumn: endColumn) + table.push(macro, table.namespace.parseForMacro(macro, value: value), conditions: conditionSet, locationRef: locationRef) } func handleDiagnostic(_ diagnostic: MacroConfigFileDiagnostic, parser: MacroConfigFileParser) { @@ -308,8 +308,8 @@ fileprivate final class MacroValueAssignmentTableRef { table.namespace } - func push(_ macro: MacroDeclaration, _ value: MacroExpression, conditions: MacroConditionSet? = nil, location: MacroValueAssignmentLocation? = nil) { - table.push(macro, value, conditions: conditions, location: location) + func push(_ macro: MacroDeclaration, _ value: MacroExpression, conditions: MacroConditionSet? = nil, locationRef: InternedMacroValueAssignmentLocation? = nil) { + table.push(macro, value, conditions: conditions, locationRef: locationRef) } } diff --git a/Sources/SWBCore/PlannedTaskAction.swift b/Sources/SWBCore/PlannedTaskAction.swift index 3632cfd2..d762996f 100644 --- a/Sources/SWBCore/PlannedTaskAction.swift +++ b/Sources/SWBCore/PlannedTaskAction.swift @@ -331,7 +331,7 @@ public protocol TaskActionCreationDelegate func createLinkAssetCatalogTaskAction() -> any PlannedTaskAction func createLSRegisterURLTaskAction() -> any PlannedTaskAction func createODRAssetPackManifestTaskAction() -> any PlannedTaskAction - func createProcessProductEntitlementsTaskAction(scope: MacroEvaluationScope, mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction + func createProcessProductEntitlementsTaskAction(mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, allowEntitlementsModification: Bool, entitlementsDestination: EntitlementsDestination, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction func createProcessProductProvisioningProfileTaskAction() -> any PlannedTaskAction func createRegisterExecutionPolicyExceptionTaskAction() -> any PlannedTaskAction func createSwiftHeaderToolTaskAction() -> any PlannedTaskAction diff --git a/Sources/SWBCore/Settings/BuiltinMacros.swift b/Sources/SWBCore/Settings/BuiltinMacros.swift index 6c232060..5570cc92 100644 --- a/Sources/SWBCore/Settings/BuiltinMacros.swift +++ b/Sources/SWBCore/Settings/BuiltinMacros.swift @@ -1198,6 +1198,8 @@ public final class BuiltinMacros { public static let _WRAPPER_RESOURCES_DIR = BuiltinMacros.declareStringMacro("_WRAPPER_RESOURCES_DIR") public static let __INPUT_FILE_LIST_PATH__ = BuiltinMacros.declarePathMacro("__INPUT_FILE_LIST_PATH__") public static let LINKER_FILE_LIST_FORMAT = BuiltinMacros.declareEnumMacro("LINKER_FILE_LIST_FORMAT") as EnumMacroDeclaration + public static let LIBTOOL_FILE_LIST_FORMAT = BuiltinMacros.declareEnumMacro("LIBTOOL_FILE_LIST_FORMAT") as EnumMacroDeclaration + public static let LINKER_RESPONSE_FILE_FORMAT = BuiltinMacros.declareEnumMacro("LINKER_RESPONSE_FILE_FORMAT") as EnumMacroDeclaration public static let SWIFT_RESPONSE_FILE_PATH = BuiltinMacros.declarePathMacro("SWIFT_RESPONSE_FILE_PATH") public static let __ARCHS__ = BuiltinMacros.declareStringListMacro("__ARCHS__") @@ -2459,6 +2461,7 @@ public final class BuiltinMacros { _WRAPPER_RESOURCES_DIR, __INPUT_FILE_LIST_PATH__, LINKER_FILE_LIST_FORMAT, + LIBTOOL_FILE_LIST_FORMAT, LINKER_RESPONSE_FILE_FORMAT, __ARCHS__, __SWIFT_MODULE_ONLY_ARCHS__, @@ -2876,7 +2879,7 @@ public enum StickerSharingLevel: String, Equatable, Hashable, EnumerationMacroTy } /// Enumeration macro type for the value of the `ENTITLEMENTS_DESTINATION` build setting. -public enum EntitlementsDestination: String, Equatable, Hashable, EnumerationMacroType { +public enum EntitlementsDestination: String, Equatable, Hashable, EnumerationMacroType, Serializable { public static let defaultValue = EntitlementsDestination.none case codeSignature = "Signature" diff --git a/Sources/SWBCore/SpecImplementations/LinkerSpec.swift b/Sources/SWBCore/SpecImplementations/LinkerSpec.swift index 5d728619..6149d4c4 100644 --- a/Sources/SWBCore/SpecImplementations/LinkerSpec.swift +++ b/Sources/SWBCore/SpecImplementations/LinkerSpec.swift @@ -138,8 +138,9 @@ open class LinkerSpec : CommandLineToolSpec, @unchecked Sendable { return ruleInfo } - public func inputFileListContents(_ cbc: CommandBuildContext) -> ByteString { - return ByteString(encodingAsUTF8: ResponseFiles.responseFileContents(args: cbc.inputs.map { $0.absolutePath.strWithPosixSlashes }, format: cbc.scope.evaluate(BuiltinMacros.LINKER_FILE_LIST_FORMAT))) + public func inputFileListContents(_ cbc: CommandBuildContext, lookup: ((MacroDeclaration) -> MacroExpression?)? = nil) -> ByteString { + let format = cbc.scope.evaluate(BuiltinMacros.LINKER_FILE_LIST_FORMAT, lookup: lookup) + return ByteString(encodingAsUTF8: ResponseFiles.responseFileContents(args: cbc.inputs.map { $0.absolutePath.strWithPosixSlashes }, format: format)) } open override func constructTasks(_ cbc: CommandBuildContext, _ delegate: any TaskGenerationDelegate) async { diff --git a/Sources/SWBCore/SpecImplementations/PropertyDomainSpec.swift b/Sources/SWBCore/SpecImplementations/PropertyDomainSpec.swift index af2f0063..e237aecc 100644 --- a/Sources/SWBCore/SpecImplementations/PropertyDomainSpec.swift +++ b/Sources/SWBCore/SpecImplementations/PropertyDomainSpec.swift @@ -118,6 +118,8 @@ private final class EnumBuildOptionType : BuildOptionType { return try namespace.declareEnumMacro(name) as EnumMacroDeclaration case "LINKER_FILE_LIST_FORMAT": return try namespace.declareEnumMacro(name) as EnumMacroDeclaration + case "LIBTOOL_FILE_LIST_FORMAT": + return try namespace.declareEnumMacro(name) as EnumMacroDeclaration case "LINKER_RESPONSE_FILE_FORMAT": return try namespace.declareEnumMacro(name) as EnumMacroDeclaration case "DOCC_MINIMUM_ACCESS_LEVEL": diff --git a/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift b/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift index 8c8e6bc3..414ec486 100644 --- a/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift +++ b/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift @@ -461,7 +461,7 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec let fileListPath = cbc.scope.evaluate(BuiltinMacros.__INPUT_FILE_LIST_PATH__, lookup: linkerDriverLookup) if !fileListPath.isEmpty { let fileListPath = fileListPath - cbc.producer.writeFileSpec.constructFileTasks(CommandBuildContext(producer: cbc.producer, scope: cbc.scope, inputs: [], output: fileListPath), delegate, contents: inputFileListContents(cbc), permissions: nil, preparesForIndexing: false, additionalTaskOrderingOptions: [.immediate, .ignorePhaseOrdering]) + cbc.producer.writeFileSpec.constructFileTasks(CommandBuildContext(producer: cbc.producer, scope: cbc.scope, inputs: [], output: fileListPath), delegate, contents: inputFileListContents(cbc, lookup: linkerDriverLookup), permissions: nil, preparesForIndexing: false, additionalTaskOrderingOptions: [.immediate, .ignorePhaseOrdering]) inputPaths.append(fileListPath) } @@ -1655,6 +1655,11 @@ public final class LibtoolLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @u return resolveExecutablePath(producer, lookupPath) } + public override func inputFileListContents(_ cbc: CommandBuildContext, lookup: ((MacroDeclaration) -> MacroExpression?)? = nil) -> ByteString { + let format = cbc.scope.evaluate(BuiltinMacros.LIBTOOL_FILE_LIST_FORMAT, lookup: lookup) + return ByteString(encodingAsUTF8: ResponseFiles.responseFileContents(args: cbc.inputs.map { $0.absolutePath.strWithPosixSlashes }, format: format)) + } + static func discoveredCommandLineToolSpecInfo(_ producer: any CommandProducer, _ delegate: any CoreClientTargetDiagnosticProducingDelegate, toolPath: Path) async throws -> DiscoveredLibtoolLinkerToolSpecInfo { if toolPath.basenameWithoutSuffix == "llvm-lib" || toolPath.basenameWithoutSuffix == "ar" || toolPath.basenameWithoutSuffix.hasSuffix("-ar") { return DiscoveredLibtoolLinkerToolSpecInfo(toolPath: toolPath, toolVersion: nil) diff --git a/Sources/SWBCore/SpecImplementations/Tools/ProductPackaging.swift b/Sources/SWBCore/SpecImplementations/Tools/ProductPackaging.swift index 5cb57d51..2fec4dd2 100644 --- a/Sources/SWBCore/SpecImplementations/Tools/ProductPackaging.swift +++ b/Sources/SWBCore/SpecImplementations/Tools/ProductPackaging.swift @@ -169,7 +169,11 @@ public final class ProductPackagingToolSpec : GenericCommandLineToolSpec, SpecId } // Create the task action, and then the task. - let action = delegate.taskActionCreationDelegate.createProcessProductEntitlementsTaskAction(scope: cbc.scope, mergedEntitlements: entitlements, entitlementsVariant: entitlementsVariant, destinationPlatformName: platform.name, entitlementsFilePath: codeSignEntitlementsInput?.absolutePath, fs: fs) + let action = delegate.taskActionCreationDelegate.createProcessProductEntitlementsTaskAction(mergedEntitlements: entitlements, entitlementsVariant: entitlementsVariant, allowEntitlementsModification: cbc.scope.evaluate(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION), entitlementsDestination: cbc.scope.evaluate(BuiltinMacros.ENTITLEMENTS_DESTINATION), destinationPlatformName: platform.name, entitlementsFilePath: codeSignEntitlementsInput?.absolutePath, fs: fs) + // The action records a timestamp representing the last modification date of the entitlements file, so changes to the input must invalidate the build description. + if let path = codeSignEntitlementsInput?.absolutePath { + delegate.access(path: path) + } delegate.createTask(type: self, ruleInfo: ["ProcessProductPackaging", codeSignEntitlementsInput?.absolutePath.str ?? "", outputPath.str], commandLine: commandLine, additionalOutput: additionalOutput, environment: environmentFromSpec(cbc, delegate), workingDirectory: cbc.producer.defaultWorkingDirectory, inputs: inputs.map(\.absolutePath), outputs: [ outputPath ], action: action, execDescription: resolveExecutionDescription(cbc, delegate), enableSandboxing: enableSandboxing) } diff --git a/Sources/SWBCore/SpecImplementations/Tools/SetAttributes.swift b/Sources/SWBCore/SpecImplementations/Tools/SetAttributes.swift index 38d6534b..d502fa23 100644 --- a/Sources/SWBCore/SpecImplementations/Tools/SetAttributes.swift +++ b/Sources/SWBCore/SpecImplementations/Tools/SetAttributes.swift @@ -57,7 +57,7 @@ public final class SetAttributesSpec: CommandLineToolSpec, SpecImplementationTyp execDescription = "Set Group" } - let args = [cbc.scope.evaluate(BuiltinMacros.CHOWN).str, "-RH", attrs, input.absolutePath.str] + let args = [resolveExecutablePath(cbc.producer, cbc.scope.evaluate(BuiltinMacros.CHOWN)).str, "-RH", attrs, input.absolutePath.str] let commandOutput = delegate.createVirtualNode("SetOwner \(input.absolutePath.str)") let outputs: [any PlannedNode] = [delegate.createNode(input.absolutePath), commandOutput] diff --git a/Sources/SWBCore/Specs/NativeBuildSystem.xcspec b/Sources/SWBCore/Specs/NativeBuildSystem.xcspec index 85f098be..65e3918c 100644 --- a/Sources/SWBCore/Specs/NativeBuildSystem.xcspec +++ b/Sources/SWBCore/Specs/NativeBuildSystem.xcspec @@ -831,7 +831,7 @@ When `GENERATE_INFOPLIST_FILE` is enabled, sets the value of the [CFBundleExecut }, { Name = CHOWN; Type = Path; - DefaultValue = "/usr/sbin/chown"; + DefaultValue = "chown"; }, { Name = CHMOD; Type = Path; diff --git a/Sources/SWBGenericUnixPlatform/Plugin.swift b/Sources/SWBGenericUnixPlatform/Plugin.swift index f5364223..5e103d24 100644 --- a/Sources/SWBGenericUnixPlatform/Plugin.swift +++ b/Sources/SWBGenericUnixPlatform/Plugin.swift @@ -119,7 +119,6 @@ struct GenericUnixSDKRegistryExtension: SDKRegistryExtension { "GENERATE_TEXT_BASED_STUBS": "NO", "GENERATE_INTERMEDIATE_TEXT_BASED_STUBS": "NO", - "CHOWN": "/usr/bin/chown", "AR": "llvm-ar", ] default: diff --git a/Sources/SWBGenericUnixPlatform/Specs/UnixLibtool.xcspec b/Sources/SWBGenericUnixPlatform/Specs/UnixLibtool.xcspec index 7d08dcb2..9d2f6a94 100644 --- a/Sources/SWBGenericUnixPlatform/Specs/UnixLibtool.xcspec +++ b/Sources/SWBGenericUnixPlatform/Specs/UnixLibtool.xcspec @@ -69,10 +69,11 @@ DefaultValue = YES; }, { - Name = "LINKER_FILE_LIST_FORMAT"; + Name = "LIBTOOL_FILE_LIST_FORMAT"; Type = Enumeration; Values = ( unescapedNewlineSeparated, + unixShellQuotedSpaceSeparated, unixShellQuotedNewlineSeparated, windowsShellQuotedNewlineSeparated, ); diff --git a/Sources/SWBMacro/MacroConfigFileParser.swift b/Sources/SWBMacro/MacroConfigFileParser.swift index 4e5ddc76..63610a08 100644 --- a/Sources/SWBMacro/MacroConfigFileParser.swift +++ b/Sources/SWBMacro/MacroConfigFileParser.swift @@ -12,6 +12,7 @@ public import SWBUtil import Foundation +import Synchronization private extension UInt8 { var isASCIISpace: Bool { @@ -35,6 +36,7 @@ public final class MacroConfigFileParser { /// The path to the xcconfig file being parsed, for diagnostic purposes. public let path: Path + private let pathRef: OrderedSet.Index /// Current index into the UTF-8 byte sequence that’s being parsed. Starts at zero. All meaningful characters are in the ASCII range, which is what lets us do this optimization. var currIdx: Int @@ -57,6 +59,7 @@ public final class MacroConfigFileParser { self.delegate = delegate self.bytes = byteString.bytes self.path = path + self.pathRef = MacroValueAssignment.macroConfigPaths.withLock({ $0.append(path).index }) self.currIdx = 0 self.currLine = 1 } @@ -399,7 +402,7 @@ public final class MacroConfigFileParser { } // Finally, now that we have the name, conditions, and value, we tell the delegate about it. let value = chunks.joined(separator: " ") - delegate?.foundMacroValueAssignment(name, conditions: conditions, value: value, path: path, startLine: startLine, endLine: currLine, startColumn: startColumn, endColumn: currIdx - startOfLine, parser: self) + delegate?.foundMacroValueAssignment(name, conditions: conditions, value: value, path: path, pathRef: pathRef, startLine: startLine, endLine: currLine, startColumn: startColumn, endColumn: currIdx - startOfLine, parser: self) } public func parseNonListAssignmentRHS() -> String? { @@ -538,7 +541,7 @@ public final class MacroConfigFileParser { } func endPreprocessorInclusion() { } - func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { + func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, pathRef: OrderedSet.Index, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { self.macroName = macroName self.conditions = conditions.isEmpty ? nil : conditions } @@ -585,7 +588,7 @@ public protocol MacroConfigFileParserDelegate { func endPreprocessorInclusion() /// Invoked once for each macro value assignment. The `macroName` is guaranteed to be non-empty, but `value` may be empty. Any macro conditions are passed as tuples in the `conditions`; parameters are guaranteed to be non-empty strings, but patterns may be empty. - mutating func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) + mutating func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, pathRef: OrderedSet.Index, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) /// Invoked if an error, warning, or other diagnostic is detected. func handleDiagnostic(_ diagnostic: MacroConfigFileDiagnostic, parser: MacroConfigFileParser) diff --git a/Sources/SWBMacro/MacroEvaluationScope.swift b/Sources/SWBMacro/MacroEvaluationScope.swift index f8c739e2..0c4c5e14 100644 --- a/Sources/SWBMacro/MacroEvaluationScope.swift +++ b/Sources/SWBMacro/MacroEvaluationScope.swift @@ -17,7 +17,7 @@ private extension MacroValueAssignmentTable { func lookupMacro(_ macro: MacroDeclaration, overrideLookup: ((MacroDeclaration) -> MacroExpression?)? = nil) -> MacroValueAssignment? { // See if we have an overriding binding. if let override = overrideLookup?(macro) { - return MacroValueAssignment(expression: override, conditions: nil, next: lookupMacro(macro), location: nil) + return MacroValueAssignment(expression: override, conditions: nil, next: lookupMacro(macro), locationRef: nil) } // Otherwise, return the normal lookup. diff --git a/Sources/SWBMacro/MacroValueAssignmentTable.swift b/Sources/SWBMacro/MacroValueAssignmentTable.swift index 788dbd68..6357b827 100644 --- a/Sources/SWBMacro/MacroValueAssignmentTable.swift +++ b/Sources/SWBMacro/MacroValueAssignmentTable.swift @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// public import SWBUtil -import Synchronization +public import Synchronization /// A mapping from macro declarations to corresponding macro value assignments, each of which is a linked list of macro expressions in precedence order. At the moment it doesn’t support conditional assignments, but that functionality will be implemented soon. public struct MacroValueAssignmentTable: Serializable, Sendable { @@ -78,14 +78,7 @@ public struct MacroValueAssignmentTable: Serializable, Sendable { /// Adds a mapping from `macro` to `value`, inserting it ahead of any already existing assignment for the same macro. Unless the value refers to the lower-precedence expression (using `$(inherited)` notation), any existing assignments are shadowed but not removed. - public mutating func push(_ macro: MacroDeclaration, _ value: MacroExpression, conditions: MacroConditionSet? = nil, location: MacroValueAssignmentLocation? = nil) { - assert(namespace.lookupMacroDeclaration(macro.name) === macro) - // Validate the type. - assert(macro.type.matchesExpressionType(value)) - valueAssignments[macro] = MacroValueAssignment(expression: value, conditions: conditions, next: valueAssignments[macro], location: location) - } - - mutating func push(_ macro: MacroDeclaration, _ value: MacroExpression, conditions: MacroConditionSet? = nil, locationRef: InternedMacroValueAssignmentLocation?) { + package mutating func push(_ macro: MacroDeclaration, _ value: MacroExpression, conditions: MacroConditionSet? = nil, locationRef: InternedMacroValueAssignmentLocation? = nil) { assert(namespace.lookupMacroDeclaration(macro.name) === macro) // Validate the type. assert(macro.type.matchesExpressionType(value)) @@ -338,7 +331,7 @@ public final class MacroValueAssignment: Serializable, CustomStringConvertible, public let next: MacroValueAssignment? let _location: InternedMacroValueAssignmentLocation? - private static let macroConfigPaths = SWBMutex>(OrderedSet()) + package static let macroConfigPaths = SWBMutex>(OrderedSet()) public var location: MacroValueAssignmentLocation? { if let _location { @@ -355,28 +348,6 @@ public final class MacroValueAssignment: Serializable, CustomStringConvertible, } /// Initializes the macro value assignment to represent `expression`, with the next existing macro value assignment (if any). - convenience init(expression: MacroExpression, conditions: MacroConditionSet? = nil, next: MacroValueAssignment?, location: MacroValueAssignmentLocation?) { - let locationRef: InternedMacroValueAssignmentLocation? - if let location { - locationRef = InternedMacroValueAssignmentLocation( - pathRef: Self.macroConfigPaths.withLock({ $0.append(location.path).index }), - startLine: location.startLine, - endLine: location.endLine, - startColumn: location.startColumn, - endColumn: location.endColumn - ) - } else { - locationRef = nil - } - - self.init( - expression: expression, - conditions: conditions, - next: next, - locationRef: locationRef - ) - } - init(expression: MacroExpression, conditions: MacroConditionSet? = nil, next: MacroValueAssignment?, locationRef: InternedMacroValueAssignmentLocation?) { self.expression = expression self.conditions = conditions @@ -457,7 +428,7 @@ public struct MacroValueAssignmentLocation: Sendable, Equatable { public let startColumn: Int public let endColumn: Int - public init(path: Path, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int) { + @_spi(Testing) public init(path: Path, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int) { self.path = path self.startLine = startLine self.endLine = endLine @@ -466,14 +437,14 @@ public struct MacroValueAssignmentLocation: Sendable, Equatable { } } -struct InternedMacroValueAssignmentLocation: Serializable, Sendable { +package struct InternedMacroValueAssignmentLocation: Serializable, Sendable { let pathRef: OrderedSet.Index public let startLine: Int public let endLine: Int let startColumn: Int let endColumn: Int - init(pathRef: OrderedSet.Index, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int) { + package init(pathRef: OrderedSet.Index, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int) { self.pathRef = pathRef self.startLine = startLine self.endLine = endLine @@ -516,10 +487,10 @@ private func insertCopiesOfMacroValueAssignmentNodes(_ srcAsgn: MacroValueAssign } if let srcNext = srcAsgn.next { - return MacroValueAssignment(expression: srcAsgn.expression, conditions:srcAsgn.conditions, next: insertCopiesOfMacroValueAssignmentNodes(srcNext, inFrontOf: dstAsgn), location: srcAsgn.location) + return MacroValueAssignment(expression: srcAsgn.expression, conditions:srcAsgn.conditions, next: insertCopiesOfMacroValueAssignmentNodes(srcNext, inFrontOf: dstAsgn), locationRef: srcAsgn._location) } else { - return MacroValueAssignment(expression: srcAsgn.expression, conditions:srcAsgn.conditions, next: dstAsgn, location: srcAsgn.location) + return MacroValueAssignment(expression: srcAsgn.expression, conditions:srcAsgn.conditions, next: dstAsgn, locationRef: srcAsgn._location) } } diff --git a/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift b/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift index 3c7da7b8..7a2e024e 100644 --- a/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift +++ b/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift @@ -810,8 +810,11 @@ public class TaskProducerContext: StaleFileRemovalContext, BuildFileResolution public func availableMatchingArchitecturesInStubBinary(at stubBinary: Path, requestedArchs: [String]) async -> [String] { let stubArchs: Set + let stubPlatforms: [any PlatformInfoProvider] do { - stubArchs = try globalProductPlan.planRequest.buildRequestContext.getCachedMachOInfo(at: stubBinary).architectures + let stubInfo = try globalProductPlan.planRequest.buildRequestContext.getCachedMachOInfo(at: stubBinary) + stubArchs = stubInfo.architectures + stubPlatforms = stubInfo.platforms.compactMap { lookupPlatformInfo(platform: $0) } } catch { delegate.error("unable to create tasks to copy stub binary: can't determine architectures of binary: \(stubBinary.str): \(error)") return [] @@ -821,12 +824,13 @@ public class TaskProducerContext: StaleFileRemovalContext, BuildFileResolution if stubArchs.contains(arch) { archsToExtract.insert(arch) } else { - let specLookupContext = SpecLookupCtxt(specRegistry: workspaceContext.core.specRegistry, platform: settings.platform) - let compatibilityArchs = (specLookupContext.getSpec(arch) as? ArchitectureSpec)?.compatibilityArchs - if let compatibleArch = compatibilityArchs?.first(where: { stubArchs.contains($0) }) { + let compatibilityArchs: [String] = stubPlatforms.flatMap { platform in + (workspaceContext.core.specRegistry.getSpec(arch, domain: platform.name) as? ArchitectureSpec)?.compatibilityArchs ?? [] + } + if let compatibleArch = compatibilityArchs.first(where: { stubArchs.contains($0) }) { archsToExtract.insert(compatibleArch) } else { - delegate.warning("stub binary at '\(stubBinary.str)' does not contain a slice for '\(arch)' or a compatible architecture") + delegate.warning("stub binary at '\(stubBinary.str)' does not contain a slice for '\(arch)' or a compatible architecture. Stub architectures: \(stubArchs.joined(separator: ", ")). Compatibility architectures for \(arch): \(compatibilityArchs.joined(separator: ", "))") } } } diff --git a/Sources/SWBTaskExecution/BuildDescriptionManager.swift b/Sources/SWBTaskExecution/BuildDescriptionManager.swift index 842c8baf..e119cd92 100644 --- a/Sources/SWBTaskExecution/BuildDescriptionManager.swift +++ b/Sources/SWBTaskExecution/BuildDescriptionManager.swift @@ -857,8 +857,8 @@ extension BuildSystemTaskPlanningDelegate: TaskActionCreationDelegate { return LSRegisterURLTaskAction() } - func createProcessProductEntitlementsTaskAction(scope: MacroEvaluationScope, mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { - return ProcessProductEntitlementsTaskAction(scope: scope, fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) + func createProcessProductEntitlementsTaskAction(mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, allowEntitlementsModification: Bool, entitlementsDestination: EntitlementsDestination, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { + return ProcessProductEntitlementsTaskAction(fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, allowEntitlementsModification: allowEntitlementsModification, entitlementsDestination: entitlementsDestination, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) } func createProcessProductProvisioningProfileTaskAction() -> any PlannedTaskAction { diff --git a/Sources/SWBTaskExecution/TaskActions/ProcessProductEntitlementsTaskAction.swift b/Sources/SWBTaskExecution/TaskActions/ProcessProductEntitlementsTaskAction.swift index 63b9fb64..02c45f8e 100644 --- a/Sources/SWBTaskExecution/TaskActions/ProcessProductEntitlementsTaskAction.swift +++ b/Sources/SWBTaskExecution/TaskActions/ProcessProductEntitlementsTaskAction.swift @@ -21,9 +21,6 @@ public import SWBMacro /// Concrete implementation of task for processing product entitlements. public final class ProcessProductEntitlementsTaskAction: TaskAction { - /// The scope the task should use to evaluate build settings. - let scope: MacroEvaluationScope - /// The merged entitlements. let entitlements: PropertyListItem @@ -31,6 +28,12 @@ public final class ProcessProductEntitlementsTaskAction: TaskAction /// macOS and device builds will normally have only signed entitlements. let entitlementsVariant: EntitlementsVariant + /// Whether unsafe modification of entitlements during the build should be allowed. + let allowEntitlementsModification: Bool + + /// The destination of the processed entitlements. + let entitlementsDestination: EntitlementsDestination + /// The platform we're building for. let destinationPlatformName: String @@ -42,12 +45,12 @@ public final class ProcessProductEntitlementsTaskAction: TaskAction /// The timestamp of the latest modification of the entitlements on `init` let entitlementsModificationTimestamp: Result? - public init(scope: MacroEvaluationScope, fs: any FSProxy, entitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, destinationPlatformName: String, entitlementsFilePath: Path?) + public init(fs: any FSProxy, entitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, allowEntitlementsModification: Bool, entitlementsDestination: EntitlementsDestination, destinationPlatformName: String, entitlementsFilePath: Path?) { - self.scope = scope - self.entitlements = entitlements self.entitlementsVariant = entitlementsVariant + self.allowEntitlementsModification = allowEntitlementsModification + self.entitlementsDestination = entitlementsDestination self.destinationPlatformName = destinationPlatformName self.entitlementsFilePath = entitlementsFilePath if let entitlementsFilePath, fs.exists(entitlementsFilePath) { @@ -257,7 +260,7 @@ public final class ProcessProductEntitlementsTaskAction: TaskAction // Updating entitlements is not something that is actively encouraged or supported, however, this is a compatibility pain point for certain projects that we need to maintain some ability to do this. A better approach is to plumb this through the system so that we can track this as a proper dependency mechanism, potentially through our virtual task producers... however, until then, we enable this functionality for those existing clients. // Also, we never modify the signed entitlements when building for simulators and ENTITLEMENTS_DESTINATION is __entitlements, since those are only expected to contain get-task-allow; see rdar://55324156. - let entitlementsVariantToModify: EntitlementsVariant = scope.evaluate(BuiltinMacros.ENTITLEMENTS_DESTINATION) == .entitlementsSection ? .simulated : .signed + let entitlementsVariantToModify: EntitlementsVariant = entitlementsDestination == .entitlementsSection ? .simulated : .signed let allowEntitlementsModification = entitlementsVariantToModify == entitlementsVariant var userModifiedEntitlements: PropertyListItem? @@ -279,7 +282,7 @@ public final class ProcessProductEntitlementsTaskAction: TaskAction } if originalModificationTimestamp != currentModificationTimestamp { - if scope.evaluate(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION) == false { + if !self.allowEntitlementsModification { outputDelegate.emitError("Entitlements file \"\(entitlementsFilePath.basename)\" was modified during the build, which is not supported. You can disable this error by setting 'CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION' to 'YES', however this may cause the built product's code signature or provisioning profile to contain incorrect entitlements.") return .failed } @@ -391,12 +394,13 @@ public final class ProcessProductEntitlementsTaskAction: TaskAction public override func serialize(to serializer: T) { - serializer.serializeAggregate(7) + serializer.serializeAggregate(8) { - serializer.serialize(scope) // FIXME: We have no way to handle any errors in PropertyListItem.asBytes() here. serializer.serialize(try? entitlements.asBytes(.binary)) serializer.serialize(entitlementsVariant) + serializer.serialize(allowEntitlementsModification) + serializer.serialize(entitlementsDestination) serializer.serialize(destinationPlatformName) serializer.serialize(entitlementsFilePath) serializer.serialize(entitlementsModificationTimestamp) @@ -406,10 +410,11 @@ public final class ProcessProductEntitlementsTaskAction: TaskAction public required init(from deserializer: any Deserializer) throws { - try deserializer.beginAggregate(7) - self.scope = try deserializer.deserialize() + try deserializer.beginAggregate(8) self.entitlements = try PropertyList.fromBytes(try deserializer.deserialize()) self.entitlementsVariant = try deserializer.deserialize() + self.allowEntitlementsModification = try deserializer.deserialize() + self.entitlementsDestination = try deserializer.deserialize() self.destinationPlatformName = try deserializer.deserialize() self.entitlementsFilePath = try deserializer.deserialize() self.entitlementsModificationTimestamp = try deserializer.deserialize() diff --git a/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift b/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift index cc3a27e6..db740865 100644 --- a/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift +++ b/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift @@ -180,8 +180,8 @@ extension CapturingTaskGenerationDelegate: TaskActionCreationDelegate { return LSRegisterURLTaskAction() } - package func createProcessProductEntitlementsTaskAction(scope: MacroEvaluationScope, mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { - return ProcessProductEntitlementsTaskAction(scope: scope, fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) + package func createProcessProductEntitlementsTaskAction(mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, allowEntitlementsModification: Bool, entitlementsDestination: EntitlementsDestination, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { + return ProcessProductEntitlementsTaskAction(fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, allowEntitlementsModification: allowEntitlementsModification, entitlementsDestination: entitlementsDestination, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) } package func createProcessProductProvisioningProfileTaskAction() -> any PlannedTaskAction { diff --git a/Sources/SWBTestSupport/RunDestinationTestSupport.swift b/Sources/SWBTestSupport/RunDestinationTestSupport.swift index 9041f82d..fa29f90c 100644 --- a/Sources/SWBTestSupport/RunDestinationTestSupport.swift +++ b/Sources/SWBTestSupport/RunDestinationTestSupport.swift @@ -121,8 +121,7 @@ extension _RunDestinationInfo { #if os(macOS) switch Architecture.host.stringValue { case "arm64": - // FIXME: Use results.runDestinationTargetArchitecture in our tests where appropriate so that this works - fallthrough // return macOSAppleSilicon + return macOSAppleSilicon case "x86_64": return macOSIntel default: diff --git a/Sources/SWBTestSupport/SkippedTestSupport.swift b/Sources/SWBTestSupport/SkippedTestSupport.swift index 8bab2de5..48eb9fbf 100644 --- a/Sources/SWBTestSupport/SkippedTestSupport.swift +++ b/Sources/SWBTestSupport/SkippedTestSupport.swift @@ -217,10 +217,17 @@ extension Trait where Self == Testing.ConditionTrait { } } + func runProcessIgnoringExitCode(_ args: [String]) async throws -> String { + guard let first = args.first else { + throw StubError.error("Invalid number of arguments") + } + return try await String(decoding: Process.getOutput(url: URL(filePath: first), arguments: Array(args.dropFirst())).stdout, as: UTF8.self) + } + func checkInstalled(hostOS: OperatingSystem, packageManagerPath: Path, args: [String], packages: [String], regex: Regex<(Substring, name: Substring)>) async throws -> Bool { if try ProcessInfo.processInfo.hostOperatingSystem() == hostOS && localFS.exists(packageManagerPath) { var installedPackages: Set = [] - for line in try await runProcess([packageManagerPath.str] + args + (packageManagerPath.basenameWithoutSuffix == "pkg_info" ? [] : packages)).split(separator: "\n") { + for line in try await runProcessIgnoringExitCode([packageManagerPath.str] + args + (packageManagerPath.basenameWithoutSuffix == "pkg_info" ? [] : packages)).split(separator: "\n") { if let packageName = try regex.firstMatch(in: line)?.output.name { installedPackages.insert(String(packageName)) } diff --git a/Sources/SWBTestSupport/TaskPlanningTestSupport.swift b/Sources/SWBTestSupport/TaskPlanningTestSupport.swift index e5c290aa..dc2c6988 100644 --- a/Sources/SWBTestSupport/TaskPlanningTestSupport.swift +++ b/Sources/SWBTestSupport/TaskPlanningTestSupport.swift @@ -408,8 +408,8 @@ extension TestTaskPlanningDelegate: TaskActionCreationDelegate { return LSRegisterURLTaskAction() } - package func createProcessProductEntitlementsTaskAction(scope: MacroEvaluationScope, mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { - return ProcessProductEntitlementsTaskAction(scope: scope, fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) + package func createProcessProductEntitlementsTaskAction(mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, allowEntitlementsModification: Bool, entitlementsDestination: EntitlementsDestination, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { + return ProcessProductEntitlementsTaskAction(fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, allowEntitlementsModification: allowEntitlementsModification, entitlementsDestination: entitlementsDestination, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) } package func createProcessProductProvisioningProfileTaskAction() -> any PlannedTaskAction { diff --git a/Sources/SWBUniversalPlatform/Specs/Clang.xcspec b/Sources/SWBUniversalPlatform/Specs/Clang.xcspec index 36ec0772..d99b24d8 100644 --- a/Sources/SWBUniversalPlatform/Specs/Clang.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Clang.xcspec @@ -280,12 +280,6 @@ ); NO = (); }; - AdditionalLinkerArgs = { - YES = ( - "-fobjc-arc", - ); - NO = (); - }; FileTypes = ( "sourcecode.c.objc", "sourcecode.cpp.objcpp", @@ -3189,7 +3183,7 @@ Name = "CLANG_INDEX_STORE_ONLY_PROJECT_FILES"; Type = Boolean; DefaultValue = "$(INDEX_STORE_ONLY_PROJECT_FILES)"; - Condition = "$(CLANG_INDEX_STORE_ENABLE)"; + Condition = "$(CLANG_INDEX_STORE_ENABLE) && ( $(COMPILER_INDEX_STORE_ENABLE) || ( $(COMPILER_INDEX_STORE_ENABLE) == Default && $(GCC_OPTIMIZATION_LEVEL) == 0 ) )"; CommandLineArgs = { YES = ( "-index-ignore-system-symbols", @@ -3203,7 +3197,7 @@ Name = "CLANG_INDEX_STORE_COMPRESS"; Type = Boolean; DefaultValue = "$(INDEX_STORE_COMPRESS)"; - Condition = "$(CLANG_INDEX_STORE_ENABLE)"; + Condition = "$(CLANG_INDEX_STORE_ENABLE) && ( $(COMPILER_INDEX_STORE_ENABLE) || ( $(COMPILER_INDEX_STORE_ENABLE) == Default && $(GCC_OPTIMIZATION_LEVEL) == 0 ) )"; CommandLineArgs = { YES = ( "-index-store-compress", @@ -3215,7 +3209,7 @@ Name = "CLANG_INDEX_STORE_IGNORE_MACROS"; Type = Boolean; DefaultValue = NO; - Condition = "$(CLANG_INDEX_STORE_ENABLE)"; + Condition = "$(CLANG_INDEX_STORE_ENABLE) && ( $(COMPILER_INDEX_STORE_ENABLE) || ( $(COMPILER_INDEX_STORE_ENABLE) == Default && $(GCC_OPTIMIZATION_LEVEL) == 0 ) )"; DisplayName = "Do not index C macros"; Description = "Do not emit entries for C macros into the Index Store."; CommandLineArgs = { diff --git a/Sources/SWBUniversalPlatform/Specs/Ld.xcspec b/Sources/SWBUniversalPlatform/Specs/Ld.xcspec index 49937a83..2a31927e 100644 --- a/Sources/SWBUniversalPlatform/Specs/Ld.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Ld.xcspec @@ -831,8 +831,30 @@ unixShellQuotedNewlineSeparated, windowsShellQuotedNewlineSeparated, ); + DefaultValue = "$(LINKER_FILE_LIST_FORMAT_$(LINKER_DRIVER))"; + }, + { + Name = "LINKER_FILE_LIST_FORMAT_clang"; + Type = Enumeration; + Values = ( + unescapedNewlineSeparated, + unixShellQuotedSpaceSeparated, + unixShellQuotedNewlineSeparated, + windowsShellQuotedNewlineSeparated, + ); DefaultValue = unescapedNewlineSeparated; }, + { + Name = "LINKER_FILE_LIST_FORMAT_swiftc"; + Type = Enumeration; + Values = ( + unescapedNewlineSeparated, + unixShellQuotedSpaceSeparated, + unixShellQuotedNewlineSeparated, + windowsShellQuotedNewlineSeparated, + ); + DefaultValue = unixShellQuotedSpaceSeparated; + }, { Name = "LINKER_RESPONSE_FILE_FORMAT"; Type = Enumeration; @@ -843,7 +865,7 @@ windowsShellQuotedNewlineSeparated, ); DefaultValue = unixShellQuotedSpaceSeparated; - } + }, ); } ) diff --git a/Sources/SWBUniversalPlatform/Specs/Libtool.xcspec b/Sources/SWBUniversalPlatform/Specs/Libtool.xcspec index d146ce6c..18c5ac48 100644 --- a/Sources/SWBUniversalPlatform/Specs/Libtool.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Libtool.xcspec @@ -111,6 +111,17 @@ Type = Boolean; DefaultValue = YES; }, + { + Name = "LIBTOOL_FILE_LIST_FORMAT"; + Type = Enumeration; + Values = ( + unescapedNewlineSeparated, + unixShellQuotedSpaceSeparated, + unixShellQuotedNewlineSeparated, + windowsShellQuotedNewlineSeparated, + ); + DefaultValue = unescapedNewlineSeparated; + }, ); } ) diff --git a/Sources/SWBUniversalPlatform/Specs/Swift.xcspec b/Sources/SWBUniversalPlatform/Specs/Swift.xcspec index d5f32b7d..76b7cb1f 100644 --- a/Sources/SWBUniversalPlatform/Specs/Swift.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Swift.xcspec @@ -1343,7 +1343,7 @@ Name = "SWIFT_INDEX_STORE_ONLY_PROJECT_FILES"; Type = Boolean; DefaultValue = "$(INDEX_STORE_ONLY_PROJECT_FILES)"; - Condition = "$(SWIFT_INDEX_STORE_ENABLE)"; + Condition = "$(SWIFT_INDEX_STORE_ENABLE) && ( $(COMPILER_INDEX_STORE_ENABLE) || ( $(COMPILER_INDEX_STORE_ENABLE) == Default && $(SWIFT_OPTIMIZATION_LEVEL) == '-Onone' ) )"; CommandLineArgs = { YES = ( // Assume that clang modules are getting indexed by a clang file within them. While this is technically not correct, since you could have a clang module that only consists of header files and is only included from Swift, such scenarios are rare. @@ -1357,7 +1357,7 @@ Name = "SWIFT_INDEX_STORE_COMPRESS"; Type = Boolean; DefaultValue = "$(INDEX_STORE_COMPRESS)"; - Condition = "$(SWIFT_INDEX_STORE_ENABLE)"; + Condition = "$(SWIFT_INDEX_STORE_ENABLE) && ( $(COMPILER_INDEX_STORE_ENABLE) || ( $(COMPILER_INDEX_STORE_ENABLE) == Default && $(SWIFT_OPTIMIZATION_LEVEL) == '-Onone' ) )"; CommandLineArgs = { YES = ( "-Xfrontend", diff --git a/Sources/SWBUtil/Path.swift b/Sources/SWBUtil/Path.swift index 66f47785..08557011 100644 --- a/Sources/SWBUtil/Path.swift +++ b/Sources/SWBUtil/Path.swift @@ -97,7 +97,7 @@ public struct Path: Serializable, Sendable { } @inline(__always) public static func firstPathSeparatorIndex(in str: some StringProtocol, separators: (some Collection)?) -> String.Index? { guard let separators else { - return str.utf8.index(of: pathSeparatorUTF8) + return str.utf8.firstIndex(of: pathSeparatorUTF8) } return str.firstIndex(where: { separators.contains($0) }) } diff --git a/Sources/SWBWebAssemblyPlatform/Plugin.swift b/Sources/SWBWebAssemblyPlatform/Plugin.swift index a68bc774..dbc99e82 100644 --- a/Sources/SWBWebAssemblyPlatform/Plugin.swift +++ b/Sources/SWBWebAssemblyPlatform/Plugin.swift @@ -65,8 +65,6 @@ struct WebAssemblySDKRegistryExtension: SDKRegistryExtension { "GENERATE_TEXT_BASED_STUBS": "NO", "GENERATE_INTERMEDIATE_TEXT_BASED_STUBS": "NO", - "CHOWN": "/usr/bin/chown", - "LIBTOOL": .plString(host.imageFormat.executableName(basename: "llvm-lib")), "AR": .plString(host.imageFormat.executableName(basename: "llvm-ar")), ] diff --git a/Sources/SWBWindowsPlatform/Specs/WindowsLibtool.xcspec b/Sources/SWBWindowsPlatform/Specs/WindowsLibtool.xcspec index c5521e0d..5647fd0d 100644 --- a/Sources/SWBWindowsPlatform/Specs/WindowsLibtool.xcspec +++ b/Sources/SWBWindowsPlatform/Specs/WindowsLibtool.xcspec @@ -64,7 +64,7 @@ IsInputDependency = Yes; }, { - Name = "LINKER_FILE_LIST_FORMAT"; + Name = "LIBTOOL_FILE_LIST_FORMAT"; Type = Enumeration; Values = ( unescapedNewlineSeparated, diff --git a/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift b/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift index 58df9bc4..aaaf5bd0 100644 --- a/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift +++ b/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift @@ -92,10 +92,10 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { try await tester.checkBuild(runDestination: .macOS, buildRequest: buildRequest, persistent: true) { results in results.checkNoDiagnostics() results.checkTask(.matchTargetName("TargetFoo"), .matchRuleType("CompileC")) { task in - results.checkBacktrace(task, [""]) + results.checkBacktrace(task, [""]) } results.checkTask(.matchTargetName("TargetBar"), .matchRuleType("Ld")) { task in - results.checkBacktrace(task, [""]) + results.checkBacktrace(task, [""]) } } @@ -114,19 +114,19 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { results.checkNoDiagnostics() results.checkTask(.matchTargetName("TargetFoo"), .matchRuleType("CompileC")) { task in results.checkBacktrace(task, [ - "", + "", "" ]) } results.checkTask(.matchTargetName("TargetBar"), .matchRuleType("Ld")) { task in results.checkBacktrace(task, [ - "", + "", "", "", "", - "", - "", - "", + "", + "", + "", "" ]) } @@ -138,15 +138,15 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { results.checkNoDiagnostics() results.checkTask(.matchTargetName("TargetFoo"), .matchRuleType("CompileC")) { task in results.checkBacktrace(task, [ - "", - "", - "" + "", + "", + "" ]) } if tester.fs.fileSystemMode == .checksumOnly { results.checkTask(.matchTargetName("TargetBar"), .matchRuleType("CompileC")) { task in results.checkBacktrace(task, [ - "" + "" ]) } // Ensure "Ld" is not executed, because contents of "bar.o" are unchanged @@ -154,11 +154,11 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { } else { results.checkTask(.matchTargetName("TargetBar"), .matchRuleType("Ld")) { task in results.checkBacktrace(task, [ - "", - "", - "", - "", - "" + "", + "", + "", + "", + "" ]) } } @@ -220,14 +220,14 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { results.checkBacktrace(task, [ "", "", - "" + "" ]) } results.checkTask(.matchTargetName("TargetFoo"), .matchRuleType("SwiftCompile")) { task in results.checkBacktrace(task, [ "", "", - "" + "" ]) } } @@ -247,7 +247,7 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { results.checkBacktrace(task, [ "", "", - "", + "", "" ]) } @@ -255,7 +255,7 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { results.checkBacktrace(task, [ "", "", - "", + "", "" ]) } @@ -314,13 +314,13 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { results.checkNoDiagnostics() } - try tester.fs.remove(SRCROOT.join("build/aProject.build/Debug/TargetFoo.build/Objects-normal/x86_64/foo.o")) + try tester.fs.remove(SRCROOT.join("build/aProject.build/Debug/TargetFoo.build/Objects-normal/\(RunDestinationInfo.host.targetArchitecture)/foo.o")) try await tester.checkBuild(runDestination: .macOS, buildRequest: buildRequest, persistent: true) { results in results.checkNoDiagnostics() results.checkTask(.matchTargetName("TargetFoo"), .matchRuleType("CompileC")) { task in results.checkBacktrace(task, [ - "", + "", ]) } } @@ -560,13 +560,13 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests { results.checkNoDiagnostics() results.checkTask(.matchTargetName("TargetBar"), .matchRuleType("Ld")) { task in results.checkTextualBacktrace(task, """ - #0: an input of 'Link TargetBar (x86_64)' changed + #0: an input of 'Link TargetBar (\(results.runDestinationTargetArchitecture))' changed #1: the task producing file '\(SRCROOT.str)/build/EagerLinkingTBDs/Debug/TargetFoo.framework/Versions/A/TargetFoo.tbd' ran #2: an input of 'Generate TBD TargetFoo' changed #3: the task producing file '\(SRCROOT.str)/build/Debug/TargetFoo.framework/Versions/A/TargetFoo' ran - #4: an input of 'Link TargetFoo (x86_64)' changed - #5: the task producing file '\(SRCROOT.str)/build/aProject.build/Debug/TargetFoo.build/Objects-normal/x86_64/foo.o' ran - #6: an input of 'Compile foo.c (x86_64)' changed + #4: an input of 'Link TargetFoo (\(results.runDestinationTargetArchitecture))' changed + #5: the task producing file '\(SRCROOT.str)/build/aProject.build/Debug/TargetFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/foo.o' ran + #6: an input of 'Compile foo.c (\(results.runDestinationTargetArchitecture))' changed #7: file '\(SRCROOT.str)/Sources/foo.c' changed """) diff --git a/Tests/SWBBuildSystemTests/BuildCommandTests.swift b/Tests/SWBBuildSystemTests/BuildCommandTests.swift index 72bd036e..07da60df 100644 --- a/Tests/SWBBuildSystemTests/BuildCommandTests.swift +++ b/Tests/SWBBuildSystemTests/BuildCommandTests.swift @@ -214,7 +214,7 @@ fileprivate struct BuildCommandTests: CoreBasedTests { /// Check assembling of a single file. @Test(.requireSDKs(.macOS)) func assembleSingleFile() async throws { - try await runSingleFileTask(BuildParameters(configuration: "Debug", activeRunDestination: .host), buildCommand: .generateAssemblyCode(buildOnlyTheseFiles: [Path("")]), fileName: "File.m") { results, excludedTypes, inputs, outputs in + try await runSingleFileTask(BuildParameters(configuration: "Debug", activeRunDestination: .macOSIntel), buildCommand: .generateAssemblyCode(buildOnlyTheseFiles: [Path("")]), fileName: "File.m") { results, excludedTypes, inputs, outputs in results.consumeTasksMatchingRuleTypes(excludedTypes) try results.checkTask(.matchRuleType("Assemble"), .matchRuleItemBasename("File.m"), .matchRuleItem("normal"), .matchRuleItem(results.runDestinationTargetArchitecture)) { task in task.checkCommandLineContainsUninterrupted(["-x", "objective-c"]) @@ -226,7 +226,7 @@ fileprivate struct BuildCommandTests: CoreBasedTests { } // Ensure that RUN_CLANG_STATIC_ANALYZER=YES doesn't interfere with the assemble build command - try await runSingleFileTask(BuildParameters(configuration: "Debug", activeRunDestination: .host, overrides: ["RUN_CLANG_STATIC_ANALYZER": "YES"]), buildCommand: .generateAssemblyCode(buildOnlyTheseFiles: [Path("")]), fileName: "File.m") { results, excludedTypes, inputs, outputs in + try await runSingleFileTask(BuildParameters(configuration: "Debug", activeRunDestination: .macOSIntel, overrides: ["RUN_CLANG_STATIC_ANALYZER": "YES"]), buildCommand: .generateAssemblyCode(buildOnlyTheseFiles: [Path("")]), fileName: "File.m") { results, excludedTypes, inputs, outputs in results.consumeTasksMatchingRuleTypes(excludedTypes) try results.checkTask(.matchRuleType("Assemble"), .matchRuleItemBasename("File.m"), .matchRuleItem("normal"), .matchRuleItem(results.runDestinationTargetArchitecture)) { task in task.checkCommandLineContainsUninterrupted(["-x", "objective-c"]) @@ -238,7 +238,7 @@ fileprivate struct BuildCommandTests: CoreBasedTests { } // Include the single file to assemble in multiple targets - try await runSingleFileTask(BuildParameters(configuration: "Debug", activeRunDestination: .host), buildCommand: .generateAssemblyCode(buildOnlyTheseFiles: [Path("")]), fileName: "File.m", multipleTargets: true) { results, excludedTypes, inputs, outputs in + try await runSingleFileTask(BuildParameters(configuration: "Debug", activeRunDestination: .macOSIntel), buildCommand: .generateAssemblyCode(buildOnlyTheseFiles: [Path("")]), fileName: "File.m", multipleTargets: true) { results, excludedTypes, inputs, outputs in let firstOutput = try #require(outputs.sorted()[safe: 0]) let secondOutput = try #require(outputs.sorted()[safe: 1]) results.consumeTasksMatchingRuleTypes(excludedTypes) diff --git a/Tests/SWBBuildSystemTests/BuildOperationTests.swift b/Tests/SWBBuildSystemTests/BuildOperationTests.swift index 556c0783..25f8c854 100644 --- a/Tests/SWBBuildSystemTests/BuildOperationTests.swift +++ b/Tests/SWBBuildSystemTests/BuildOperationTests.swift @@ -40,8 +40,8 @@ fileprivate struct BuildOperationTests: CoreBasedTests { "SomeFiles", children: [ TestFile("main.swift"), - TestFile("dynamic.swift"), - TestFile("static.swift"), + TestFile("dynamic library.swift"), + TestFile("static library.swift"), ]), buildConfigurations: [ TestBuildConfiguration("Debug", buildSettings: [ @@ -93,7 +93,7 @@ fileprivate struct BuildOperationTests: CoreBasedTests { ]) ], buildPhases: [ - TestSourcesBuildPhase(["dynamic.swift"]), + TestSourcesBuildPhase(["dynamic library.swift"]), ] ), TestStandardTarget( @@ -107,7 +107,7 @@ fileprivate struct BuildOperationTests: CoreBasedTests { ]) ], buildPhases: [ - TestSourcesBuildPhase(["static.swift"]), + TestSourcesBuildPhase(["static library.swift"]), ] ), ]) @@ -125,11 +125,11 @@ fileprivate struct BuildOperationTests: CoreBasedTests { stream <<< "print(\"Hello world\")\n" } - try await tester.fs.writeFileContents(projectDir.join("dynamic.swift")) { stream in + try await tester.fs.writeFileContents(projectDir.join("dynamic library.swift")) { stream in stream <<< "public func dynamicLib() { }" } - try await tester.fs.writeFileContents(projectDir.join("static.swift")) { stream in + try await tester.fs.writeFileContents(projectDir.join("static library.swift")) { stream in stream <<< "public func staticLib() { }" } @@ -1629,8 +1629,8 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script let driverPlanning = try #require(results.checkTask(.matchRuleType("SwiftDriver")) { $0 }) let driverCompilationRequirements = try #require(results.checkTask(.matchRuleType("SwiftDriver Compilation Requirements")) { $0 }) let driverCompilation = try #require(results.checkTask(.matchRuleType("SwiftDriver Compilation")) { $0 }) - results.checkTaskExists(.matchRule(["SwiftCompile", "normal", "x86_64", "Compiling Swifty.swift", SRCROOT.join("Sources/Swifty.swift").str])) - results.checkTaskExists(.matchRule(["SwiftEmitModule", "normal", "x86_64", "Emitting module for CoreFoo"])) + results.checkTaskExists(.matchRule(["SwiftCompile", "normal", results.runDestinationTargetArchitecture, "Compiling Swifty.swift", SRCROOT.join("Sources/Swifty.swift").str])) + results.checkTaskExists(.matchRule(["SwiftEmitModule", "normal", results.runDestinationTargetArchitecture, "Emitting module for CoreFoo"])) try results.checkTask(.matchRuleType("CpHeader"), .matchRuleItemBasename("CoreFoo.h"), .matchRuleItemPattern(.suffix("Versions/A/Headers/CoreFoo.h"))) { cpHeaderTask in try results.checkTaskFollows(driverCompilationRequirements, cpHeaderTask, resolveDynamicTaskRequests: true) try results.checkTaskFollows(driverCompilation, cpHeaderTask, resolveDynamicTaskRequests: true) @@ -5325,7 +5325,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in for ruleType in ["SwiftDriver Compilation Requirements", "SwiftDriver Compilation"] { - results.checkError("Build input file cannot be found: \'\(tmpDirPath.str)/Test/aProject/File.swift\'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (for task: [\"\(ruleType)\", \"aFramework\", \"normal\", \"x86_64\", \"com.apple.xcode.tools.swift.compiler\"])") + results.checkError("Build input file cannot be found: \'\(tmpDirPath.str)/Test/aProject/File.swift\'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (for task: [\"\(ruleType)\", \"aFramework\", \"normal\", \"\(results.runDestinationTargetArchitecture)\", \"com.apple.xcode.tools.swift.compiler\"])") } if !SWBFeatureFlag.performOwnershipAnalysis.value { for fname in ["aFramework.swiftmodule", "aFramework.swiftdoc", "aFramework.swiftsourceinfo", "aFramework.abi.json"] { @@ -5401,7 +5401,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script try await tester.checkBuild(parameters: BuildParameters(action: .install, configuration: "Debug"), runDestination: .macOS, persistent: true) { _ in } let ldDepsPath = SRCROOT.join( - "build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/Tool_dependency_info.dat" + "build/aProject.build/Debug/Tool.build/Objects-normal/\(RunDestinationInfo.macOS.targetArchitecture)/Tool_dependency_info.dat" ) let dependencyInfo: DependencyInfo = try DependencyInfo(bytes: tester.fs.read(ldDepsPath).bytes) @@ -5722,28 +5722,28 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in // Verify that the .o files are compiled. - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/x86_64/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } // Verify that the .a files are created. results.checkTask(.matchRuleType("Libtool"), .matchRuleItem("\(buildDirectory)/Debug/libDeepLib.a")) { task in - task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/x86_64/DeepLib_libtool_dependency_info.dat"]) + task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/DeepLib_libtool_dependency_info.dat"]) } results.checkTask(.matchRuleType("Libtool"), .matchRuleItem("\(buildDirectory)/Debug/libLib.a")) { task in task.checkCommandLineContains(["-lDeepLib"]) - task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/Lib_libtool_dependency_info.dat"]) + task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Lib_libtool_dependency_info.dat"]) } // Verify that everything is linked together properly. Note that the "deep lib" is linked into the static archive above. results.checkTask(.matchRuleType("Ld"), .matchRuleItem("\(buildDirectory)/Debug/Tool")) { task in task.checkCommandLineContains(["-lLib"]) - task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/x86_64/Tool_dependency_info.dat"]) + task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Tool_dependency_info.dat"]) } // Verify that the dependency info indeed has the libraries we expected. - let actual = try DependencyInfo(bytes: try tester.fs.read(Path("\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/Lib_libtool_dependency_info.dat")).bytes) + let actual = try DependencyInfo(bytes: try tester.fs.read(Path("\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Lib_libtool_dependency_info.dat")).bytes) #expect(actual.inputs.sorted() == [ - "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/lib.o", + "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib.o", "\(buildDirectory)/Debug/libDeepLib.a" ].sorted()) #expect(actual.outputs.sorted() == [ @@ -5760,7 +5760,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script } try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in results.consumeTasksMatchingRuleTypes(["RegisterExecutionPolicyException", "Gate", "ClangStatCache", "ProcessSDKImports"]) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRule(["Libtool", "\(buildDirectory)/Debug/libLib.a", "normal"])) { _ in } results.checkTask(.matchRule(["Ld", "\(buildDirectory)/Debug/Tool", "normal"])) { _ in } results.checkNoTask() @@ -5772,7 +5772,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script } try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in results.consumeTasksMatchingRuleTypes(["RegisterExecutionPolicyException", "Gate", "ClangStatCache", "ProcessSDKImports"]) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/x86_64/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRule(["Libtool", "\(buildDirectory)/Debug/libDeepLib.a", "normal"])) { _ in } results.checkTask(.matchRule(["Libtool", "\(buildDirectory)/Debug/libLib.a", "normal"])) { _ in } results.checkTask(.matchRule(["Ld", "\(buildDirectory)/Debug/Tool", "normal"])) { _ in } @@ -5853,28 +5853,28 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script let parameters = BuildParameters(action: .install, configuration: "Debug") try await tester.checkBuild(parameters: parameters, runDestination: .macOS, persistent: true) { results in // Verify that the .o files are compiled. - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/x86_64/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } // Verify that the .a files are created. results.checkTask(.matchRuleType("Libtool"), .matchRuleItem("\(buildDirectory)/UninstalledProducts/macosx/libDeepLib.a")) { task in - task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/x86_64/DeepLib_libtool_dependency_info.dat"]) + task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/DeepLib_libtool_dependency_info.dat"]) } results.checkTask(.matchRuleType("Libtool"), .matchRuleItem("\(buildDirectory)/UninstalledProducts/macosx/libLib.a")) { task in task.checkCommandLineContains(["-lDeepLib"]) - task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/Lib_libtool_dependency_info.dat"]) + task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Lib_libtool_dependency_info.dat"]) } // Verify that everything is linked together properly. Note that the "deep lib" is linked into the static archive above. results.checkTask(.matchRuleType("Ld"), .matchRuleItem("\(SRCROOT)/aProject/installable/usr/local/bin/Tool")) { task in task.checkCommandLineContains(["-lLib"]) - task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/x86_64/Tool_dependency_info.dat"]) + task.checkCommandLineContains(["-dependency_info", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Tool_dependency_info.dat"]) } // Verify that the dependency info indeed has the libraries we expected. - let actual = try DependencyInfo(bytes: try tester.fs.read(Path("\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/Lib_libtool_dependency_info.dat")).bytes) + let actual = try DependencyInfo(bytes: try tester.fs.read(Path("\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Lib_libtool_dependency_info.dat")).bytes) #expect(actual.inputs.sorted() == [ - "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/lib.o", + "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib.o", "\(buildDirectory)/UninstalledProducts/macosx/libDeepLib.a", "\(buildDirectory)/Debug/libDeepLib.a", ].sorted()) @@ -5892,7 +5892,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script } try await tester.checkBuild(parameters: parameters, runDestination: .macOS, persistent: true) { results in results.consumeTasksMatchingRuleTypes(excludingTypes) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/x86_64/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Lib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib.o", "\(SRCROOT)/aProject/lib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRule(["Libtool", "\(buildDirectory)/UninstalledProducts/macosx/libLib.a", "normal"])) { _ in } results.checkTask(.matchRule(["Ld", "\(SRCROOT)/aProject/installable/usr/local/bin/Tool", "normal"])) { _ in } results.checkNoTask() @@ -5904,7 +5904,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script } try await tester.checkBuild(parameters: parameters, runDestination: .macOS, persistent: true) { results in results.consumeTasksMatchingRuleTypes(excludingTypes) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/x86_64/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/DeepLib.build/Objects-normal/\(results.runDestinationTargetArchitecture)/deeplib.o", "\(SRCROOT)/aProject/deeplib.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRule(["Libtool", "\(buildDirectory)/UninstalledProducts/macosx/libDeepLib.a", "normal"])) { _ in } results.checkTask(.matchRule(["Libtool", "\(buildDirectory)/UninstalledProducts/macosx/libLib.a", "normal"])) { _ in } results.checkTask(.matchRule(["Ld", "\(SRCROOT)/aProject/installable/usr/local/bin/Tool", "normal"])) { _ in } @@ -6246,8 +6246,8 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script try await tester.checkBuild(runDestination: .macOS, persistent: true, signableTargets: signableTargets) { results in results.consumeTasksMatchingRuleTypes(excludedTasks) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Other.build/Objects-normal/x86_64/other.o", "\(SRCROOT)/aProject/other.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/x86_64/tool.o", "\(SRCROOT)/aProject/tool.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Other.build/Objects-normal/\(results.runDestinationTargetArchitecture)/other.o", "\(SRCROOT)/aProject/other.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/tool.o", "\(SRCROOT)/aProject/tool.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRule(["Ld", "\(buildDirectory)/Debug/Other.framework/Versions/A/Other", "normal"])) { _ in } results.checkTask(.matchRule(["GenerateTAPI", "\(buildDirectory)/EagerLinkingTBDs/Debug/Other.framework/Versions/A/Other.tbd"])) { _ in } results.checkTask(.matchRule(["Ld", "\(buildDirectory)/Debug/Tool.app/Contents/MacOS/Tool", "normal"])) { _ in } @@ -6361,7 +6361,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script } try await tester.checkBuild(runDestination: .macOS, persistent: true, signableTargets: signableTargets) { results in results.consumeTasksMatchingRuleTypes(excludedTasks) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Other.build/Objects-normal/x86_64/other.o", "\(SRCROOT)/aProject/other.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Other.build/Objects-normal/\(results.runDestinationTargetArchitecture)/other.o", "\(SRCROOT)/aProject/other.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRule(["Ld", "\(buildDirectory)/Debug/Other.framework/Versions/A/Other", "normal"])) { _ in } results.checkTask(.matchRule(["GenerateTAPI", "\(buildDirectory)/EagerLinkingTBDs/Debug/Other.framework/Versions/A/Other.tbd"])) { _ in } results.checkTask(.matchRule(["CodeSign", "\(buildDirectory)/Debug/Other.framework/Versions/A"])) { _ in } @@ -6712,7 +6712,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script // For the first pass, these should be the same for both targets. for targetName in signableTargets { - results.checkTask(.matchTargetName(targetName), .matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/tool.o", "\(SRCROOT)/aProject/tool.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTargetName(targetName), .matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/tool.o", "\(SRCROOT)/aProject/tool.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchTargetName(targetName), .matchRule(["Ld", "\(buildDirectory)/Debug/\(targetName).app/Contents/MacOS/\(targetName)", "normal"])) { _ in } results.checkTask(.matchTargetName(targetName), .matchRule(["Copy", "\(buildDirectory)/Debug/\(targetName).app/Contents/Resources/resource.txt", "\(SRCROOT)/aProject/resource.txt"])) { _ in } results.checkTask(.matchTargetName(targetName), .matchRule(["Copy", "\(buildDirectory)/Debug/\(targetName).app/Contents/Resources/other.txt", "\(SRCROOT)/aProject/other.txt"])) { _ in } @@ -6957,8 +6957,8 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script try await tester.checkBuild(runDestination: .macOS, persistent: true, signableTargets: ["Tool"]) { results in results.consumeTasksMatchingRuleTypes(excludedTasks) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/x86_64/tool.o", "\(SRCROOT)/aProject/tool.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchRule(["Ld", "\(buildDirectory)/Debug/Tool.app/Contents/MacOS/Tool", "normal", "x86_64"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/tool.o", "\(SRCROOT)/aProject/tool.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["Ld", "\(buildDirectory)/Debug/Tool.app/Contents/MacOS/Tool", "normal", results.runDestinationTargetArchitecture])) { _ in } results.checkTask(.matchRule(["Copy", "\(buildDirectory)/Debug/Tool.app/Contents/Resources/resource.txt", "\(SRCROOT)/aProject/resource.txt"])) { _ in } results.checkTask(.matchRule(["CodeSign", "\(buildDirectory)/Debug/Tool.app"])) { _ in } results.checkTask(.matchRule(["Copy", "\(buildDirectory)/Debug/Tool.app/Contents/other.txt", "\(SRCROOT)/aProject/other.txt"])) { _ in } @@ -7360,7 +7360,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script results.checkNoDiagnostics() try results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("example.fake-ts"), .matchRuleItemBasename("example.fake-ts.fake-js")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example.fake-ts.fake-js", "\(SRCROOT)/example.fake-ts", "debug", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example.fake-ts.fake-js", "\(SRCROOT)/example.fake-ts", "debug", results.runDestinationTargetArchitecture]) if enableSandboxingInTest { #expect(task.commandLine.first == "/usr/bin/sandbox-exec") @@ -7391,7 +7391,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script } try results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("example.fake-ts.fake-js"), .matchRuleItemBasename("example.fake-ts.fake-js.fake-uglified")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example.fake-ts.fake-js.fake-uglified", "\(SRCROOT)/example.fake-ts.fake-js", "debug", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example.fake-ts.fake-js.fake-uglified", "\(SRCROOT)/example.fake-ts.fake-js", "debug", results.runDestinationTargetArchitecture]) let path = task.outputPaths[0] let output = try fs.read(path).asString @@ -7515,7 +7515,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script results.checkNoDiagnostics() try results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("example-1.fake-ts")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example-1.fake-ts.E.fake-js", "\(SRCROOT)/example-1.fake-ts.F.fake-js", "\(SRCROOT)/example-1.fake-ts", "debug", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example-1.fake-ts.E.fake-js", "\(SRCROOT)/example-1.fake-ts.F.fake-js", "\(SRCROOT)/example-1.fake-ts", "debug", results.runDestinationTargetArchitecture]) if enableSandboxingInTest { #expect(task.commandLine.first == "/usr/bin/sandbox-exec") @@ -7534,7 +7534,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script } try results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("example-2.fake-ts")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example-2.fake-ts.E.fake-js", "\(SRCROOT)/example-2.fake-ts.F.fake-js", "\(SRCROOT)/example-2.fake-ts", "debug", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/example-2.fake-ts.E.fake-js", "\(SRCROOT)/example-2.fake-ts.F.fake-js", "\(SRCROOT)/example-2.fake-ts", "debug", results.runDestinationTargetArchitecture]) if enableSandboxingInTest { #expect(task.commandLine.first == "/usr/bin/sandbox-exec") diff --git a/Tests/SWBBuildSystemTests/ClangExplicitModulesTests.swift b/Tests/SWBBuildSystemTests/ClangExplicitModulesTests.swift index 1df34302..872b0043 100644 --- a/Tests/SWBBuildSystemTests/ClangExplicitModulesTests.swift +++ b/Tests/SWBBuildSystemTests/ClangExplicitModulesTests.swift @@ -2771,7 +2771,7 @@ fileprivate struct ClangExplicitModulesTests: CoreBasedTests { } // Remove the object file so compilation has to re-run on the next build, but scanning does not. - try tester.fs.remove(testWorkspace.sourceRoot.join("aProject/Build/aProject.build/Debug/Library.build/Objects-normal/x86_64/file.o")) + try tester.fs.remove(testWorkspace.sourceRoot.join("aProject/Build/aProject.build/Debug/Library.build/Objects-normal/\(RunDestinationInfo.macOS.targetArchitecture)/file.o")) // The incremental build should succeed because dependencies will be ingested from disk. try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in diff --git a/Tests/SWBBuildSystemTests/CodeSigningBuildOperationTests.swift b/Tests/SWBBuildSystemTests/CodeSigningBuildOperationTests.swift new file mode 100644 index 00000000..66cbb4e0 --- /dev/null +++ b/Tests/SWBBuildSystemTests/CodeSigningBuildOperationTests.swift @@ -0,0 +1,143 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift open source project +// +// Copyright (c) 2025 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See http://swift.org/LICENSE.txt for license information +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +import SWBBuildSystem +import SWBCore +import SWBTaskExecution +import SWBTestSupport +import SWBUtil +import Testing + +@Suite +fileprivate struct CodeSigningBuildOperationTests: CoreBasedTests { + @Test(.requireSDKs(.macOS)) + func entitlementsModificationInvalidatesBuildDescription() async throws { + try await withTemporaryDirectory { tmpDirPath in + let testProject = TestProject( + "aProject", + sourceRoot: tmpDirPath, + groupTree: TestGroup( + "SomeFiles", path: "Sources", + children: [ + TestFile("AppSource.m"), + ]), + buildConfigurations: [ + TestBuildConfiguration( "Debug", buildSettings: [ + "COPY_PHASE_STRIP": "NO", + "DEBUG_INFORMATION_FORMAT": "dwarf", + "GENERATE_INFOPLIST_FILE": "YES", + "PRODUCT_NAME": "$(TARGET_NAME)", + "CODE_SIGN_IDENTITY": "-", + "CODE_SIGN_ENTITLEMENTS": "Entitlements.entitlements", + "SDKROOT": "macosx", + "SUPPORTED_PLATFORMS": "macosx", + ]), + ], + targets: [ + TestStandardTarget( + "AppTarget", + type: .application, + buildPhases: [ + TestSourcesBuildPhase([ + "AppSource.m", + ]), + ], + ), + ] + ) + + let tester = try await BuildOperationTester(getCore(), testProject, simulated: false) + let SRCROOT = tester.workspace.projects[0].sourceRoot.str + + try tester.fs.createDirectory(Path(SRCROOT).join("Sources"), recursive: true) + try tester.fs.write(Path(SRCROOT).join("Sources/AppSource.m"), contents: "int main() { return 0; }") + try await tester.fs.writePlist(Path(SRCROOT).join("Entitlements.entitlements"), .plDict([:])) + + try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .macOS, persistent: true, signableTargets: ["AppTarget"]) { results in + results.checkNoDiagnostics() + } + + // Modify the entitlements in between builds, but make no other changes which would invalidate the build description. + try tester.fs.touch(Path(SRCROOT).join("Entitlements.entitlements")) + + // A subsequent build should succeed, and should NOT diagnose entitlements modification during the build. + try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .macOS, persistent: true, signableTargets: ["AppTarget"]) { results in + results.checkNoDiagnostics() + } + } + } + + @Test(.requireSDKs(.macOS)) + func entitlementsProcessingNotInvalidatedByUnrelatedSettingsChange() async throws { + try await withTemporaryDirectory { tmpDirPath in + let testProject = TestProject( + "aProject", + sourceRoot: tmpDirPath, + groupTree: TestGroup( + "SomeFiles", path: "Sources", + children: [ + TestFile("AppSource.m"), + ]), + buildConfigurations: [ + TestBuildConfiguration( "Debug", buildSettings: [ + "COPY_PHASE_STRIP": "NO", + "DEBUG_INFORMATION_FORMAT": "dwarf", + "GENERATE_INFOPLIST_FILE": "YES", + "PRODUCT_NAME": "$(TARGET_NAME)", + "CODE_SIGN_IDENTITY": "-", + "CODE_SIGN_ENTITLEMENTS": "Entitlements.entitlements", + "SDKROOT": "macosx", + "SUPPORTED_PLATFORMS": "macosx", + ]), + ], + targets: [ + TestStandardTarget( + "AppTarget", + type: .application, + buildPhases: [ + TestSourcesBuildPhase([ + "AppSource.m", + ]), + ], + ), + ] + ) + + let tester = try await BuildOperationTester(getCore(), testProject, simulated: false) + let SRCROOT = tester.workspace.projects[0].sourceRoot.str + + try tester.fs.createDirectory(Path(SRCROOT).join("Sources"), recursive: true) + try tester.fs.write(Path(SRCROOT).join("Sources/AppSource.m"), contents: "int main() { return 0; }") + try await tester.fs.writePlist(Path(SRCROOT).join("Entitlements.entitlements"), .plDict([:])) + + try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .macOS, persistent: true, signableTargets: ["AppTarget"]) { results in + results.checkNoDiagnostics() + } + + // After changing irrelevant settings, we should not see CodeSign/ProcessProductPackaging tasks. + // We may still see a task to process Info.plist since that supports build settings interpolation. + try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug", overrides: ["Foo": "Bar"]), runDestination: .macOS, persistent: true, signableTargets: ["AppTarget"]) { results in + results.checkNoTask(.matchRuleType("CodeSign")) + results.checkNoTask(.matchRuleType("ProcessProductPackaging")) + results.checkNoDiagnostics() + } + + // Changing CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION should force them to re-run. + try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug", overrides: ["CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION": "YES"]), runDestination: .macOS, persistent: true, signableTargets: ["AppTarget"]) { results in + results.checkTaskExists(.matchRuleType("CodeSign")) + results.checkTasks(.matchRuleType("ProcessProductPackaging")) { #expect(!$0.isEmpty) } + results.checkNoDiagnostics() + } + } + } +} + diff --git a/Tests/SWBBuildSystemTests/DependencyCycleDiagnosticsTests.swift b/Tests/SWBBuildSystemTests/DependencyCycleDiagnosticsTests.swift index ef1f3f25..b3bed214 100644 --- a/Tests/SWBBuildSystemTests/DependencyCycleDiagnosticsTests.swift +++ b/Tests/SWBBuildSystemTests/DependencyCycleDiagnosticsTests.swift @@ -797,7 +797,7 @@ fileprivate struct DependencyCycleDiagnosticsTests: CoreBasedTests { try await tester.checkBuild(runDestination: .macOS, persistent: true) { results in // FIXME: (ChecksumOnlyFileSystem) // null build seems to be erroneously spawning a - // ["CompileC", "*/BaseFoo.o", "*/BaseFoo.m", "normal", "x86_64", "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"] + // ["CompileC", "*/BaseFoo.o", "*/BaseFoo.m", "normal", results.runDestinationTargetArchitecture, "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"] // Surprisingly "results.checkTask" does not catch the "CompileC" task, but "results.checkTasks" does. results.checkTasks(.matchRuleType("CompileC")) { _ in } results.checkNoTask() diff --git a/Tests/SWBBuildSystemTests/DiscoveredDependenciesBuildOperationTests.swift b/Tests/SWBBuildSystemTests/DiscoveredDependenciesBuildOperationTests.swift index 398bf185..7b471256 100644 --- a/Tests/SWBBuildSystemTests/DiscoveredDependenciesBuildOperationTests.swift +++ b/Tests/SWBBuildSystemTests/DiscoveredDependenciesBuildOperationTests.swift @@ -13,6 +13,7 @@ import SWBCore import SWBTestSupport import SwiftBuildTestSupport +import SWBProtocol import SWBUtil import Testing @@ -182,7 +183,7 @@ fileprivate struct DiscoveredDependenciesBuildOperationTests: CoreBasedTests { // Modify the dep implementation, and rebuild. The swiftmodule of Dep won't change, so Client will not need to run SwiftDriver planning. // // FIXME: This removal is needed to work around , removal tracked by: [BLOCKED] Remove workarounds for - try tester.fs.remove(SRCROOT.join("build/aProject.build/Debug/Dep.build/Objects-normal/x86_64/Dep.o")) + try tester.fs.remove(SRCROOT.join("build/aProject.build/Debug/Dep.build/Objects-normal/\(RunDestinationInfo.macOS.targetArchitecture)/Dep.o")) try await tester.fs.writeFileContents(SRCROOT.join("Sources/Dep.swift")) { contents in contents <<< "public func dep0() { print() }\n" } @@ -225,7 +226,7 @@ fileprivate struct DiscoveredDependenciesBuildOperationTests: CoreBasedTests { // Change the public API of the dep, and rebuild. // // FIXME: This removal is needed to work around , removal tracked by: [BLOCKED] Remove workarounds for - try tester.fs.remove(SRCROOT.join("build/aProject.build/Debug/Dep.build/Objects-normal/x86_64/Dep.o")) + try tester.fs.remove(SRCROOT.join("build/aProject.build/Debug/Dep.build/Objects-normal/\(RunDestinationInfo.macOS.targetArchitecture)/Dep.o")) try await tester.fs.writeFileContents(SRCROOT.join("Sources/Dep.swift")) { contents in contents <<< "public func dep0() { }\n" contents <<< "public func dep1() { }\n" @@ -452,15 +453,15 @@ fileprivate struct DiscoveredDependenciesBuildOperationTests: CoreBasedTests { // Do a first build where everything should be ok. try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .macOS, persistent: true) { results in results.checkNoDiagnostics() - } - // The linker dependency info should contain the stub, not the binary. - let ldDepsPath = SRCROOT.join("build/aProject.build/Debug/App.build/Objects-normal/x86_64/App_dependency_info.dat") - let dependencyInfo = try DependencyInfo(bytes: tester.fs.read(ldDepsPath).bytes) - #expect(dependencyInfo.inputs.contains(SRCROOT.join("build/EagerLinkingTBDs/Debug/Fmwk.framework/Fmwk.tbd").str)) - #expect(dependencyInfo.inputs.contains(SRCROOT.join("build/EagerLinkingTBDs/Debug/Fmwk.framework/Versions/A/Fmwk.tbd").str)) - #expect(!dependencyInfo.inputs.contains(SRCROOT.join("build/Debug/Fmwk.framework/Fmwk").str)) - #expect(!dependencyInfo.inputs.contains(SRCROOT.join("build/Debug/Fmwk.framework/Versions/A/Fmwk").str)) + // The linker dependency info should contain the stub, not the binary. + let ldDepsPath = SRCROOT.join("build/aProject.build/Debug/App.build/Objects-normal/\(results.runDestinationTargetArchitecture)/App_dependency_info.dat") + let dependencyInfo = try DependencyInfo(bytes: tester.fs.read(ldDepsPath).bytes) + #expect(dependencyInfo.inputs.contains(SRCROOT.join("build/EagerLinkingTBDs/Debug/Fmwk.framework/Fmwk.tbd").str)) + #expect(dependencyInfo.inputs.contains(SRCROOT.join("build/EagerLinkingTBDs/Debug/Fmwk.framework/Versions/A/Fmwk.tbd").str)) + #expect(!dependencyInfo.inputs.contains(SRCROOT.join("build/Debug/Fmwk.framework/Fmwk").str)) + #expect(!dependencyInfo.inputs.contains(SRCROOT.join("build/Debug/Fmwk.framework/Versions/A/Fmwk").str)) + } } } } diff --git a/Tests/SWBBuildSystemTests/IndexBuildOperationTests.swift b/Tests/SWBBuildSystemTests/IndexBuildOperationTests.swift index 70ce2ea7..3111a3f2 100644 --- a/Tests/SWBBuildSystemTests/IndexBuildOperationTests.swift +++ b/Tests/SWBBuildSystemTests/IndexBuildOperationTests.swift @@ -101,20 +101,20 @@ fileprivate struct IndexBuildOperationTests: CoreBasedTests { results.consumeTasksMatchingRuleTypes(Self.excludedStartTaskTypes) // Swift modules and core data code generation - results.checkTaskExists(.matchRule(["SwiftDriver", "FwkTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"])) - results.checkTaskExists(.matchRule(["SwiftDriver Compilation Requirements", "FwkTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"])) - results.checkTaskExists(.matchRule(["SwiftDriver Compilation", "FwkTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"])) - results.checkTaskExists(.matchRule(["SwiftCompile", "normal", "x86_64", "Compiling fwk.swift", "\(tmpDirPath.str)/Test/aProject/fwk.swift"])) - results.checkTaskExists(.matchRule(["SwiftEmitModule", "normal", "x86_64", "Emitting module for FwkTarget"])) + results.checkTaskExists(.matchRule(["SwiftDriver", "FwkTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"])) + results.checkTaskExists(.matchRule(["SwiftDriver Compilation Requirements", "FwkTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"])) + results.checkTaskExists(.matchRule(["SwiftDriver Compilation", "FwkTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"])) + results.checkTaskExists(.matchRule(["SwiftCompile", "normal", results.runDestinationTargetArchitecture, "Compiling fwk.swift", "\(tmpDirPath.str)/Test/aProject/fwk.swift"])) + results.checkTaskExists(.matchRule(["SwiftEmitModule", "normal", results.runDestinationTargetArchitecture, "Emitting module for FwkTarget"])) results.checkTask(.matchRule(["DataModelCodegen", "\(tmpDirPath.str)/Test/aProject/AppTarget.xcdatamodel"])) { _ in } - results.checkTask(.matchRule(["SwiftMergeGeneratedHeaders", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Headers/FwkTarget-Swift.h", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget-Swift.h"])) { _ in } - results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/x86_64-apple-macos.swiftdoc", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget.swiftdoc"])) { _ in } - results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/x86_64-apple-macos.swiftmodule", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget.swiftmodule"])) { _ in } - results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/x86_64-apple-macos.abi.json", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget.abi.json"])) { _ in } - results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget.swiftsourceinfo"])) { _ in } - results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget-OutputFileMap.json"])) { _ in } - results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget.SwiftFileList"])) { _ in } - results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget.SwiftConstValuesFileList"])) { _ in } + results.checkTask(.matchRule(["SwiftMergeGeneratedHeaders", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Headers/FwkTarget-Swift.h", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget-Swift.h"])) { _ in } + results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget.swiftdoc"])) { _ in } + results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget.swiftmodule"])) { _ in } + results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget.abi.json"])) { _ in } + results.checkTask(.matchRule(["Copy", "\(tmpDirPath.str)/Test/aProject/build/Debug/FwkTarget.framework/Versions/A/Modules/FwkTarget.swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-macos.swiftsourceinfo", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget.swiftsourceinfo"])) { _ in } + results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget-OutputFileMap.json"])) { _ in } + results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget.SwiftFileList"])) { _ in } + results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget.SwiftConstValuesFileList"])) { _ in } // Header maps results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/AppTarget.build/AppTarget-all-non-framework-target-headers.hmap"])) { _ in } @@ -131,7 +131,7 @@ fileprivate struct IndexBuildOperationTests: CoreBasedTests { results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/FwkTarget.hmap"])) { _ in } // Const extraction protocols - results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/FwkTarget_const_extract_protocols.json"])) { _ in } + results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FwkTarget_const_extract_protocols.json"])) { _ in } // VFS results.checkTask(.matchRulePattern(["WriteAuxiliaryFile", .suffix("all-product-headers.yaml")])) { _ in } @@ -140,8 +140,8 @@ fileprivate struct IndexBuildOperationTests: CoreBasedTests { results.checkTask(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/DerivedSources/FwkTarget_vers.c"])) { _ in } // Response files - results.checkTaskExists(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/x86_64/7187679823f38a2a940e0043cdf9d637-common-args.resp"])) - results.checkTaskExists(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/e6072d4f65d7061329687fe24e3d63a7-common-args.resp"])) + results.checkTaskExists(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/FwkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/7187679823f38a2a940e0043cdf9d637-common-args.resp"])) + results.checkTaskExists(.matchRule(["WriteAuxiliaryFile", "\(tmpDirPath.str)/Test/aProject/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/e6072d4f65d7061329687fe24e3d63a7-common-args.resp"])) // Mkdir diff --git a/Tests/SWBBuildSystemTests/SDKImportsBuildOperationTests.swift b/Tests/SWBBuildSystemTests/SDKImportsBuildOperationTests.swift index 4521e86d..902bfb2e 100644 --- a/Tests/SWBBuildSystemTests/SDKImportsBuildOperationTests.swift +++ b/Tests/SWBBuildSystemTests/SDKImportsBuildOperationTests.swift @@ -106,7 +106,7 @@ fileprivate struct SDKImportsBuildOperationTests: CoreBasedTests { let derivedData = tmpDir.join("build/Debug") let appResources = derivedData.join("tool.app/Contents/Resources") - let sdkImportsPath = appResources.join("tool_normal_x86_64_sdk_imports.json") + let sdkImportsPath = appResources.join("tool_normal_\(results.runDestinationTargetArchitecture)_sdk_imports.json") let sdkImportsData = try Data(contentsOf: .init(filePath: sdkImportsPath.str)) struct SDKImports: Codable { diff --git a/Tests/SWBBuildSystemTests/XCFrameworkBuildOperationTests.swift b/Tests/SWBBuildSystemTests/XCFrameworkBuildOperationTests.swift index 4de49c49..25d33b23 100644 --- a/Tests/SWBBuildSystemTests/XCFrameworkBuildOperationTests.swift +++ b/Tests/SWBBuildSystemTests/XCFrameworkBuildOperationTests.swift @@ -265,10 +265,10 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { let buildDir = Path(buildDirectory).join("Debug") let basePath = buildDir.join(frameworkName) - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/F3.build/Objects-normal/x86_64/A3.o", "\(sourceDirectory)/Sources/A3.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/F3.build/Objects-normal/x86_64/A3.o", "\(sourceDirectory)/Sources/A3.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRule(["ProcessXCFramework", "\(sourceDirectory)/Sources/sample.xcframework", basePath.str, "macos"])) { _ in } - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/F2.build/Objects-normal/x86_64/A2.o", "\(sourceDirectory)/Sources/A2.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/F1.build/Objects-normal/x86_64/A1.o", "\(sourceDirectory)/Sources/A1.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/F2.build/Objects-normal/x86_64/A2.o", "\(sourceDirectory)/Sources/A2.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchRule(["CompileC", "\(buildDirectory)/aProject.build/Debug/F1.build/Objects-normal/x86_64/A1.o", "\(sourceDirectory)/Sources/A1.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchRuleType("Ld"), .matchRuleItem("\(buildDirectory)/Debug/F3.framework/Versions/A/F3")) { _ in } results.checkTask(.matchRuleType("Ld"), .matchRuleItem("\(buildDirectory)/Debug/F2.app/Contents/MacOS/F2")) { _ in } results.checkTask(.matchRuleType("Ld"), .matchRuleItem("\(buildDirectory)/Debug/F1.app/Contents/MacOS/F1")) { _ in } @@ -297,20 +297,20 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { } // Check a normal build. - try await tester.checkBuild(parameters: parameters, runDestination: .macOS, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in + try await tester.checkBuild(parameters: parameters, runDestination: .macOSIntel, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in try validateBuild(results) } // Clean out the build folder. - try await tester.checkBuild(parameters: parameters, runDestination: .macOS, buildCommand: .cleanBuildFolder(style: .regular)) { _ in } + try await tester.checkBuild(parameters: parameters, runDestination: .macOSIntel, buildCommand: .cleanBuildFolder(style: .regular)) { _ in } // Check a test build. - try await tester.checkBuild(parameters: parameters, runDestination: .macOS, schemeCommand: .test, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in + try await tester.checkBuild(parameters: parameters, runDestination: .macOSIntel, schemeCommand: .test, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in try validateBuild(results) } // Clean out the build folder. - try await tester.checkBuild(parameters: parameters, runDestination: .macOS, buildCommand: .cleanBuildFolder(style: .regular)) { _ in } + try await tester.checkBuild(parameters: parameters, runDestination: .macOSIntel, buildCommand: .cleanBuildFolder(style: .regular)) { _ in } // Check building a package. let relevantTargets = tester.workspace.allTargets.filter { ["F4", "F5", "F6", "F7", "F8"].contains($0.name) } @@ -318,7 +318,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { buildTargets: relevantTargets.map { BuildRequest.BuildTargetInfo(parameters: parameters, target: $0) }, continueBuildingAfterErrors: false, useParallelTargets: true, useImplicitDependencies: true, useDryRun: false) - try await tester.checkBuild(parameters: parameters, runDestination: .macOS, buildRequest: request, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in + try await tester.checkBuild(parameters: parameters, runDestination: .macOSIntel, buildRequest: request, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in let basePath = Path(pkgBuildDirectory).join("Debug").join(frameworkName) results.checkTask(.matchRule(["ProcessXCFramework", "\(testWorkspace.sourceRoot.str)/aPackageProject/Sources/sample.xcframework", basePath.str, "macos"])) { _ in } @@ -400,7 +400,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { } // Clean out the build folder. - try await tester.checkBuild(parameters: parameters, runDestination: .macOS, buildCommand: .cleanBuildFolder(style: .regular)) { _ in } + try await tester.checkBuild(parameters: parameters, runDestination: .macOSIntel, buildCommand: .cleanBuildFolder(style: .regular)) { _ in } // Check building a package product only let packageProductTarget = try #require(tester.workspace.allTargets.first { $0.name == "P1Product" }) @@ -408,7 +408,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { buildTargets: [BuildRequest.BuildTargetInfo(parameters: parameters, target: packageProductTarget)], continueBuildingAfterErrors: false, useParallelTargets: true, useImplicitDependencies: true, useDryRun: false) - try await tester.checkBuild(parameters: parameters, runDestination: .macOS, buildRequest: packageProductRequest, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in + try await tester.checkBuild(parameters: parameters, runDestination: .macOSIntel, buildRequest: packageProductRequest, persistent: true, signableTargets: signableTargets, signableTargetInputs: signableTargetInputs) { results in let buildDir = Path(pkgBuildDirectory).join("Debug") let basePath = buildDir.join(frameworkName) @@ -489,7 +489,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { try fs.createDirectory(otherXCFrameworkPath, recursive: true) try await XCFrameworkTestSupport.writeXCFramework(otherXCFramework, fs: fs, path: otherXCFrameworkPath, infoLookup: infoLookup) - try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOS) { results in + try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOSIntel) { results in results.checkError(.equal( """ Multiple commands produce '\(SRCROOT)/build/Debug/include/header1.h' @@ -594,7 +594,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { try remove(supportXCFrameworkPath.join(library.libraryIdentifier).join(path)) } - try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOS) { results in + try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOSIntel) { results in results.checkError(StringPattern(stringLiteral: scenario.message(supportXCFrameworkPath.join("x86_64-apple-macos10.15")))) } @@ -659,7 +659,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { try await XCFrameworkTestSupport.writeXCFramework(supportXCFramework, fs: fs, path: supportXCFrameworkPath, infoLookup: infoLookup) - try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOS) { results in + try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOSIntel) { results in results.checkError(.contains("“libsample.xcframework” is not signed with the expected identity and may have been compromised.\nExpected team identifier: mysignature")) } @@ -723,7 +723,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { try await XCFrameworkTestSupport.writeXCFramework(supportXCFramework, fs: fs, path: supportXCFrameworkPath, infoLookup: infoLookup) - try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug", overrides: ["DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION": "YES"]), runDestination: .macOS) { results in + try await tester.checkBuild(parameters: BuildParameters(action: .build, configuration: "Debug", overrides: ["DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION": "YES"]), runDestination: .macOSIntel) { results in results.checkWarning(.contains("XCFramework signature validation is being skipped. Remove `DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION` to disable this warning.")) } @@ -738,7 +738,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { // Create an XCFramework let xcode = try await InstalledXcode.currentlySelected() let infoLookup = try await getCore() - let frameworkPath = try await xcode.compileFramework(path: tmpDirPath.join("macos"), platform: .macOS, infoLookup: infoLookup, archs: ["x86_64"], useSwift: true, static: false) + let frameworkPath = try await xcode.compileFramework(path: tmpDirPath.join("macos"), platform: .macOS, infoLookup: infoLookup, archs: [RunDestinationInfo.macOSIntel.targetArchitecture], useSwift: true, static: false) let packageOutputPath = tmpDirPath.join("Test/aPackageProject/Sources/sample.xcframework") let commandLine = ["createXCFramework", "-framework", frameworkPath.str, "-output", packageOutputPath.str] let service = try await SWBBuildService() @@ -807,7 +807,7 @@ fileprivate struct XCFrameworkBuildOperationTests: CoreBasedTests { let tester = try await BuildOperationTester(getCore(), testWorkspace, simulated: false) try await tester.fs.writeFileContents(sourceRoot.join("aProject/Sources/best.swift")) { contents in } - try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .macOS, persistent: true) { results in + try await tester.checkBuild(parameters: BuildParameters(configuration: "Debug"), runDestination: .macOSIntel, persistent: true) { results in // The build should succeed without reporting any cycles. results.checkNoDiagnostics() } diff --git a/Tests/SWBCorePerfTests/CommandLineSpecPerfTests.swift b/Tests/SWBCorePerfTests/CommandLineSpecPerfTests.swift index 0cee180f..390aee2a 100644 --- a/Tests/SWBCorePerfTests/CommandLineSpecPerfTests.swift +++ b/Tests/SWBCorePerfTests/CommandLineSpecPerfTests.swift @@ -175,8 +175,8 @@ extension CapturingTaskGenerationDelegate: TaskActionCreationDelegate { return LSRegisterURLTaskAction() } - public func createProcessProductEntitlementsTaskAction(scope: MacroEvaluationScope, mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { - return ProcessProductEntitlementsTaskAction(scope: scope, fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) + public func createProcessProductEntitlementsTaskAction(mergedEntitlements: PropertyListItem, entitlementsVariant: EntitlementsVariant, allowEntitlementsModification: Bool, entitlementsDestination: EntitlementsDestination, destinationPlatformName: String, entitlementsFilePath: Path?, fs: any FSProxy) -> any PlannedTaskAction { + return ProcessProductEntitlementsTaskAction(fs: fs, entitlements: mergedEntitlements, entitlementsVariant: entitlementsVariant, allowEntitlementsModification: allowEntitlementsModification, entitlementsDestination: entitlementsDestination, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsFilePath) } public func createProcessProductProvisioningProfileTaskAction() -> any PlannedTaskAction { diff --git a/Tests/SWBCoreTests/CoreTests.swift b/Tests/SWBCoreTests/CoreTests.swift index ad6305e4..35020f17 100644 --- a/Tests/SWBCoreTests/CoreTests.swift +++ b/Tests/SWBCoreTests/CoreTests.swift @@ -315,7 +315,7 @@ import SWBServiceCore #expect(buildSystemSpec != nil) } - @Test(.skipHostOS(.linux, "#expect(core == nil) crashes on Linux")) + @Test func coreLoadErrors() async throws { // Validate that the core fails if there are loading errors. try await withTemporaryDirectory { tmpDirPath in diff --git a/Tests/SWBCoreTests/IndexTargetDependencyResolverTests.swift b/Tests/SWBCoreTests/IndexTargetDependencyResolverTests.swift index bdb9fc06..4441e541 100644 --- a/Tests/SWBCoreTests/IndexTargetDependencyResolverTests.swift +++ b/Tests/SWBCoreTests/IndexTargetDependencyResolverTests.swift @@ -135,6 +135,7 @@ import SWBUtil let tester = try await BuildOperationTester(core, workspace, simulated: false) let workspaceContext = WorkspaceContext(core: core, workspace: tester.workspace, processExecutionCache: .sharedForTesting) + workspaceContext.updateUserPreferences(.defaultForTesting) try await tester.checkIndexBuildGraph(targets: [macApp, macApp2, iosApp, iosApp2, fwkTarget_mac, fwkTarget_ios], workspaceOperation: true) { results in #expect(results.targets().map { results.targetNameAndPlatform($0) } == [ "FwkTarget_mac-macos", "macApp-macos", "macApp2-macos", @@ -262,6 +263,7 @@ import SWBUtil let tester = try await BuildOperationTester(core, workspace, simulated: false) let workspaceContext = WorkspaceContext(core: core, workspace: tester.workspace, processExecutionCache: .sharedForTesting) + workspaceContext.updateUserPreferences(.defaultForTesting) try await tester.checkIndexBuildGraph(targets: [macApp, iosApp, watchKitApp, watchKitExt], workspaceOperation: true) { results in #expect(results.targets().map { results.targetNameAndPlatform($0) } == [ "macApp-macos", "iosApp-iphoneos", "iosApp-iphonesimulator", @@ -758,6 +760,7 @@ import SWBUtil let tester = try await BuildOperationTester(core, workspace, simulated: false) let workspaceContext = WorkspaceContext(core: core, workspace: tester.workspace, processExecutionCache: .sharedForTesting) + workspaceContext.updateUserPreferences(.defaultForTesting) try await tester.checkIndexBuildGraph(targets: [catalystAppTarget1, catalystAppTarget2, catalystAppTarget3, osxAppTarget, osxAppTarget_iosmac, fwkTarget, fwkTarget_osx], workspaceOperation: true) { results in #expect(results.targets().map { results.targetNameAndPlatform($0) } == [ "FwkTarget-iphoneos", "catalystApp1-iphoneos", "FwkTarget-iphonesimulator", "catalystApp1-iphonesimulator", "FwkTarget-iosmac", "catalystApp1-iosmac", "catalystApp2-iphoneos", "catalystApp2-iphonesimulator", "catalystApp2-iosmac", "catalystApp3-iphoneos", "catalystApp3-iphonesimulator", "catalystApp3-iosmac", "FwkTarget_osx-macos", "catalystApp3-macos", "osxApp-macos", "osxApp_iosmac-iosmac", "FwkTarget_osx-iosmac", diff --git a/Tests/SWBCoreTests/SettingsTests.swift b/Tests/SWBCoreTests/SettingsTests.swift index 333db96d..515f71a2 100644 --- a/Tests/SWBCoreTests/SettingsTests.swift +++ b/Tests/SWBCoreTests/SettingsTests.swift @@ -17,7 +17,7 @@ import Testing import SWBProtocol import SWBTestSupport @_spi(Testing) import SWBUtil -import SWBMacro +@_spi(Testing) import SWBMacro @_spi(Testing) import SWBCore @Suite fileprivate struct SettingsTests: CoreBasedTests { diff --git a/Tests/SWBMacroTests/MacroParsingTests.swift b/Tests/SWBMacroTests/MacroParsingTests.swift index 84593196..b9b408a8 100644 --- a/Tests/SWBMacroTests/MacroParsingTests.swift +++ b/Tests/SWBMacroTests/MacroParsingTests.swift @@ -790,7 +790,7 @@ fileprivate let testFileData = [ } func endPreprocessorInclusion() { } - func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { + func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, pathRef: OrderedSet.Index, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { } func handleDiagnostic(_ diagnostic: MacroConfigFileDiagnostic, parser: MacroConfigFileParser) { @@ -895,7 +895,7 @@ private func TestMacroConfigFileParser(_ string: String, expectedAssignments: [A func endPreprocessorInclusion() { self.includeDirectivesCount += 1 } - func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { + func foundMacroValueAssignment(_ macroName: String, conditions: [(param: String, pattern: String)], value: String, path: Path, pathRef: OrderedSet.Index, startLine: Int, endLine: Int, startColumn: Int, endColumn: Int, parser: MacroConfigFileParser) { // print("\(parser.lineNumber): \(macroName)\(conditions.map({ "[\($0.param)=\($0.pattern)]" }).joinWithSeparator(""))=\(value)") assignments.append((macro: macroName, conditions: conditions, value: value)) locations.append((macro: macroName, path: path, startLine: startLine, endLine: endLine, startColumn: startColumn, endColumn: endColumn)) diff --git a/Tests/SWBTaskConstructionTests/BuildActionTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/BuildActionTaskConstructionTests.swift index 6c9371a9..fb11f62f 100644 --- a/Tests/SWBTaskConstructionTests/BuildActionTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/BuildActionTaskConstructionTests.swift @@ -784,7 +784,7 @@ fileprivate struct BuildActionTaskConstructionTests: CoreBasedTests { results.checkTask(.matchTarget(target), .matchRule(["CpHeader", "/tmp/aProject.dst/Applications/SomeOtherApp.app/InternalFrameworks/FrameworkTarget.framework/Versions/A/PrivateHeaders/PrivateHeaderFile.h", "\(SRCROOT)/PrivateHeaderFile.h"])) { _ in } // There should be tasks to create the binary. - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/SourceOne.o", "\(SRCROOT)/SourceOne.m", "normal", "x86_64", "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceOne.o", "\(SRCROOT)/SourceOne.m", "normal", results.runDestinationTargetArchitecture, "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld"), .matchRuleItem("/tmp/aProject.dst/Applications/SomeOtherApp.app/InternalFrameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("GenerateTAPI"), .matchRuleItem("/tmp/Test/aProject/build/EagerLinkingTBDs/Release/FrameworkTarget.framework/Versions/A/FrameworkTarget.tbd")) { _ in } diff --git a/Tests/SWBTaskConstructionTests/BuildRuleTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/BuildRuleTaskConstructionTests.swift index a6147699..ce18631f 100644 --- a/Tests/SWBTaskConstructionTests/BuildRuleTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/BuildRuleTaskConstructionTests.swift @@ -95,9 +95,9 @@ fileprivate struct BuildRuleTaskConstructionTests: CoreBasedTests { results.checkTask(.matchTarget(target), .matchRule(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeProj.fake-neutral.c", "\(SRCROOT)/Sources/SomeProj.fake-neutral", "normal", "undefined_arch"])) { _ in } // Check that the architecture-neutral rule's outputs are still varianted per architecture - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-normal/x86_64/SomeProj.fake-neutral.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeProj.fake-neutral.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-debug/x86_64/SomeProj.fake-neutral.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeProj.fake-neutral.c", "debug", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-profile/x86_64/SomeProj.fake-neutral.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeProj.fake-neutral.c", "profile", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SomeProj.fake-neutral.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeProj.fake-neutral.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-debug/\(results.runDestinationTargetArchitecture)/SomeProj.fake-neutral.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeProj.fake-neutral.c", "debug", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-profile/\(results.runDestinationTargetArchitecture)/SomeProj.fake-neutral.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeProj.fake-neutral.c", "profile", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } results.checkTask(.matchTarget(target), .matchRule(["RuleScriptExecution", "/tmp/Test/aProject/build/aProject.build/Debug/SomeFwk.build/DerivedSources/file.m.x", "/tmp/Test/aProject/Sources/file.m", "normal", "undefined_arch"])) { _ in } @@ -385,7 +385,7 @@ fileprivate struct BuildRuleTaskConstructionTests: CoreBasedTests { // Check that the clang tasks which process the output of the .fake-lang task add the appropriate flags. results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("Custom.fake-lang")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/x86_64/foo1.c", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/x86_64/foo2.c", "\(SRCROOT)/Sources/Custom.fake-lang", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo1.c", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo2.c", "\(SRCROOT)/Sources/Custom.fake-lang", "normal", results.runDestinationTargetArchitecture]) } results.checkTask(.matchRuleType("CompileC"), .matchRuleItemBasename("foo1.c")) { task in task.checkCommandLineContains(["-flag1"]) @@ -396,18 +396,18 @@ fileprivate struct BuildRuleTaskConstructionTests: CoreBasedTests { // Check that regular.defs is processed by MiG (there's no custom build rule for it). results.checkTask(.matchRuleType("Mig")) { task in - task.checkRuleInfo(["Mig", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/regular.h", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/regularUser.c", "\(SRCROOT)/Sources/regular.defs", "normal", "x86_64"]) + task.checkRuleInfo(["Mig", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/regular.h", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/regularUser.c", "\(SRCROOT)/Sources/regular.defs", "normal", results.runDestinationTargetArchitecture]) } // Check that the custom and special .defs files are processed by the build rule. results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("custom.defs")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/x86_64/customUser.c", "\(SRCROOT)/Sources/custom.defs", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/customUser.c", "\(SRCROOT)/Sources/custom.defs", "normal", results.runDestinationTargetArchitecture]) } results.checkTask(.matchRuleType("CompileC"), .matchRuleItemBasename("customUser.c")) { task in task.checkCommandLineContains(["-specialFlag"]) } results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("special.defs")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/x86_64/specialUser.c", "\(SRCROOT)/Sources/special.defs", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/specialUser.c", "\(SRCROOT)/Sources/special.defs", "normal", results.runDestinationTargetArchitecture]) } results.checkTask(.matchRuleType("CompileC"), .matchRuleItemBasename("specialUser.c")) { task in task.checkCommandLineContains(["-specialFlag"]) @@ -416,7 +416,7 @@ fileprivate struct BuildRuleTaskConstructionTests: CoreBasedTests { // Check that the .h file is processed by the build rule. // This is tested because early in Swift Build's existence header files were explicitly skipped when matching build rules because the file types specified by compiler specs weren't yet respected. results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("header.h")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSourcesx86_64/header_gen.cpp", "\(SRCROOT)/Sources/header.h", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources\(results.runDestinationTargetArchitecture)/header_gen.cpp", "\(SRCROOT)/Sources/header.h", "normal", results.runDestinationTargetArchitecture]) } results.checkTask(.matchRuleType("CompileC"), .matchRuleItemBasename("header_gen.cpp")) { task in task.checkCommandLineContains(["-DHEADER_GEN=1"]) @@ -424,25 +424,25 @@ fileprivate struct BuildRuleTaskConstructionTests: CoreBasedTests { // Check that the two Gen.fake-c files are compiled to .o files with the uniquing suffix applied. results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItem("\(SRCROOT)/Sources/Gen.fake-c")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Gen.c", "\(SRCROOT)/Sources/Gen.fake-c", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Gen.c", "\(SRCROOT)/Sources/Gen.fake-c", "normal", results.runDestinationTargetArchitecture]) task.checkOutputs(contain: [ .path("\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Gen.c"), ]) } results.checkTask(.matchRuleType("CompileC"), .matchRuleItem("\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Gen.c")) { task in task.checkOutputs(contain: [ - .path("\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/Gen-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path("\(SRCROOT)/Sources/Gen.fake-c"))).o"), + .path("\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Gen-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path("\(SRCROOT)/Sources/Gen.fake-c"))).o"), ]) } results.checkTask(.matchRuleType("RuleScriptExecution"), .matchRuleItem("\(SRCROOT)/Sources/Subdir/Gen.fake-c")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Subdir/Gen.c", "\(SRCROOT)/Sources/Subdir/Gen.fake-c", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Subdir/Gen.c", "\(SRCROOT)/Sources/Subdir/Gen.fake-c", "normal", results.runDestinationTargetArchitecture]) task.checkOutputs(contain: [ .path("\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Subdir/Gen.c"), ]) } results.checkTask(.matchRuleType("CompileC"), .matchRuleItem("\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/tmp/Test/aProject/Sources/Subdir/Gen.c")) { task in task.checkOutputs(contain: [ - .path("\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/Gen-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path("\(SRCROOT)/Sources/Subdir/Gen.fake-c"))).o"), + .path("\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Gen-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path("\(SRCROOT)/Sources/Subdir/Gen.fake-c"))).o"), ]) } } @@ -522,7 +522,7 @@ fileprivate struct BuildRuleTaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // There should only be one task to process Multiple.fake-lang, since there are erroneously two build files for one file reference. results.checkTask(.matchTarget(target), .matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("Multiple.fake-lang")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/Debug/Multiple.data", "\(SRCROOT)/Sources/Multiple.fake-lang", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/Debug/Multiple.data", "\(SRCROOT)/Sources/Multiple.fake-lang", "normal", results.runDestinationTargetArchitecture]) } // There should also be a warning emitted about the duplicate file references. @@ -629,14 +629,14 @@ fileprivate struct BuildRuleTaskConstructionTests: CoreBasedTests { results.checkTask(.matchTarget(target), .matchRule(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk.framework_vers1.c", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk_vers.c", "normal", "undefined_arch"])) { _ in } // Check that the architecture-neutral rule's outputs are still varianted per architecture - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-normal/x86_64/SomeFwk.framework_vers1.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk.framework_vers1.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-debug/x86_64/SomeFwk.framework_vers1.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk.framework_vers1.c", "debug", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-profile/x86_64/SomeFwk.framework_vers1.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk.framework_vers1.c", "profile", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SomeFwk.framework_vers1.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk.framework_vers1.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-debug/\(results.runDestinationTargetArchitecture)/SomeFwk.framework_vers1.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk.framework_vers1.c", "debug", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/Objects-profile/\(results.runDestinationTargetArchitecture)/SomeFwk.framework_vers1.o", "\(SRCROOT)/build/aProject.build/Debug/SomeFwk.build/DerivedSources/SomeFwk.framework_vers1.c", "profile", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { _ in } } - results.checkWarning(.equal("no rule to process file '/tmp/Test/aProject/Sources/file.fake-x' of type 'file' for architecture 'x86_64' (in target 'SomeFwk' from project 'aProject')")) - results.checkWarning(.equal("no rule to process file '/tmp/Test/aProject/Sources/file.fake-x' of type 'file' for architecture 'x86_64' (in target 'SomeFwk' from project 'aProject')")) - results.checkWarning(.equal("no rule to process file '/tmp/Test/aProject/Sources/file.fake-x' of type 'file' for architecture 'x86_64' (in target 'SomeFwk' from project 'aProject')")) + results.checkWarning(.equal("no rule to process file '/tmp/Test/aProject/Sources/file.fake-x' of type 'file' for architecture '\(results.runDestinationTargetArchitecture)' (in target 'SomeFwk' from project 'aProject')")) + results.checkWarning(.equal("no rule to process file '/tmp/Test/aProject/Sources/file.fake-x' of type 'file' for architecture '\(results.runDestinationTargetArchitecture)' (in target 'SomeFwk' from project 'aProject')")) + results.checkWarning(.equal("no rule to process file '/tmp/Test/aProject/Sources/file.fake-x' of type 'file' for architecture '\(results.runDestinationTargetArchitecture)' (in target 'SomeFwk' from project 'aProject')")) // Check there are no diagnostics. results.checkNoTask() diff --git a/Tests/SWBTaskConstructionTests/BuildToolTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/BuildToolTaskConstructionTests.swift index 38f8ed00..8fa327a8 100644 --- a/Tests/SWBTaskConstructionTests/BuildToolTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/BuildToolTaskConstructionTests.swift @@ -312,12 +312,12 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { let sortedTasks = tasks.sorted { $0.ruleInfo.lexicographicallyPrecedes($1.ruleInfo) } #expect(sortedTasks.count == 4) for (idx, fileBasename) in ["EntityOne+CoreDataClass", "EntityOne+CoreDataProperties", "\(targetName)+CoreDataModel", "SourceOne"].enumerated() { - try #require(sortedTasks[safe: idx]).checkRuleInfo([.equal("CompileC"), .suffix("\(fileBasename).o"), .suffix("\(fileBasename).m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) + try #require(sortedTasks[safe: idx]).checkRuleInfo([.equal("CompileC"), .suffix("\(fileBasename).o"), .suffix("\(fileBasename).m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) } } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName).LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/\(targetName).framework/Versions/A/\(targetName)", "normal"]) } @@ -356,7 +356,7 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { if params.action == .installAPI { results.checkTask(.matchTarget(target), .matchRuleType("GenerateTAPI")) { task in - task.checkRuleInfo(["GenerateTAPI", "/tmp/aProject.dst/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget.tbd", "normal", "x86_64"]) + task.checkRuleInfo(["GenerateTAPI", "/tmp/aProject.dst/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget.tbd", "normal", results.runDestinationTargetArchitecture]) } } else if params.action == .build { results.checkTask(.matchTarget(target), .matchRuleType("GenerateTAPI")) { task in @@ -701,7 +701,7 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { if action == .build || action == .installAPI { // Check the CompileSwiftSources task, which should include the file generated from the model. do { - let responseFilePath = "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/FrameworkTarget.SwiftFileList" + let responseFilePath = "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.SwiftFileList" var inputFiles = ["\(SRCROOT)/SourceOne.swift"] if visibilityBeingTested != .noCodegen { inputFiles.append("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources/CoreMLGenerated/SmartStuff/SmartStuff.swift") @@ -809,7 +809,7 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { if action == .build || action == .installAPI { // Check the CompileSwiftSources task, which should include the file generated from the model. do { - let responseFilePath = "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/FrameworkTarget.SwiftFileList" + let responseFilePath = "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.SwiftFileList" results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in task.checkCommandLineContains([swiftCompilerPath.str, "@" + responseFilePath]) task.checkCommandLineDoesNotContain("\(SRCROOT)/SourceOne.swift") @@ -827,15 +827,15 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { if action == .build { // Check the CompileC task for the file generated from the model. verifyTask(for: visibilityBeingTested, with: results, in: target, matching: .matchRuleType("CompileC"), .matchRuleItemBasename("SmartStuff.m")) { task in - task.checkRuleInfo([.equal("CompileC"), .suffix("SmartStuff.o"), .suffix("SmartStuff.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) + task.checkRuleInfo([.equal("CompileC"), .suffix("SmartStuff.o"), .suffix("SmartStuff.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) task.checkCommandLineContains(["-fobjc-arc"]) } verifyTask(for: visibilityBeingTested, with: results, in: target, matching: .matchRuleType("CompileC"), .matchRuleItemBasename("SmartStuff2.m")) { task in - task.checkRuleInfo([.equal("CompileC"), .suffix("SmartStuff2.o"), .suffix("SmartStuff2.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) + task.checkRuleInfo([.equal("CompileC"), .suffix("SmartStuff2.o"), .suffix("SmartStuff2.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) task.checkCommandLineContains(["-fobjc-arc"]) } verifyTask(for: visibilityBeingTested, with: results, in: target, matching: .matchRuleType("CompileC"), .matchRuleItemBasename("SmartStuff3.m")) { task in - task.checkRuleInfo([.equal("CompileC"), .suffix("SmartStuff3.o"), .suffix("SmartStuff3.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) + task.checkRuleInfo([.equal("CompileC"), .suffix("SmartStuff3.o"), .suffix("SmartStuff3.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) task.checkCommandLineContains(["-fobjc-arc"]) } } @@ -901,7 +901,7 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { if action == .build || action == .installAPI { // Check the CompileSwiftSources task, which should include the file generated from the model. do { - let responseFilePath = "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/FrameworkTarget.SwiftFileList" + let responseFilePath = "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.SwiftFileList" var inputFiles = ["\(SRCROOT)/SourceOne.swift"] if visibilityBeingTested != .noCodegen { inputFiles.append("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources/CoreMLGenerated/SmartStuff/SmartStuff.swift") @@ -1094,7 +1094,7 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { // Check the CompileSwiftSources task, which should include the file generated from the model. do { - let responseFilePath = "\(srcroot)/build/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/FrameworkTarget.SwiftFileList" + let responseFilePath = "\(srcroot)/build/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.SwiftFileList" let inputFiles = ["\(srcroot)/SourceOne.swift", "\(srcroot)/build/aProject.build/Debug/\(targetName).build/DerivedSources/IntentDefinitionGenerated/Intents/XCOrderBurgerIntent.swift"] results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in task.checkCommandLineContains([swiftCompilerPath.str, "@" + responseFilePath]) @@ -1126,7 +1126,7 @@ fileprivate struct BuildToolTaskConstructionTests: CoreBasedTests { // Check the CompileC task for the file generated from the model. if case .objectiveC = codegenLanguage, shouldCodegen { results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo([.equal("CompileC"), .suffix("OrderBurgerIntent.o"), .suffix("OrderBurgerIntent.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) + task.checkRuleInfo([.equal("CompileC"), .suffix("OrderBurgerIntent.o"), .suffix("OrderBurgerIntent.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) } } diff --git a/Tests/SWBTaskConstructionTests/ClangResponseFileTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/ClangResponseFileTaskConstructionTests.swift index 896f792c..7f39a4ab 100644 --- a/Tests/SWBTaskConstructionTests/ClangResponseFileTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/ClangResponseFileTaskConstructionTests.swift @@ -168,7 +168,7 @@ fileprivate struct ClangResponseFileTaskConstructionTests: CoreBasedTests { let stringContents = contents.asString #expect(stringContents.contains("-target")) let blocksFlag = switch runDestination { - case .macOS: + case .macOSIntel: "-fasm-blocks" case .linux: "-fblocks" diff --git a/Tests/SWBTaskConstructionTests/ClangTests.swift b/Tests/SWBTaskConstructionTests/ClangTests.swift index 0d2c0bc0..1cc88430 100644 --- a/Tests/SWBTaskConstructionTests/ClangTests.swift +++ b/Tests/SWBTaskConstructionTests/ClangTests.swift @@ -388,4 +388,52 @@ fileprivate struct ClangTests: CoreBasedTests { } } } + + @Test(.requireSDKs(.host)) + func indexOptionsNotAddedIfIndexingIsDisabled() async throws { + try await withTemporaryDirectory { tmpDir in + let testProject = TestProject( + "ProjectName", + sourceRoot: tmpDir, + groupTree: TestGroup( + "SomeFiles", + children: [ + TestFile("File1.c") + ]), + targets: [ + TestStandardTarget( + "Test", + type: .dynamicLibrary, + buildConfigurations: [ + TestBuildConfiguration( + "Debug", + buildSettings: [ + "COMPILER_INDEX_STORE_ENABLE": "NO", + "INDEX_DATA_STORE_DIR": tmpDir.join("index").str, + "INDEX_STORE_COMPRESS": "YES", + "INDEX_STORE_ONLY_PROJECT_FILES": "YES", + "CLANG_INDEX_STORE_IGNORE_MACROS": "YES", + "OTHER_CFLAGS": "-DCLANG_INDEX_STORE_ENABLE=$(CLANG_INDEX_STORE_ENABLE) -DCOMPILER_INDEX_STORE_ENABLE=$(COMPILER_INDEX_STORE_ENABLE)" + ] + ), + ], + buildPhases: [ + TestSourcesBuildPhase(["File1.c"]), + ] + ) + ]) + + let core = try await getCore() + let tester = try TaskConstructionTester(core, testProject) + await tester.checkBuild(BuildParameters(configuration: "Debug", commandLineOverrides: ["INDEX_ENABLE_DATA_STORE": "YES"]), runDestination: .host) { results in + results.checkTask(.matchRuleType("CompileC")) { compileTask in + compileTask.checkCommandLineDoesNotContain("-index-store-path") + compileTask.checkCommandLineDoesNotContain("-index-store-compress") + compileTask.checkCommandLineDoesNotContain("-index-ignore-system-symbols") + compileTask.checkCommandLineDoesNotContain("-index-ignore-pcms") + compileTask.checkCommandLineDoesNotContain("-index-ignore-macros") + } + } + } + } } diff --git a/Tests/SWBTaskConstructionTests/DependencyVerificationTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/DependencyVerificationTaskConstructionTests.swift index fa9ed476..f4efda72 100644 --- a/Tests/SWBTaskConstructionTests/DependencyVerificationTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/DependencyVerificationTaskConstructionTests.swift @@ -25,8 +25,8 @@ fileprivate struct DependencyVerificationTaskConstructionTests: CoreBasedTests { let sourceBaseName = "TestSource" let source = "TestSource.m" - func outputFile(_ srcroot: Path, _ filename: String) -> String { - return "\(srcroot.str)/build/\(project).build/Debug/\(target).build/Objects-normal/x86_64/\(filename)" + func outputFile(_ srcroot: Path, _ filename: String, _ arch: String) -> String { + return "\(srcroot.str)/build/\(project).build/Debug/\(target).build/Objects-normal/\(arch)/\(filename)" } @Test(.requireSDKs(.macOS), .requireClangFeatures(.printHeadersDirectPerFile), arguments: ["MODULE", "HEADER"]) @@ -39,7 +39,7 @@ fileprivate struct DependencyVerificationTaskConstructionTests: CoreBasedTests { results.checkTask(.compileC(target, fileName: source)) { task in task.checkCommandLineContains([ "-Xclang", "-header-include-file", - "-Xclang", outputFile(srcroot, "\(sourceBaseName).o.trace.json"), + "-Xclang", outputFile(srcroot, "\(sourceBaseName).o.trace.json", results.runDestinationTargetArchitecture), "-Xclang", "-header-include-filtering=direct-per-file", "-Xclang", "-header-include-format=json", ]) diff --git a/Tests/SWBTaskConstructionTests/DriverKitTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/DriverKitTaskConstructionTests.swift index ee338491..24cf219d 100644 --- a/Tests/SWBTaskConstructionTests/DriverKitTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/DriverKitTaskConstructionTests.swift @@ -97,7 +97,7 @@ fileprivate struct DriverKitTaskConstructionTests: CoreBasedTests { results.consumeTasksMatchingRuleTypes(["CreateBuildDirectory", "CodeSign", "Gate", "Ld", "GenerateTAPI", "MkDir", "RegisterExecutionPolicyException", "ProcessInfoPlistFile", "ProcessProductPackaging", "ProcessProductPackagingDER", "SymLink", "Touch", "WriteAuxiliaryFile"]) results.checkTarget("DextTarget") { target in - results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/Objects-normal/x86_64/main.o", "\(srcRoot.str)/Sources/main.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in + results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/main.o", "\(srcRoot.str)/Sources/main.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in // Ensure that installation of iig-produced headers is treated as a requirement to begin downstream compilation. results.checkTaskFollows(task, .matchTargetName("LibraryTarget"), .matchRuleType("Iig"), .matchRulePattern([.suffix("public.iig")])) } @@ -106,19 +106,19 @@ fileprivate struct DriverKitTaskConstructionTests: CoreBasedTests { task.checkCommandLine([iigPath.str, "--def", "\(srcRoot.str)/Sources/interface.iig", "--header", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/DerivedSources/DextTarget/interface.h", "--impl", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/DerivedSources/DextTarget/interface.iig.cpp", "--deployment-target", driverkitSDK.version, "--log", Path.null.str, "--", "-isysroot", driverkitSDK.path.str, "-x", "c++", "-std=c++17", "-D__IIG=1", "-Werror=deprecated-declarations", "-I/tmp/Test/aProject/build/Debug-driverkit/include", "-F/tmp/Test/aProject/build/Debug-driverkit"]) } - results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/Objects-normal/x86_64/interface.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/DerivedSources/DextTarget/interface.iig.cpp", "normal", "x86_64", "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } + results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/interface.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/DextTarget.build/DerivedSources/DextTarget/interface.iig.cpp", "normal", results.runDestinationTargetArchitecture, "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } results.checkNoTask(.matchTarget(target)) } results.checkTarget("LibraryTarget") { target in - results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/x86_64/main.o", "\(srcRoot.str)/Sources/main.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } + results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/main.o", "\(srcRoot.str)/Sources/main.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } results.checkTask(.matchRule(["Iig", "\(srcRoot.str)/Sources/project.iig"])) { task in task.checkCommandLine([iigPath.str, "--def", "\(srcRoot.str)/Sources/project.iig", "--header", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/project.h", "--impl", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/project.iig.cpp", "--deployment-target", driverkitSDK.version, "--framework-name", "LibraryTarget", "--log", Path.null.str, "--", "-isysroot", driverkitSDK.path.str, "-x", "c++", "-std=c++17", "-D__IIG=1", "-Werror=deprecated-declarations", "-I/tmp/Test/aProject/build/Debug-driverkit/include", "-F/tmp/Test/aProject/build/Debug-driverkit"]) } - results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/x86_64/project.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/project.iig.cpp", "normal", "x86_64", "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } + results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/project.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/project.iig.cpp", "normal", results.runDestinationTargetArchitecture, "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } results.checkTask(.matchRule(["Iig", "\(srcRoot.str)/Sources/public.iig"])) { task in task.checkCommandLine([iigPath.str, "--def", "\(srcRoot.str)/Sources/public.iig", "--header", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/public.h", "--impl", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/public.iig.cpp", "--deployment-target", driverkitSDK.version, "--framework-name", "LibraryTarget", "--log", Path.null.str, "--", "-isysroot", driverkitSDK.path.str, "-x", "c++", "-std=c++17", "-D__IIG=1", "-Werror=deprecated-declarations", "-I/tmp/Test/aProject/build/Debug-driverkit/include", "-F/tmp/Test/aProject/build/Debug-driverkit"]) @@ -138,7 +138,7 @@ fileprivate struct DriverKitTaskConstructionTests: CoreBasedTests { results.checkTask(.matchRule(["CpHeader", "\(srcRoot.str)/build/Debug-driverkit/LibraryTarget.framework/Headers/public.h", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/public.h"])) { task in } } - results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/x86_64/public.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/public.iig.cpp", "normal", "x86_64", "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } + results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/public.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/public.iig.cpp", "normal", results.runDestinationTargetArchitecture, "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } results.checkTask(.matchRule(["Iig", "\(srcRoot.str)/Sources/private.iig"])) { task in task.checkCommandLine([iigPath.str, "--def", "\(srcRoot.str)/Sources/private.iig", "--header", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/private.h", "--impl", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/private.iig.cpp", "--deployment-target", driverkitSDK.version, "--framework-name", "LibraryTarget", "--log", Path.null.str, "--", "-isysroot", driverkitSDK.path.str, "-x", "c++", "-std=c++17", "-D__IIG=1", "-Werror=deprecated-declarations", "-I/tmp/Test/aProject/build/Debug-driverkit/include", "-F/tmp/Test/aProject/build/Debug-driverkit"]) @@ -158,7 +158,7 @@ fileprivate struct DriverKitTaskConstructionTests: CoreBasedTests { results.checkTask(.matchRule(["CpHeader", "\(srcRoot.str)/build/Debug-driverkit/LibraryTarget.framework/PrivateHeaders/private.h", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/private.h"])) { task in } } - results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/x86_64/private.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/private.iig.cpp", "normal", "x86_64", "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } + results.checkTask(.matchRule(["CompileC", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/private.iig.o", "\(srcRoot.str)/build/aProject.build/Debug-driverkit/LibraryTarget.build/DerivedSources/LibraryTarget/private.iig.cpp", "normal", results.runDestinationTargetArchitecture, "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } results.checkNoTask(.matchTarget(target)) } diff --git a/Tests/SWBTaskConstructionTests/EagerLinkingTests.swift b/Tests/SWBTaskConstructionTests/EagerLinkingTests.swift index ae159fe4..dbb24cd9 100644 --- a/Tests/SWBTaskConstructionTests/EagerLinkingTests.swift +++ b/Tests/SWBTaskConstructionTests/EagerLinkingTests.swift @@ -365,7 +365,7 @@ fileprivate struct EagerLinkingTests: CoreBasedTests { results.checkTask(.matchRuleType("SwiftDriver Compilation Requirements"), .matchTarget(target)) { task in task.checkCommandLineMatches([ "builtin-Swift-Compilation-Requirements", .anySequence, - "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/x86_64/Swift-API.tbd", .anySequence, + "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Swift-API.tbd", .anySequence, "-Xfrontend", "-tbd-install_name", "-Xfrontend", "/Library/Frameworks/Fwk.framework/Versions/A/Fwk", "-Xfrontend", "-tbd-current-version", "-Xfrontend", "2.0", "-Xfrontend", "-tbd-compatibility-version", "-Xfrontend", "1.0", .anySequence, @@ -383,7 +383,7 @@ fileprivate struct EagerLinkingTests: CoreBasedTests { results.checkTask(.matchRuleType("SwiftDriver Compilation Requirements"), .matchTarget(target)) { task in task.checkCommandLineMatches([ "builtin-Swift-Compilation-Requirements", .anySequence, - "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/DocumentedFwk.build/Objects-normal/x86_64/Swift-API.tbd", .anySequence, + "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/DocumentedFwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Swift-API.tbd", .anySequence, "-Xfrontend", "-tbd-install_name", "-Xfrontend", "/Library/Frameworks/DocumentedFwk.framework/Versions/A/DocumentedFwk", "-Xfrontend", "-tbd-current-version", "-Xfrontend", "2.0", "-Xfrontend", "-tbd-compatibility-version", "-Xfrontend", "1.0", .anySequence, @@ -411,7 +411,7 @@ fileprivate struct EagerLinkingTests: CoreBasedTests { task.checkCommandLineMatches(["builtin-Swift-Compilation-Requirements", "--", .anySequence]) task.checkCommandLineMatches([ "builtin-Swift-Compilation-Requirements", .anySequence, - "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/x86_64/Swift-API.tbd", .anySequence, + "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Swift-API.tbd", .anySequence, "-Xfrontend", "-tbd-install_name", "-Xfrontend", "/Library/Frameworks/Fwk.framework/Versions/A/Fwk", "-Xfrontend", "-tbd-current-version", "-Xfrontend", "2.0", "-Xfrontend", "-tbd-compatibility-version", "-Xfrontend", "1.0", .anySequence, @@ -437,7 +437,7 @@ fileprivate struct EagerLinkingTests: CoreBasedTests { task.checkCommandLineMatches(["builtin-Swift-Compilation-Requirements", "--", .anySequence]) task.checkCommandLineMatches([ "builtin-Swift-Compilation-Requirements", .anySequence, - "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/x86_64/Swift-API.tbd", .anySequence, + "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Swift-API.tbd", .anySequence, "-Xfrontend", "-tbd-install_name", "-Xfrontend", "/Library/Frameworks/Fwk.framework/Versions/A/Fwk", "-Xfrontend", "-tbd-current-version", "-Xfrontend", "2.0", "-Xfrontend", "-tbd-compatibility-version", "-Xfrontend", "1.0", .anySequence, diff --git a/Tests/SWBTaskConstructionTests/HeadermapTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/HeadermapTaskConstructionTests.swift index c52fcf9f..6e5f1d9f 100644 --- a/Tests/SWBTaskConstructionTests/HeadermapTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/HeadermapTaskConstructionTests.swift @@ -343,12 +343,12 @@ fileprivate struct HeadermapTaskConstructionTests: CoreBasedTests { headermap.checkEntry("Tool/Custom1", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/Custom1") headermap.checkEntry("Tool/Custom2", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/Custom2") headermap.checkEntry("Tool/Custom3", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/Custom3") - headermap.checkEntry("Tool/regular1.h", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/regular1.h") - headermap.checkEntry("Tool/regular1User.c", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/regular1User.c") + headermap.checkEntry("Tool/regular1.h", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/regular1.h") + headermap.checkEntry("Tool/regular1User.c", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/regular1User.c") headermap.checkEntry("Tool/some1", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/some1") headermap.checkEntry("Tool/some2", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/some2") - headermap.checkEntry("regular1.h", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/regular1.h") - headermap.checkEntry("regular1User.c", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/regular1User.c") + headermap.checkEntry("regular1.h", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/regular1.h") + headermap.checkEntry("regular1User.c", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/regular1User.c") headermap.checkEntry("some1", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/some1") headermap.checkEntry("some2", "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/DerivedSources/some2") break diff --git a/Tests/SWBTaskConstructionTests/InstallAPITaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/InstallAPITaskConstructionTests.swift index 10338052..71ba02c9 100644 --- a/Tests/SWBTaskConstructionTests/InstallAPITaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/InstallAPITaskConstructionTests.swift @@ -156,7 +156,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, @@ -209,7 +209,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, @@ -324,7 +324,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, @@ -380,7 +380,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, @@ -524,7 +524,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, // Check build products search paths @@ -583,7 +583,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, @@ -725,7 +725,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), "-dynamiclib", .anySequence, @@ -773,7 +773,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), "-dynamiclib", .anySequence, @@ -863,7 +863,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), "-dynamiclib", .anySequence, @@ -916,7 +916,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), "-dynamiclib", .anySequence, @@ -1412,7 +1412,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { // FIXME: We should check we forced WMO here, and didn't have incremental mode. task.checkCommandLineMatches([ "builtin-Swift-Compilation-Requirements", "--", .suffix("swiftc"), "-module-name", "Fwk", .anySequence, .and(.prefix("@"), .suffix("SwiftFileList")), .anySequence, - "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/x86_64/Swift-API.tbd", .anySequence, + "-emit-tbd", "-emit-tbd-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Swift-API.tbd", .anySequence, // Check we pass the TBD install name. "-Xfrontend", "-tbd-install_name", "-Xfrontend", "/Library/Frameworks/Fwk.framework/Versions/A/Fwk", // Check we pass the TBD dylib version flags @@ -1420,7 +1420,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { "-Xfrontend", "-tbd-compatibility-version", "-Xfrontend", "1.0", .anySequence, // Check we forced WMO mode. "-whole-module-optimization", .anySequence, - "-emit-objc-header", "-emit-objc-header-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/x86_64/Fwk-Swift.h" + "-emit-objc-header", "-emit-objc-header-path", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Fwk-Swift.h" ]) // We shouldn't have a '-c'. @@ -1433,7 +1433,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, @@ -1453,7 +1453,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { StringPattern.and(.prefix("-L/"), .contains(".xctoolchain/")), StringPattern.and(.prefix("-L/"), .suffix(".sdk/usr/lib/swift")), "-exclude-public-header", "/tmp/aProject.dst/Library/Frameworks/Fwk.framework/Versions/A/Headers/Fwk-Swift.h", - "-swift-installapi-interface", .suffix("x86_64/Swift-API.tbd") + "-swift-installapi-interface", .suffix("\(results.runDestinationTargetArchitecture)/Swift-API.tbd") ] ) // Check version specific options @@ -1466,7 +1466,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { // Check that we generate a copy of the compatibility header. results.checkTask(.matchRuleType("SwiftMergeGeneratedHeaders"), .matchRuleItemBasename("Fwk-Swift.h"), .matchTarget(target)) { task in - task.checkCommandLine(["builtin-swiftHeaderTool", "-arch", "x86_64", "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/x86_64/Fwk-Swift.h", "-o", "/tmp/aProject.dst/Library/Frameworks/Fwk.framework/Versions/A/Headers/Fwk-Swift.h"]) + task.checkCommandLine(["builtin-swiftHeaderTool", "-arch", results.runDestinationTargetArchitecture, "/TEST/build/aProject.build/Debug/Fwk.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Fwk-Swift.h", "-o", "/tmp/aProject.dst/Library/Frameworks/Fwk.framework/Versions/A/Headers/Fwk-Swift.h"]) } } @@ -2220,7 +2220,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, // Check build products search paths @@ -2269,7 +2269,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, @@ -2431,7 +2431,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, "-rpath", "@executable_path/../Frameworks", .anySequence, @@ -2477,7 +2477,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { StringPattern.equal(tapiToolPath.str), "installapi", .anySequence, "-verify-against", "/tmp/aProject.dst/Library/Frameworks/Fwk.framework/Versions/A/Fwk", .anySequence, "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, // Check RPaths. @@ -2558,7 +2558,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { task.checkCommandLineMatches([ StringPattern.equal(tapiToolPath.str), "installapi", "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, "-rpath", "@executable_path/../Frameworks", .anySequence, @@ -2600,7 +2600,7 @@ fileprivate struct InstallAPITaskConstructionTests: CoreBasedTests { StringPattern.equal(tapiToolPath.str), "installapi", .anySequence, "-verify-against", "/tmp/aProject.dst/Library/Frameworks/Fwk.framework/Versions/A/Fwk", .anySequence, "--verify-mode=ErrorsOnly", .anySequence, - "-target", StringPattern.prefix("x86_64-apple"), + "-target", StringPattern.prefix("\(results.runDestinationTargetArchitecture)-apple"), .anySequence, // Check RPaths. diff --git a/Tests/SWBTaskConstructionTests/IntermediateStubTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/IntermediateStubTaskConstructionTests.swift index d4010c7d..5cea5930 100644 --- a/Tests/SWBTaskConstructionTests/IntermediateStubTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/IntermediateStubTaskConstructionTests.swift @@ -90,7 +90,7 @@ fileprivate struct IntermediateStubTaskConstructionTests: CoreBasedTests { ]) let tester = try await TaskConstructionTester(getCore(), testProject) await tester.checkBuild(BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOS) { results in - results.checkTask(.matchRule(["GenerateTAPI", "/tmp/Test/aProject/build/Debug/Fwk.framework/Versions/A/Fwk.tbd", "normal", "x86_64"])) { _ in } + results.checkTask(.matchRule(["GenerateTAPI", "/tmp/Test/aProject/build/Debug/Fwk.framework/Versions/A/Fwk.tbd", "normal", results.runDestinationTargetArchitecture])) { _ in } results.checkNoTask(.matchRuleType("GenerateTAPI")) } } diff --git a/Tests/SWBTaskConstructionTests/LibtoolTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/LibtoolTaskConstructionTests.swift index e2fb0236..b6242179 100644 --- a/Tests/SWBTaskConstructionTests/LibtoolTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/LibtoolTaskConstructionTests.swift @@ -66,14 +66,14 @@ fileprivate struct LibtoolTaskConstructionTests: CoreBasedTests { results.checkTarget("Deterministic") { target in results.checkTask(.matchTarget(target), .matchRuleType("Libtool")) { task in task.checkRuleInfo(["Libtool", "\(SRCROOT)/build/Debug/libDeterministic.a", "normal"]) - task.checkCommandLine([libtoolPath.str, "-static", "-arch_only", "x86_64", "-D", "-syslibroot", core.loadSDK(.macOS).path.str, "-L\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/Deterministic.build/Objects-normal/x86_64/Deterministic.LinkFileList", "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/Deterministic.build/Objects-normal/x86_64/Deterministic_libtool_dependency_info.dat", "-o", "\(SRCROOT)/build/Debug/libDeterministic.a"]) + task.checkCommandLine([libtoolPath.str, "-static", "-arch_only", results.runDestinationTargetArchitecture, "-D", "-syslibroot", core.loadSDK(.macOS).path.str, "-L\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/Deterministic.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Deterministic.LinkFileList", "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/Deterministic.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Deterministic_libtool_dependency_info.dat", "-o", "\(SRCROOT)/build/Debug/libDeterministic.a"]) } } results.checkTarget("Nondeterministic") { target in results.checkTask(.matchTarget(target), .matchRuleType("Libtool")) { task in task.checkRuleInfo(["Libtool", "\(SRCROOT)/build/Debug/libNondeterministic.a", "normal"]) - task.checkCommandLine([libtoolPath.str, "-static", "-arch_only", "x86_64", "-syslibroot", core.loadSDK(.macOS).path.str, "-L\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/Nondeterministic.build/Objects-normal/x86_64/Nondeterministic.LinkFileList", "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/Nondeterministic.build/Objects-normal/x86_64/Nondeterministic_libtool_dependency_info.dat", "-o", "\(SRCROOT)/build/Debug/libNondeterministic.a"]) + task.checkCommandLine([libtoolPath.str, "-static", "-arch_only", results.runDestinationTargetArchitecture, "-syslibroot", core.loadSDK(.macOS).path.str, "-L\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/Nondeterministic.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Nondeterministic.LinkFileList", "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/Nondeterministic.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Nondeterministic_libtool_dependency_info.dat", "-o", "\(SRCROOT)/build/Debug/libNondeterministic.a"]) } } diff --git a/Tests/SWBTaskConstructionTests/MetalTests.swift b/Tests/SWBTaskConstructionTests/MetalTests.swift index 5d22e07b..7e502a5e 100644 --- a/Tests/SWBTaskConstructionTests/MetalTests.swift +++ b/Tests/SWBTaskConstructionTests/MetalTests.swift @@ -72,4 +72,50 @@ fileprivate struct MetalTests: CoreBasedTests { } } } + + @Test(.requireSDKs(.macOS), .skipInGitHubActions("Metal toolchain is not installed on GitHub runners")) + func indexOptionsNotAddedIfIndexingIsDisabled() async throws { + try await withTemporaryDirectory { tmpDir in + let testProject = TestProject( + "ProjectName", + sourceRoot: tmpDir, + groupTree: TestGroup( + "SomeFiles", + children: [ + TestFile("File1.metal") + ]), + targets: [ + TestStandardTarget( + "Test", + type: .staticLibrary, + buildConfigurations: [ + TestBuildConfiguration( + "Debug", + buildSettings: [ + "COMPILER_INDEX_STORE_ENABLE": "NO", + "INDEX_DATA_STORE_DIR": tmpDir.join("index").str, + "INDEX_STORE_COMPRESS": "YES", + "INDEX_STORE_ONLY_PROJECT_FILES": "YES", + "CLANG_INDEX_STORE_IGNORE_MACROS": "YES", + ] + ), + ], + buildPhases: [ + TestSourcesBuildPhase(["File1.metal"]), + ] + ) + ]) + + let core = try await getCore() + let tester = try TaskConstructionTester(core, testProject) + await tester.checkBuild(BuildParameters(configuration: "Debug", commandLineOverrides: ["INDEX_ENABLE_DATA_STORE": "YES"]), runDestination: .macOS) { results in + results.checkTask(.matchRuleType("CompileMetalFile")) { compileTask in + compileTask.checkCommandLineDoesNotContain("-index-store-path") + compileTask.checkCommandLineDoesNotContain("-index-store-compress") + compileTask.checkCommandLineDoesNotContain("-index-ignore-system-symbols") + compileTask.checkCommandLineDoesNotContain("-index-ignore-pcms") + } + } + } + } } diff --git a/Tests/SWBTaskConstructionTests/ModuleVerifierTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/ModuleVerifierTaskConstructionTests.swift index 41504f17..528c1ec0 100644 --- a/Tests/SWBTaskConstructionTests/ModuleVerifierTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/ModuleVerifierTaskConstructionTests.swift @@ -1249,7 +1249,7 @@ extension ClangModuleVerifierTaskConstructionTestsProtocol { if verifierKind == "external" { AAAVerifierTask.checkRuleInfo([verifierRuleName, "\(SRCROOT)/build/Debug/AAA.framework"]) } else { - AAAVerifierTask.checkRuleInfo([verifierRuleName, "\(SRCROOT)/build/Debug/AAA.framework", "", "", "x86_64", "objective-c", "gnu17", "", "com.apple.compilers.llvm.clang.1_0.verify_module"]) + AAAVerifierTask.checkRuleInfo([verifierRuleName, "\(SRCROOT)/build/Debug/AAA.framework", "", "", results.runDestinationTargetArchitecture, "objective-c", "gnu17", "", "com.apple.compilers.llvm.clang.1_0.verify_module"]) } // Make sure AAA VerifyModule runs *after* we produce a module map, headers and copy them over. @@ -1270,7 +1270,7 @@ extension ClangModuleVerifierTaskConstructionTestsProtocol { if verifierKind == "external" { BBBVerifierTask.checkRuleInfo([verifierRuleName, "\(SRCROOT)/build/Debug/BBB.framework"]) } else { - BBBVerifierTask.checkRuleInfo([verifierRuleName, "\(SRCROOT)/build/Debug/BBB.framework", "", "", "x86_64", "objective-c", "gnu17", "", "com.apple.compilers.llvm.clang.1_0.verify_module"]) + BBBVerifierTask.checkRuleInfo([verifierRuleName, "\(SRCROOT)/build/Debug/BBB.framework", "", "", results.runDestinationTargetArchitecture, "objective-c", "gnu17", "", "com.apple.compilers.llvm.clang.1_0.verify_module"]) } // Make sure BBB VerifyModule runs *after* we produce a module map, headers and copy them over. @@ -1783,7 +1783,7 @@ extension ClangModuleVerifierTaskConstructionTestsProtocol { results.checkTarget("SwiftOnly") { target in results.checkTask(.matchTarget(target), .matchRuleType(verifierInputRuleName)) { task in // Make sure VerifyModule runs after the relevant SwiftMergeGeneratedHeaders task. - results.checkTaskFollows(task, .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/Debug/SwiftOnly.framework/Versions/A/Headers/SwiftOnly-Swift.h", "\(SRCROOT)/build/Project.build/Debug/SwiftOnly.build/Objects-normal/x86_64/SwiftOnly-Swift.h"])) + results.checkTaskFollows(task, .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/Debug/SwiftOnly.framework/Versions/A/Headers/SwiftOnly-Swift.h", "\(SRCROOT)/build/Project.build/Debug/SwiftOnly.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SwiftOnly-Swift.h"])) results.checkTaskDoesNotFollow(task, .matchRuleType("SwiftDriver Compilation")) // Make sure VerifyModule has all of the relevant SwiftMergeGeneratedHeaders outputs @@ -1902,10 +1902,10 @@ extension ClangModuleVerifierTaskConstructionTestsProtocol { results.checkTaskDoesNotFollow(task, .matchRule(["Copy", "\(SRCROOT)/build/Debug/Framework.framework/Versions/A/PrivateHeaders/PrivateSource.iig", "\(SRCROOT)/PrivateSource.iig"])) results.checkTaskDoesNotFollow(task, .matchRule(["Iig", "\(SRCROOT)/ProjectSource.iig"])) results.checkTaskDoesNotFollow(task, .matchRule(["IntentDefinitionCodegen", "\(SRCROOT)/Base.lproj/ProjectIntents.intentdefinition"])) - results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/x86_64/PublicSource.iig.o", "\(SRCROOT)/build/Project.build/Debug/Framework.build/DerivedSources/Framework/PublicSource.iig.cpp", "normal", "x86_64", "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) - results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/x86_64/PrivateSource.iig.o", "\(SRCROOT)/build/Project.build/Debug/Framework.build/DerivedSources/Framework/PrivateSource.iig.cpp", "normal", "x86_64", "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) - results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/x86_64/ProjectSource.iig.o", "\(SRCROOT)/build/Project.build/Debug/Framework.build/DerivedSources/Framework/ProjectSource.iig.cpp", "normal", "x86_64", "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) - results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/x86_64/Framework.o", "\(SRCROOT)/Framework.m", "normal", "x86_64", "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"])) + results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/\(results.runDestinationTargetArchitecture)/PublicSource.iig.o", "\(SRCROOT)/build/Project.build/Debug/Framework.build/DerivedSources/Framework/PublicSource.iig.cpp", "normal", results.runDestinationTargetArchitecture, "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) + results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/\(results.runDestinationTargetArchitecture)/PrivateSource.iig.o", "\(SRCROOT)/build/Project.build/Debug/Framework.build/DerivedSources/Framework/PrivateSource.iig.cpp", "normal", results.runDestinationTargetArchitecture, "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) + results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/\(results.runDestinationTargetArchitecture)/ProjectSource.iig.o", "\(SRCROOT)/build/Project.build/Debug/Framework.build/DerivedSources/Framework/ProjectSource.iig.cpp", "normal", results.runDestinationTargetArchitecture, "c++", "com.apple.compilers.llvm.clang.1_0.compiler"])) + results.checkTaskDoesNotFollow(task, .matchRule(["CompileC", "\(SRCROOT)/build/Project.build/Debug/Framework.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Framework.o", "\(SRCROOT)/Framework.m", "normal", results.runDestinationTargetArchitecture, "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"])) // Make sure VerifyModule has all of the relevant Iig and Intents outputs as inputs // so that it will run again if any of them change. diff --git a/Tests/SWBTaskConstructionTests/PackageProductConstructionTests.swift b/Tests/SWBTaskConstructionTests/PackageProductConstructionTests.swift index 607a280b..8675767d 100644 --- a/Tests/SWBTaskConstructionTests/PackageProductConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/PackageProductConstructionTests.swift @@ -158,7 +158,7 @@ fileprivate struct PackageProductConstructionTests: CoreBasedTests { #expect(task.commandLine.contains(["-lBEGIN", "/tmp/aWorkspace/Package/build/Release/libA.a", "/tmp/aWorkspace/Package/build/Release/libB.a", "/tmp/aWorkspace/Package/build/Release/libC.a", "/tmp/aWorkspace/Package/build/Release/libC_Impl.a", "-lEND"]), "unexpected linker command line: \(task.commandLineAsStrings.quotedDescription)") } results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile"), .matchRuleItemBasename("Tool.LinkFileList")) { task, contents in - #expect(contents == "/tmp/aWorkspace/aProject/build/aProject.build/Release/Tool.build/Objects-normal/x86_64/main.o\n/tmp/aWorkspace/Package/build/Release/E.o\n/tmp/aWorkspace/Package/build/Release/F.o\n") + #expect(contents == "/tmp/aWorkspace/aProject/build/aProject.build/Release/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/main.o\n/tmp/aWorkspace/Package/build/Release/E.o\n/tmp/aWorkspace/Package/build/Release/F.o\n") } } } @@ -254,9 +254,9 @@ fileprivate struct PackageProductConstructionTests: CoreBasedTests { results.checkNoDiagnostics() results.checkTarget("DynamicJSON") { target in results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in - task.checkCommandLineContains(["-o", "/tmp/aWorkspace/aProject/build/Debug/DynamicJSON.dylib", "/tmp/aWorkspace/Package/build/Package.build/Debug/SwiftyJSON.build/Objects-normal/x86_64/SwiftyJSON.swiftmodule"]) + task.checkCommandLineContains(["-o", "/tmp/aWorkspace/aProject/build/Debug/DynamicJSON.dylib", "/tmp/aWorkspace/Package/build/Package.build/Debug/SwiftyJSON.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SwiftyJSON.swiftmodule"]) - task.checkCommandLineNoMatch([.any, "-Xlinker", "-add_ast_path", "-Xlinker", "/tmp/aWorkspace/aProject/build/aProject.build/Debug/DynamicJSON.build/Objects-normal/x86_64/DynamicJSON.swiftmodule", .any]) + task.checkCommandLineNoMatch([.any, "-Xlinker", "-add_ast_path", "-Xlinker", "/tmp/aWorkspace/aProject/build/aProject.build/Debug/DynamicJSON.build/Objects-normal/\(results.runDestinationTargetArchitecture)/DynamicJSON.swiftmodule", .any]) } results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile"), .matchRuleItemBasename("DynamicJSON.LinkFileList")) { task, contents in diff --git a/Tests/SWBTaskConstructionTests/PlatformTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/PlatformTaskConstructionTests.swift index 31022b1a..317fe9f9 100644 --- a/Tests/SWBTaskConstructionTests/PlatformTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/PlatformTaskConstructionTests.swift @@ -271,8 +271,8 @@ fileprivate struct PlatformTaskConstructionTests: CoreBasedTests { results.checkTarget("AppTarget") { target in results.checkTask(.matchTarget(target), .matchRuleType("CompileC"), .matchRuleItemBasename("main.m"), .matchRuleItem("x86_64")) { task in - task.checkRuleInfo([.equal("CompileC"), .suffix("main.o"), .suffix("main.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) - task.checkCommandLineLastArgumentEqual("\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AppTarget.build/Objects-normal/x86_64/main.o") + task.checkRuleInfo([.equal("CompileC"), .suffix("main.o"), .suffix("main.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) + task.checkCommandLineLastArgumentEqual("\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/main.o") } func checkLdEntitlements(_ task: any PlannedTask) { @@ -899,7 +899,7 @@ fileprivate struct PlatformTaskConstructionTests: CoreBasedTests { "-iframework", "/Library/Frameworks", "-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/Frameworks", "-c", "\(SRCROOT)/Sources/ClassOne.m", - "-o", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/ClassOne.o", + "-o", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/ClassOne.o", ] task.checkCommandLineContains(expectedClangOptions) } diff --git a/Tests/SWBTaskConstructionTests/PostprocessingTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/PostprocessingTaskConstructionTests.swift index 85fd06e1..60684f5f 100644 --- a/Tests/SWBTaskConstructionTests/PostprocessingTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/PostprocessingTaskConstructionTests.swift @@ -65,8 +65,12 @@ fileprivate struct PostprocessingTaskConstructionTests: CoreBasedTests { let tester = try await TaskConstructionTester(getCore(), testProject) + let fs = PseudoFS() + try fs.createDirectory(.root.join("usr").join("sbin"), recursive: true) + try fs.write(.root.join("usr").join("sbin").join("chown"), contents: "") + let installParameters = BuildParameters(action: .install, configuration: "Debug") - await tester.checkBuild(installParameters, runDestination: .macOS) { results in + await tester.checkBuild(installParameters, runDestination: .macOS, processEnvironment: ["PATH": "/usr/bin:/usr/sbin"], fs: fs) { results in results.checkNoDiagnostics() results.checkTarget("Library") { target in diff --git a/Tests/SWBTaskConstructionTests/PrelinkedObjectFileTests.swift b/Tests/SWBTaskConstructionTests/PrelinkedObjectFileTests.swift index 45ee228d..82dfc726 100644 --- a/Tests/SWBTaskConstructionTests/PrelinkedObjectFileTests.swift +++ b/Tests/SWBTaskConstructionTests/PrelinkedObjectFileTests.swift @@ -73,10 +73,10 @@ fileprivate struct PrelinkedObjectFileTests: CoreBasedTests { results.checkTarget("AllLibraries") { target in // There should be tasks to create the prelinked object file and then the static library. results.checkTask(.matchTarget(target), .matchRuleType("PrelinkedObjectLink")) { task in - task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", "x86_64", "-platform_version", "1", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), "-exported_symbols_list", "Exports.exp", "-lWarningLibrary", "-lSomeLibrary", "-lAnotherLibrary", "-o", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/libAllLibraries.a-x86_64-prelink.o")]) + task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", .equal(results.runDestinationTargetArchitecture), "-platform_version", "1", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), "-exported_symbols_list", "Exports.exp", "-lWarningLibrary", "-lSomeLibrary", "-lAnotherLibrary", "-o", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/libAllLibraries.a-\(results.runDestinationTargetArchitecture)-prelink.o")]) } results.checkTask(.matchTarget(target), .matchRuleType("Libtool")) { task in - task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", "x86_64", "-D", "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("-L\(SRCROOT)/build/Debug"), "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/x86_64/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/x86_64/AllLibraries_libtool_dependency_info.dat", "-o", .equal("\(SRCROOT)/build/Debug/libAllLibraries.a")]) + task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", .equal(results.runDestinationTargetArchitecture), "-D", "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("-L\(SRCROOT)/build/Debug"), "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries_libtool_dependency_info.dat", "-o", .equal("\(SRCROOT)/build/Debug/libAllLibraries.a")]) } } @@ -102,10 +102,10 @@ fileprivate struct PrelinkedObjectFileTests: CoreBasedTests { results.checkTarget("AllLibraries") { target in // There should be tasks to create the prelinked object file and then the static library. results.checkTask(.matchTarget(target), .matchRuleType("PrelinkedObjectLink")) { task in - task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", "x86_64", "-platform_version", "1", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), "-exported_symbols_list", "Exports.exp", "-lWarningLibrary", "-lSomeLibrary", "-lAnotherLibrary", "-o", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/libAllLibraries.a-x86_64-prelink.o")]) + task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", .equal(results.runDestinationTargetArchitecture), "-platform_version", "1", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), "-exported_symbols_list", "Exports.exp", "-lWarningLibrary", "-lSomeLibrary", "-lAnotherLibrary", "-o", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/libAllLibraries.a-\(results.runDestinationTargetArchitecture)-prelink.o")]) } results.checkTask(.matchTarget(target), .matchRuleType("Libtool")) { task in - task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", "x86_64", "-D", "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("-L\(SRCROOT)/build/Debug/BuiltProducts"), "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/x86_64/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/x86_64/AllLibraries_libtool_dependency_info.dat", "-o", "/tmp/aProject.dst/usr/local/lib/libAllLibraries.a"]) + task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", .equal(results.runDestinationTargetArchitecture), "-D", "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("-L\(SRCROOT)/build/Debug/BuiltProducts"), "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries_libtool_dependency_info.dat", "-o", "/tmp/aProject.dst/usr/local/lib/libAllLibraries.a"]) } // There should be a task to create the symlink in the built products dir to the product in the DSTROOT, and to copy the product from the DSTROOT to the SYMROOT. @@ -203,10 +203,10 @@ fileprivate struct PrelinkedObjectFileTests: CoreBasedTests { results.checkTarget("AllLibraries") { target in // There should be tasks to create the prelinked object file and then the static library. results.checkTask(.matchTarget(target), .matchRuleType("PrelinkedObjectLink")) { task in - task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", "x86_64", "-platform_version", "6", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), "-o", .equal("\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AllLibraries.build/Objects-normal/libAllLibraries.a-x86_64-prelink.o")]) + task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", .equal(results.runDestinationTargetArchitecture), "-platform_version", "6", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), "-o", .equal("\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AllLibraries.build/Objects-normal/libAllLibraries.a-x86_64-prelink.o")]) } results.checkTask(.matchTarget(target), .matchRuleType("Libtool")) { task in - task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", "x86_64", "-D", "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("-L\(SRCROOT)/build/Debug-maccatalyst"), "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AllLibraries.build/Objects-normal/x86_64/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AllLibraries.build/Objects-normal/x86_64/AllLibraries_libtool_dependency_info.dat", "-o", .equal("\(SRCROOT)/build/Debug-maccatalyst/libAllLibraries.a")]) + task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", .equal(results.runDestinationTargetArchitecture), "-D", "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("-L\(SRCROOT)/build/Debug-maccatalyst"), "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries_libtool_dependency_info.dat", "-o", .equal("\(SRCROOT)/build/Debug-maccatalyst/libAllLibraries.a")]) } } @@ -340,10 +340,10 @@ fileprivate struct PrelinkedObjectFileTests: CoreBasedTests { results.checkTarget("AllLibraries") { target in // There should be tasks to create the prelinked object file and then the static library. results.checkTask(.matchTarget(target), .matchRuleType("PrelinkedObjectLink")) { task in - task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", "x86_64", "-platform_version", "7", .any, .any, "-syslibroot", .equal(results.runDestinationSDK.path.str), "-o", .equal("\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AllLibraries.build/Objects-normal/libAllLibraries.a-x86_64-prelink.o")]) + task.checkCommandLineMatches([.suffix("ld"), "-r", "-arch", .equal(results.runDestinationTargetArchitecture), "-platform_version", "7", .any, .any, "-syslibroot", .equal(results.runDestinationSDK.path.str), "-o", .equal("\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AllLibraries.build/Objects-normal/libAllLibraries.a-x86_64-prelink.o")]) } results.checkTask(.matchTarget(target), .matchRuleType("Libtool")) { task in - task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", "x86_64", "-D", "-syslibroot", .equal(results.runDestinationSDK.path.str), .equal("-L\(SRCROOT)/build/Debug-iphonesimulator"), "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AllLibraries.build/Objects-normal/x86_64/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AllLibraries.build/Objects-normal/x86_64/AllLibraries_libtool_dependency_info.dat", "-o", .equal("\(SRCROOT)/build/Debug-iphonesimulator/libAllLibraries.a")]) + task.checkCommandLineMatches([.suffix("libtool"), "-static", "-arch_only", .equal(results.runDestinationTargetArchitecture), "-D", "-syslibroot", .equal(results.runDestinationSDK.path.str), .equal("-L\(SRCROOT)/build/Debug-iphonesimulator"), "-filelist", .equal("\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries.LinkFileList"), "-dependency_info", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/AllLibraries.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AllLibraries_libtool_dependency_info.dat", "-o", .equal("\(SRCROOT)/build/Debug-iphonesimulator/libAllLibraries.a")]) } } diff --git a/Tests/SWBTaskConstructionTests/PreviewsTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/PreviewsTaskConstructionTests.swift index 2092b03f..8f91814d 100644 --- a/Tests/SWBTaskConstructionTests/PreviewsTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/PreviewsTaskConstructionTests.swift @@ -1003,7 +1003,7 @@ fileprivate struct PreviewsTaskConstructionTests: CoreBasedTests { results.consumeTasksMatchingRuleTypes(["Copy", "CopySwiftLibs", "ExtractAppIntentsMetadata", "Gate", "GenerateDSYMFile", "MkDir", "CreateBuildDirectory", "WriteAuxiliaryFile", "ClangStatCache", "RegisterExecutionPolicyException", "AppIntentsSSUTraining", "ProcessInfoPlistFile", "Touch", "Validate", "LinkAssetCatalogSignature", "CodeSign", "ProcessProductPackaging", "ProcessProductPackagingDER", "ConstructStubExecutorLinkFileList"]) results.checkTask(.matchRule(["Ld", "\(srcRoot.str)/build/Debug-iphonesimulator/Tool", "normal"])) { task in - task.checkCommandLineContainsUninterrupted(["-sectcreate", "__TEXT", "__info_plist", "\(srcRoot.str)/build/ProjectName.build/Debug-iphonesimulator/Tool.build/Objects-normal/x86_64/Processed-Info.plist"]) + task.checkCommandLineContainsUninterrupted(["-sectcreate", "__TEXT", "__info_plist", "\(srcRoot.str)/build/ProjectName.build/Debug-iphonesimulator/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Processed-Info.plist"]) } results.checkTask(.matchRule(["Ld", "\(srcRoot.str)/build/Debug-iphonesimulator/Tool.debug.dylib", "normal"])) { task in diff --git a/Tests/SWBTaskConstructionTests/ResourceTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/ResourceTaskConstructionTests.swift index 2dac3859..48e8e1de 100644 --- a/Tests/SWBTaskConstructionTests/ResourceTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/ResourceTaskConstructionTests.swift @@ -83,7 +83,7 @@ fileprivate struct ResourcesTaskConstructionTests: CoreBasedTests { results.checkTarget("App") { target -> Void in // Processing Bar.r results.checkTask(.matchRule(["Rez", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/Bar.rsrc", "\(SRCROOT)/Bar.r"])) { task in - task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/Bar.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", "x86_64", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/Bar.r"]) + task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/Bar.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", results.runDestinationTargetArchitecture, "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/Bar.r"]) task.checkInputs([ .path("\(SRCROOT)/Bar.r"), .path("\(SRCROOT)/RezPrefixFile.r"), @@ -95,7 +95,7 @@ fileprivate struct ResourcesTaskConstructionTests: CoreBasedTests { // Processing Foo.r results.checkTask(.matchRule(["Rez", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/Foo.rsrc", "\(SRCROOT)/Foo.r"])) { task in - task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/Foo.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", "x86_64", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/Foo.r"]) + task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/Foo.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", results.runDestinationTargetArchitecture, "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/Foo.r"]) task.checkInputs([ .path("\(SRCROOT)/Foo.r"), .path("\(SRCROOT)/RezPrefixFile.r"), @@ -107,7 +107,7 @@ fileprivate struct ResourcesTaskConstructionTests: CoreBasedTests { // Processing Baz.r (de) results.checkTask(.matchRule(["Rez", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/de.lproj/Baz.rsrc", "\(SRCROOT)/de.lproj/Baz.r"])) { task in - task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/de.lproj/Baz.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", "x86_64", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/de.lproj/Baz.r"]) + task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/de.lproj/Baz.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", results.runDestinationTargetArchitecture, "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/de.lproj/Baz.r"]) task.checkInputs([ .path("\(SRCROOT)/de.lproj/Baz.r"), .path("\(SRCROOT)/RezPrefixFile.r"), @@ -120,7 +120,7 @@ fileprivate struct ResourcesTaskConstructionTests: CoreBasedTests { // Processing Baz.r (en) results.checkTask(.matchRule(["Rez", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/en.lproj/Baz.rsrc", "\(SRCROOT)/en.lproj/Baz.r"])) { task in - task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/en.lproj/Baz.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", "x86_64", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/en.lproj/Baz.r"]) + task.checkCommandLine([rezPath.str, "-o", "\(SRCROOT)/build/aProject.build/\(configuration)/App.build/ResourceManagerResources/Objects/en.lproj/Baz.rsrc", "-d", "SystemSevenOrLater=1", "-useDF", "-script", "Roman", "other_rez_flags", "-arch", results.runDestinationTargetArchitecture, "-i", "\(SRCROOT)/build/\(configuration)", "-i", "rez_search_paths", "-i", "\(SRCROOT)/build/\(configuration)", "-i", "framework_search_paths", "-F", "system_framework_search_paths1", "-F", "system_framework_search_paths2", "-i", "\(SRCROOT)/build/\(configuration)/include", "-i", "header_search_paths", "-i", "system_header_search_paths1", "-i", "system_header_search_paths1", "\(SRCROOT)/RezPrefixFile.r", "-isysroot", core.loadSDK(.macOS).path.str, "\(SRCROOT)/en.lproj/Baz.r"]) task.checkInputs([ .path("\(SRCROOT)/en.lproj/Baz.r"), .path("\(SRCROOT)/RezPrefixFile.r"), diff --git a/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift index 5ed36621..7b43ae69 100644 --- a/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/SwiftTaskConstructionTests.swift @@ -212,7 +212,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { // There should be one RuleScriptExecution task. results.checkTask(.matchTarget(target), .matchRuleType("RuleScriptExecution")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/baz.swift", "\(SRCROOT)/baz.fake-swift", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/baz.swift", "\(SRCROOT)/baz.fake-swift", "normal", results.runDestinationTargetArchitecture]) task.checkCommandLine(["/bin/sh", "-c", "echo \"make some swift stuff\""]) task.checkInputs([ .path("\(SRCROOT)/baz.fake-swift"), @@ -226,20 +226,20 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { } results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", target.target.name, "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", target.target.name, "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) if LibSwiftDriver.supportsDriverFlag(spelled: "-Isystem") && swiftFeatures.has(.Isystem) { - task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-Isystem", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-Swift.h", "-working-directory", SRCROOT]) + task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-Isystem", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-Swift.h", "-working-directory", SRCROOT]) } else { - task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-I", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-Swift.h", "-working-directory", SRCROOT]) + task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-I", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-Swift.h", "-working-directory", SRCROOT]) } task.checkInputs([ .path("\(SRCROOT)/main.swift"), .path("\(SRCROOT)/foo.swift"), .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/baz.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_const_extract_protocols.json"), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), @@ -252,31 +252,31 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget Swift Compilation Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/main.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/foo.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/baz.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/main.swiftconstvalues"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/foo.swiftconstvalues"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/baz.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget Swift Compilation Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/main.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/foo.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/baz.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/main.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/foo.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/baz.swiftconstvalues"), ]) } results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in - task.checkRuleInfo(["SwiftDriver Compilation Requirements", target.target.name, "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation Requirements", target.target.name, "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) if LibSwiftDriver.supportsDriverFlag(spelled: "-Isystem") && swiftFeatures.has(.Isystem) { - task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-Isystem", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-Swift.h", "-working-directory", SRCROOT]) + task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-Isystem", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-Swift.h", "-working-directory", SRCROOT]) } else { - task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-I", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-Swift.h", "-working-directory", SRCROOT]) + task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", "AppTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-I", "/tmp/include", "-I", "/tmp/system/include", "-F", "\(SRCROOT)/build/Debug", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/AppTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-Swift.h", "-working-directory", SRCROOT]) } task.checkInputs([ .path("\(SRCROOT)/main.swift"), .path("\(SRCROOT)/foo.swift"), .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/baz.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_const_extract_protocols.json"), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), @@ -288,25 +288,25 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget Swift Compilation Requirements Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-linker-args.resp"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftsourceinfo"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.abi.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftinterface"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.private.swiftinterface"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-Swift.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftdoc") + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget Swift Compilation Requirements Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-linker-args.resp"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftsourceinfo"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.abi.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftinterface"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.private.swiftinterface"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-Swift.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftdoc") ]) } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json"])) { task, contents in // Check the inputs and outputs. task.checkInputs([ .namePattern(.and(.prefix("target-"), .suffix("-immediate")))]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-OutputFileMap.json")]) + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-OutputFileMap.json")]) // Check the contents. guard let plist = try? PropertyList.fromJSONData(contents) else { @@ -323,11 +323,11 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { // Check the global dictionary. if let globalDict = dict[""] { XCTAssertEqualPropertyListItems(globalDict, .plDict([ - "swift-dependencies": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-primary.swiftdeps"), - "diagnostics": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-primary.dia"), - "emit-module-diagnostics": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-primary-emit-module.dia"), - "emit-module-dependencies": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-primary-emit-module.d"), - "pch": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-primary-Bridging-header.pch"), + "swift-dependencies": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-primary.swiftdeps"), + "diagnostics": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-primary.dia"), + "emit-module-diagnostics": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-primary-emit-module.dia"), + "emit-module-dependencies": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-primary-emit-module.d"), + "pch": .plString("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-primary-Bridging-header.pch"), ])) } else { @@ -342,15 +342,15 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { ] { let filename = Path(filepath).basenameWithoutSuffix if let fileDict = dict[filepath]?.dictValue { - #expect(fileDict["object"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename).o") - #expect(fileDict["diagnostics"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename).dia") - #expect(fileDict["dependencies"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename).d") - #expect(fileDict["swift-dependencies"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename).swiftdeps") - #expect(fileDict["swiftmodule"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename)~partial.swiftmodule") - #expect(fileDict["llvm-bc"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename).bc") - #expect(fileDict["const-values"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename).swiftconstvalues") + #expect(fileDict["object"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename).o") + #expect(fileDict["diagnostics"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename).dia") + #expect(fileDict["dependencies"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename).d") + #expect(fileDict["swift-dependencies"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename).swiftdeps") + #expect(fileDict["swiftmodule"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename)~partial.swiftmodule") + #expect(fileDict["llvm-bc"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename).bc") + #expect(fileDict["const-values"]?.stringValue == "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename).swiftconstvalues") if swiftFeatures.has(.indexUnitOutputPathWithoutWarning) { - #expect(fileDict["index-unit-output-path"]?.stringValue == "/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/\(filename).o") + #expect(fileDict["index-unit-output-path"]?.stringValue == "/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(filename).o") #expect(fileDict.count == 8) } else { #expect(fileDict.count == 6) @@ -362,7 +362,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { } } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList"])) { task, contents in let inputFiles = ["\(SRCROOT)/main.swift", "\(SRCROOT)/foo.swift", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/baz.swift"] let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == inputFiles + [""]) @@ -370,46 +370,46 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { // There should be one 'CompileC' task (of the _vers file). results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_vers.o", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/AppTarget_vers.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"]) + task.checkRuleInfo(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_vers.o", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/AppTarget_vers.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"]) } // There should be a 'Copy' of the generated header. - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/AppTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/AppTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-Swift.h"])) { _ in } // There should be a 'Copy' of the module file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.abi.json"])) { _ in } // There should be a 'Copy' of the doc file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftdoc"])) { _ in } // There should be a 'Copy' of the sourceinfo file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftsourceinfo"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftsourceinfo"])) { _ in } // There should be a 'Copy' of the swiftinterface file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/x86_64-apple-macos.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftinterface"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftinterface"])) { _ in } // There should be a 'Copy' of the private swiftinterface file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/x86_64-apple-macos.private.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.private.swiftinterface"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/AppTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.private.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.private.swiftinterface"])) { _ in } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget", "normal"]) let toolchain = toolchainIdentifier != "default" ? "OSX10.15" : "XcodeDefault" task.checkCommandLine(([ - ["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList"], + ["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList"], shouldEmitSwiftRPath ? ["-Xlinker", "-rpath", "-Xlinker", "/usr/lib/swift"] : [], - ["-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/\(toolchain).xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-framework", "FwkTarget", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"] + ["-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/\(toolchain).xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-framework", "FwkTarget", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"] ] as [[String]]).reduce([], +)) task.checkInputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_vers.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/main.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/foo.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/baz.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_vers.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/main.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/foo.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/baz.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList"), .path("\(SRCROOT)/build/Debug"), .namePattern(.and(.prefix("target-"), .suffix("Producer"))), .namePattern(.prefix("target-"))]) @@ -417,7 +417,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { task.checkOutputs([ .path("\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"), .namePattern(.prefix("Linked Binary \(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget")), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat"), ]) } @@ -687,17 +687,17 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { await tester.checkBuild(BuildParameters(action: .install, configuration: "Debug"), runDestination: .macOS, fs: fs) { results in results.checkTarget("CoreFoo") { target in let _ = results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "CoreFoo", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "CoreFoo", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineMatches([ .anySequence, .equal(swiftCompilerPath.str), "-module-name", "CoreFoo", "-O", .anySequence, // The Swift response file - "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.SwiftFileList", + "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.SwiftFileList", .anySequence, "-sdk", .equal(core.loadSDK(.macOS).path.str), - "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", + "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", /* options from the xcspec which sometimes change appear here */ .anySequence, "-swift-version", .equal(swiftVersion), @@ -708,51 +708,51 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { .anySequence, "-incremental", // The output file map. - "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-OutputFileMap.json", + "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-OutputFileMap.json", .anySequence, // Configure the output. "-serialize-diagnostics", "-emit-dependencies", // The module emission arguments. - "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftmodule", - "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftinterface", - "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.private.swiftinterface", + "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftmodule", + "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftinterface", + "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.private.swiftinterface", // Package interface path argument should be present "-emit-package-module-interface-path", - "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.package.swiftinterface", + "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.package.swiftinterface", .anySequence, // Package name argument should be present "-package-name", "FooPkg", // The C-family include arguments, for the Clang importer. "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/swift-overrides.hmap", .anySequence, - "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", + "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", // Generated API header arguments. - "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h", + "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h", .anySequence, // Import the target's public module, while hiding the Swift generated header. "-import-underlying-module", "-Xcc", "-ivfsoverlay", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/unextended-module-overlay.yaml", "-working-directory", "/tmp/Test/aProject", .anySequence]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo Swift Compilation Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/Foo.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/Foo.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo Swift Compilation Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Foo.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Foo.swiftconstvalues"), ]) return task } let _ = results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in - task.checkRuleInfo(["SwiftDriver Compilation Requirements", "CoreFoo", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation Requirements", "CoreFoo", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineMatches([ .anySequence, .equal(swiftCompilerPath.str), "-module-name", "CoreFoo", "-O", .anySequence, // The Swift response file - "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.SwiftFileList", + "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.SwiftFileList", .anySequence, "-sdk", .equal(core.loadSDK(.macOS).path.str), - "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", + "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", /* options from the xcspec which sometimes change appear here */ .anySequence, "-swift-version", .equal(swiftVersion), @@ -763,53 +763,53 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { .anySequence, "-incremental", // The output file map. - "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-OutputFileMap.json", + "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-OutputFileMap.json", .anySequence, // Configure the output. "-serialize-diagnostics", "-emit-dependencies", // The module emission arguments. - "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftmodule", - "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftinterface", - "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.private.swiftinterface", + "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftmodule", + "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftinterface", + "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.private.swiftinterface", // Package interface path argument should be present - "-emit-package-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.package.swiftinterface", + "-emit-package-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.package.swiftinterface", .anySequence, // Package name argument should be present "-package-name", "FooPkg", // The C-family include arguments, for the Clang importer. "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/swift-overrides.hmap", .anySequence, - "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", + "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", // Generated API header arguments. - "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h", + "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h", .anySequence, // Import the target's public module, while hiding the Swift generated header. "-import-underlying-module", "-Xcc", "-ivfsoverlay", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/unextended-module-overlay.yaml", "-working-directory", "/tmp/Test/aProject", .anySequence]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo Swift Compilation Requirements Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftmodule"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-linker-args.resp"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftsourceinfo"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.abi.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftinterface"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.private.swiftinterface"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.package.swiftinterface"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftdoc"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo Swift Compilation Requirements Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftmodule"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-linker-args.resp"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftsourceinfo"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.abi.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftinterface"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.private.swiftinterface"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.package.swiftinterface"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftdoc"), ]) return task } // There should be a 'Copy' of .swiftinterface file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Modules/CoreFoo.swiftmodule/x86_64-apple-macos.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftinterface"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Modules/CoreFoo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftinterface"])) { _ in } // There should be a 'Copy' of .private.swiftinterface file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Modules/CoreFoo.swiftmodule/x86_64-apple-macos.private.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.private.swiftinterface"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Modules/CoreFoo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.private.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.private.swiftinterface"])) { _ in } // There should be a 'Copy' of .package.swiftinterface file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Modules/CoreFoo.swiftmodule/x86_64-apple-macos.package.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.package.swiftinterface"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Modules/CoreFoo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.package.swiftinterface", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.package.swiftinterface"])) { _ in } } // Check there are no diagnostics. results.checkNoDiagnostics() @@ -874,7 +874,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { try await tester.checkBuild(BuildParameters(action: .install, configuration: "Debug"), runDestination: .macOS, fs: fs) { results in try results.checkTarget("CoreFoo") { target in let swiftCompilationRequirementsTask: any PlannedTask = try results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "CoreFoo", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "CoreFoo", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineMatches([ .anySequence, @@ -882,10 +882,10 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { "-module-name", "CoreFoo", "-O", .anySequence, // The Swift response file - "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.SwiftFileList", + "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.SwiftFileList", .anySequence, "-sdk", .equal(core.loadSDK(.macOS).path.str), - "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", + "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", /* options from the xcspec which sometimes change appear here */ .anySequence, "-swift-version", .equal(swiftVersion), @@ -900,25 +900,25 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { "-incremental", // The output file map. - "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-OutputFileMap.json", + "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-OutputFileMap.json", .anySequence, // Configure the output. "-serialize-diagnostics", "-emit-dependencies", // The module emission arguments. - "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftmodule", - "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftinterface", - "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.private.swiftinterface", + "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftmodule", + "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftinterface", + "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.private.swiftinterface", .anySequence, // The C-family include arguments, for the Clang importer. "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/swift-overrides.hmap", .anySequence, - "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", + "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", // Generated API header arguments. - "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h", + "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h", .anySequence, // Import the target's public module, while hiding the Swift generated header. @@ -929,9 +929,9 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { task.checkInputs([ .path("\(SRCROOT)/Sources/Foo.swift"), - .path("/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo_const_extract_protocols.json"), + .path("/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo_const_extract_protocols.json"), .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/unextended-module.modulemap"), .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/unextended-module-overlay.yaml"), .namePattern(.suffix(".hmap")), @@ -948,9 +948,9 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo Swift Compilation Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/Foo.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/Foo.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo Swift Compilation Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Foo.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Foo.swiftconstvalues"), ]) @@ -958,7 +958,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { } let swiftCompilationTask: any PlannedTask = try results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in - task.checkRuleInfo(["SwiftDriver Compilation Requirements", "CoreFoo", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation Requirements", "CoreFoo", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineMatches([ .anySequence, @@ -966,10 +966,10 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { "-module-name", "CoreFoo", "-O", .anySequence, // The Swift response file - "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.SwiftFileList", + "@/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.SwiftFileList", .anySequence, "-sdk", .equal(core.loadSDK(.macOS).path.str), - "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", + "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", /* options from the xcspec which sometimes change appear here */ .anySequence, "-swift-version", .equal(swiftVersion), @@ -984,25 +984,25 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { "-incremental", // The output file map. - "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-OutputFileMap.json", + "-output-file-map", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-OutputFileMap.json", .anySequence, // Configure the output. "-serialize-diagnostics", "-emit-dependencies", // The module emission arguments. - "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftmodule", - "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftinterface", - "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.private.swiftinterface", + "-emit-module", "-emit-module-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftmodule", + "-emit-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftinterface", + "-emit-private-module-interface-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.private.swiftinterface", .anySequence, // The C-family include arguments, for the Clang importer. "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/swift-overrides.hmap", .anySequence, - "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/x86_64", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", + "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc", .suffix("all-product-headers.yaml"), "-Xcc", "-iquote", "-Xcc", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I/tmp/Test/aProject/build/Debug/include", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/DerivedSources", // Generated API header arguments. - "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h", + "-emit-objc-header", "-emit-objc-header-path", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h", .anySequence, // Import the target's public module, while hiding the Swift generated header. @@ -1013,9 +1013,9 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { task.checkInputs([ .path("\(SRCROOT)/Sources/Foo.swift"), - .path("/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo_const_extract_protocols.json"), + .path("/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo_const_extract_protocols.json"), .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/unextended-module.modulemap"), .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/unextended-module-overlay.yaml"), .namePattern(.suffix(".hmap")), @@ -1031,15 +1031,15 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo Swift Compilation Requirements Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftmodule"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-linker-args.resp"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftsourceinfo"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.abi.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftinterface"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.private.swiftinterface"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.swiftdoc"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo Swift Compilation Requirements Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftmodule"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-linker-args.resp"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftsourceinfo"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.abi.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftinterface"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.private.swiftinterface"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.swiftdoc"), ]) @@ -1047,20 +1047,20 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { } results.checkTask(.matchRuleType("SwiftMergeGeneratedHeaders")) { task in - task.checkRuleInfo(["SwiftMergeGeneratedHeaders", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Headers/CoreFoo-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h"]) + task.checkRuleInfo(["SwiftMergeGeneratedHeaders", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Headers/CoreFoo-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h"]) task.checkInputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h"), .namePattern(.and(.prefix("target"), .suffix("begin-compiling"))), .name("WorkspaceHeaderMapVFSFilesWritten") ]) task.checkOutputs([ .path("/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Headers/CoreFoo-Swift.h") ]) - task.checkCommandLine(["builtin-swiftHeaderTool", "-arch", "x86_64", "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo-Swift.h", "-o", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Headers/CoreFoo-Swift.h"]) + task.checkCommandLine(["builtin-swiftHeaderTool", "-arch", results.runDestinationTargetArchitecture, "\(SRCROOT)/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo-Swift.h", "-o", "/tmp/aProject.dst/Library/Frameworks/CoreFoo.framework/Versions/A/Headers/CoreFoo-Swift.h"]) } // Check the content of the Swift response file creation task - results.checkWriteAuxiliaryFileTask(.matchRule(["WriteAuxiliaryFile", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/x86_64/CoreFoo.SwiftFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchRule(["WriteAuxiliaryFile", "/tmp/Test/aProject/build/aProject.build/Debug/CoreFoo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/CoreFoo.SwiftFileList"])) { task, contents in let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == ["/tmp/Test/aProject/Sources/Foo.swift", ""]) } @@ -1478,7 +1478,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTarget("CoreFoo") { target in // Check the Swift planning. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "CoreFoo", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "CoreFoo", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineContains([ // Import the target's public module, while hiding the Swift generated header. @@ -1734,7 +1734,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTarget("Exec") { target in // Check the Swift compile. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in - task.checkRuleInfo(["SwiftDriver Compilation Requirements", "Exec", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation Requirements", "Exec", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkOutputs(contain: [.pathPattern(.suffix("Exec.swiftmodule"))]) } @@ -1797,7 +1797,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTarget("FooApp") { target in // Check the Swift compile. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "FooApp", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "FooApp", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) let expectedFlag = isInternal ? "-internal-import-bridging-header" : "-import-objc-header" task.checkCommandLineContains([ @@ -1859,7 +1859,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTarget("FooApp") { target in // Check the Swift compile. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "FooApp", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "FooApp", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineContains([ "-import-objc-header", bridgeHeader.str]) @@ -2379,7 +2379,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in let commandLine = task.commandLine.map { $0.asString } let modules = commandLine.indices.filter { commandLine[$0] == "-add_ast_path" }.map { $0.advanced(by: 2) }.map { commandLine[$0] } - let expectedModules = results.workspace.projects.first?.targets.map { "/tmp/Test/Test/build/Test.build/Debug/\($0.name).build/Objects-normal/x86_64/\($0.name).swiftmodule" } + let expectedModules = results.workspace.projects.first?.targets.map { "/tmp/Test/Test/build/Test.build/Debug/\($0.name).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\($0.name).swiftmodule" } #expect(expectedModules == modules) } } @@ -2466,18 +2466,18 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in let commandLine = task.commandLine.map { $0.asString } let modules = commandLine.indices.filter { commandLine[$0] == "-add_ast_path" }.map { $0.advanced(by: 2) }.map { commandLine[$0] } - let expectedModules = results.workspace.projects.first?.targets.filter { $0.name != "WatchExecutable" }.map { "/tmp/Test/Test/build/Test.build/Debug-iphonesimulator/\($0.name).build/Objects-normal/x86_64/\($0.name.replacingOccurrences(of: ":", with: "_")).swiftmodule" } + let expectedModules = results.workspace.projects.first?.targets.filter { $0.name != "WatchExecutable" }.map { "/tmp/Test/Test/build/Test.build/Debug-iphonesimulator/\($0.name).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\($0.name.replacingOccurrences(of: ":", with: "_")).swiftmodule" } #expect(expectedModules == modules) } } results.checkTarget("WatchExecutable") { target in - results.checkTask(.matchTarget(target), .matchRuleType("Ld"), .matchRuleItem("x86_64")) { task in + results.checkTask(.matchTarget(target), .matchRuleType("Ld"), .matchRuleItem(results.runDestinationTargetArchitecture)) { task in let commandLine = task.commandLine.map { $0.asString } let modules = commandLine.indices.filter { commandLine[$0] == "-add_ast_path" }.map { $0.advanced(by: 2) }.map { commandLine[$0] } - let expectedModules = results.workspace.projects.first?.targets.filter { $0.name != "Executable" }.map { "/tmp/Test/Test/build/Test.build/Debug-watchsimulator/\($0.name).build/Objects-normal/x86_64/\($0.name.replacingOccurrences(of: ":", with: "_")).swiftmodule" } + let expectedModules = results.workspace.projects.first?.targets.filter { $0.name != "Executable" }.map { "/tmp/Test/Test/build/Test.build/Debug-watchsimulator/\($0.name).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\($0.name.replacingOccurrences(of: ":", with: "_")).swiftmodule" } #expect(expectedModules == modules) } - results.checkNoTask(.matchTarget(target), .matchRuleType("Ld"), .matchRuleItem("x86_64")) + results.checkNoTask(.matchTarget(target), .matchRuleType("Ld"), .matchRuleItem(results.runDestinationTargetArchitecture)) } } } @@ -2531,13 +2531,13 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { // Check the debug build. try await tester.checkBuild(runDestination: .macOS) { results in - results.checkWriteAuxiliaryFileTask(.matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.SwiftFileList"])) { task, contents in task.checkOutputs([.pathPattern(.suffix("Objects-normal/x86_64/AppTarget.SwiftFileList"))]) + results.checkWriteAuxiliaryFileTask(.matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList"])) { task, contents in task.checkOutputs([.pathPattern(.suffix("Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList"))]) #expect(contents.asString.components(separatedBy: .newlines).dropLast().sorted() == ["\(SRCROOT)/bar.swift", "\(SRCROOT)/foo.swift", "\(SRCROOT)/main.swift"]) } - try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"])) { task in - task.checkInputs(contain: [.pathPattern(.suffix("main.swift")), .pathPattern(.suffix("foo.swift")), .pathPattern(.suffix("bar.swift")), .pathPattern(.suffix("Objects-normal/x86_64/AppTarget.SwiftFileList"))]) + try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"])) { task in + task.checkInputs(contain: [.pathPattern(.suffix("main.swift")), .pathPattern(.suffix("foo.swift")), .pathPattern(.suffix("bar.swift")), .pathPattern(.suffix("Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.SwiftFileList"))]) for pattern in [StringPattern.suffix("main.swift"), .suffix("foo.swift"), .contains("bar.swift")] { #expect(!task.commandLineAsStrings.contains(where: { pattern ~= $0 }), "Expected that the command line for Swift compiler invocations doesn't contain input files beside the response file, but found an argument matching \(pattern).") @@ -2620,7 +2620,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { // Check the debug build. try await tester.checkBuild(runDestination: .macOS) { results in - try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"])) { task in + try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"])) { task in // Test full info. do { @@ -2734,7 +2734,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { do { let tester = try await TaskConstructionTester(getCore(), testProject) try await tester.checkBuild(runDestination: .macOS) { results in - try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"])) { task in + try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"])) { task in let indexingInfo = task.generateIndexingInfo(input: .fullInfo).sorted(by: { (lhs, rhs) in lhs.path < rhs.path }) #expect(indexingInfo.count == 1) @@ -2749,7 +2749,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { try await UserDefaults.withEnvironment(["EnableFixFor23297285": "0"]) { let tester = try await TaskConstructionTester(getCore(), testProject) try await tester.checkBuild(runDestination: .macOS) { results in - try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"])) { task in + try results.checkTask(.matchRule(["SwiftDriver Compilation Requirements", "AppTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"])) { task in let indexingInfo = task.generateIndexingInfo(input: .fullInfo).sorted(by: { (lhs, rhs) in lhs.path < rhs.path }) #expect(indexingInfo.count == 1) @@ -2952,7 +2952,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { await tester.checkBuild(BuildParameters(action: .build, configuration: "Debug"), runDestination: .macOS) { results in results.checkTask(.matchRuleType("Ld")) { task in - task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"]) + task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"]) } results.checkNoDiagnostics() } @@ -2965,11 +2965,11 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTask(.matchRuleType("Ld")) { task in let containsSubFrameworksPath = task.commandLineAsStrings.contains("\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/SubFrameworks") let expectedCommandLine: [String] = [ - ["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-ios\(catalystVersion.description)-macabi", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-L\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-F\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/Frameworks"], + ["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-ios\(catalystVersion.description)-macabi", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-L\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-F\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/Frameworks"], (containsSubFrameworksPath ? ["-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/SubFrameworks"] : []), ["-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/Frameworks"], (containsSubFrameworksPath ? ["-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/SubFrameworks"] : []), - ["-filelist", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/System/iOSSupport/usr/lib/swift", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AppTarget.build/Objects-normal/x86_64/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.app/Contents/MacOS/AppTarget"], + ["-filelist", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/System/iOSSupport/usr/lib/swift", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.app/Contents/MacOS/AppTarget"], ].reduce([], +) task.checkCommandLine(expectedCommandLine) } @@ -2978,7 +2978,7 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { await tester.checkBuild(BuildParameters(action: .build, configuration: "Debug", overrides: ["IS_ZIPPERED": "YES"]), runDestination: .macOS) { results in results.checkTask(.matchRuleType("Ld")) { task in - task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"]) + task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"]) } results.checkNoDiagnostics() } @@ -2987,11 +2987,11 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { results.checkTask(.matchRuleType("Ld")) { task in let containsSubFrameworksPath = task.commandLineAsStrings.contains("\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/SubFrameworks") let expectedCommandLine: [String] = [ - ["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-ios\(catalystVersion.description)-macabi", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-L\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-F\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/Frameworks"], + ["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-ios\(catalystVersion.description)-macabi", "-isysroot", "\(core.loadSDK(.macOS).path.str)", "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-L\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-L\(core.loadSDK(.macOS).path.str)/System/iOSSupport/usr/lib", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug-maccatalyst", "-F\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)", "-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/Frameworks"], (containsSubFrameworksPath ? ["-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/SubFrameworks"] : []), ["-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/Frameworks"], (containsSubFrameworksPath ? ["-iframework", "\(core.loadSDK(.macOS).path.str)/System/iOSSupport/System/Library/SubFrameworks"] : []), - ["-filelist", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/x86_64/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AppTarget.build/Objects-normal/x86_64/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.app/Contents/MacOS/AppTarget"], + ["-filelist", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.swiftmodule", "@\(SRCROOT)/build/aProject.build/Debug-maccatalyst/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget-linker-args.resp", "-o", "\(SRCROOT)/build/Debug\(MacCatalystInfo.publicSDKBuiltProductsDirSuffix)/AppTarget.app/Contents/MacOS/AppTarget"], ].reduce([], +) task.checkCommandLine(expectedCommandLine) } @@ -4572,6 +4572,53 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests { } } } + + @Test(.requireSDKs(.host)) + func indexOptionsNotAddedIfIndexingIsDisabled() async throws { + try await withTemporaryDirectory { tmpDir in + let testProject = try await TestProject( + "ProjectName", + sourceRoot: tmpDir, + groupTree: TestGroup( + "SomeFiles", + children: [ + TestFile("File1.swift") + ]), + targets: [ + TestStandardTarget( + "Test", + type: .dynamicLibrary, + buildConfigurations: [ + TestBuildConfiguration( + "Debug", + buildSettings: [ + "SWIFT_EXEC": swiftCompilerPath.str, + "SWIFT_VERSION": swiftVersion, + "COMPILER_INDEX_STORE_ENABLE": "NO", + "INDEX_DATA_STORE_DIR": tmpDir.join("index").str, + "INDEX_STORE_COMPRESS": "YES", + "INDEX_STORE_ONLY_PROJECT_FILES": "YES" + ] + ), + ], + buildPhases: [ + TestSourcesBuildPhase(["File1.swift"]), + ] + ) + ]) + + let core = try await getCore() + let tester = try TaskConstructionTester(core, testProject) + await tester.checkBuild(BuildParameters(configuration: "Debug", commandLineOverrides: ["INDEX_ENABLE_DATA_STORE": "YES"]), runDestination: .host) { results in + results.checkTask(.matchRuleType("SwiftDriver Compilation")) { compileTask in + compileTask.checkCommandLineDoesNotContain("-index-store-path") + compileTask.checkCommandLineDoesNotContain("-index-store-compress") + compileTask.checkCommandLineDoesNotContain("-index-ignore-clang-modules") + compileTask.checkCommandLineDoesNotContain("-index-ignore-system-modules") + } + } + } + } } private func XCTAssertEqual(_ lhs: EnvironmentBindings, _ rhs: [String: String], file: StaticString = #filePath, line: UInt = #line) { diff --git a/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift index e9250240..244c4949 100644 --- a/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift @@ -83,7 +83,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { "EXCLUDED_SOURCE_FILE_NAMES": "Sources/*-Matched-*", "INCLUDED_SOURCE_FILE_NAMES": "Sources/$(INCLUDED_SOURCE_FILE_NAMES_$(variant))", "INCLUDED_SOURCE_FILE_NAMES_normal": "$(INCLUDED_SOURCE_FILE_NAMES_$(variant)_$(arch))", - "INCLUDED_SOURCE_FILE_NAMES_normal_x86_64": "*-Included*", + "INCLUDED_SOURCE_FILE_NAMES_normal_\(RunDestinationInfo.macOS.targetArchitecture)": "*-Included*", "COMBINE_HIDPI_IMAGES": "YES", "LEXFLAGS": "-DOTHER_LEX_FLAG", "GCC_PREFIX_HEADER": "Sources/Prefix.pch", @@ -204,11 +204,14 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { try await fs.writePlist(Path(SRCROOT).join("Entitlements.plist"), .plDict([:])) + try fs.createDirectory(.root.join("usr").join("sbin"), recursive: true) + try fs.write(.root.join("usr").join("sbin").join("chown"), contents: "") + // Check the debug build. - await tester.checkBuild(BuildParameters(configuration: "Debug", overrides: ["INFOPLIST_PREPROCESS": "YES", "COMBINE_HIDPI_IMAGES": "YES"]), runDestination: .macOS, fs: fs) { results -> Void in + await tester.checkBuild(BuildParameters(configuration: "Debug", overrides: ["INFOPLIST_PREPROCESS": "YES", "COMBINE_HIDPI_IMAGES": "YES"]), runDestination: .macOS, processEnvironment: ["PATH": "/usr/bin:/usr/sbin"], fs: fs) { results -> Void in // There should be two warnings about our custom output files, since we won't reprocess the custom file it generates with the same name. - results.checkWarning(.prefix("no rule to process file '\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Custom.fake-lang'")) - results.checkWarning(.prefix("no rule to process file '\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Standard.fake-lang'")) + results.checkWarning(.prefix("no rule to process file '\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Custom.fake-lang'")) + results.checkWarning(.prefix("no rule to process file '\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Standard.fake-lang'")) // There shouldn't be any task construction diagnostics. results.checkNoDiagnostics() @@ -216,7 +219,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget("AppTarget") { target -> Void in // There should be a PCH job for C and Objective-C, and one extra Obj-C one for the file with custom flags. results.checkTask(.matchTarget(target), .matchRuleType("ProcessPCH"), .matchRuleItem("c")) { task in - task.checkRuleInfo([.equal("ProcessPCH"), .suffix("/Prefix.pch.gch"), .equal("\(SRCROOT)/Sources/Prefix.pch"), .equal("normal"), .equal("x86_64"), .equal("c"), .equal("com.apple.compilers.llvm.clang.1_0.compiler")]) + task.checkRuleInfo([.equal("ProcessPCH"), .suffix("/Prefix.pch.gch"), .equal("\(SRCROOT)/Sources/Prefix.pch"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("c"), .equal("com.apple.compilers.llvm.clang.1_0.compiler")]) } results.checkTasks(.matchTarget(target), .matchRuleType("ProcessPCH"), .matchRuleItem("objective-c")) { tasks in let taskArray = Array(tasks) @@ -238,20 +241,20 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { return } - mrrTask.checkRuleInfo([.equal("ProcessPCH"), .suffix("/Prefix.pch.gch"), .equal("\(SRCROOT)/Sources/Prefix.pch"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .equal("com.apple.compilers.llvm.clang.1_0.compiler")]) - arcTask.checkRuleInfo([.equal("ProcessPCH"), .suffix("/Prefix.pch.gch"), .equal("\(SRCROOT)/Sources/Prefix.pch"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .equal("com.apple.compilers.llvm.clang.1_0.compiler")]) + mrrTask.checkRuleInfo([.equal("ProcessPCH"), .suffix("/Prefix.pch.gch"), .equal("\(SRCROOT)/Sources/Prefix.pch"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .equal("com.apple.compilers.llvm.clang.1_0.compiler")]) + arcTask.checkRuleInfo([.equal("ProcessPCH"), .suffix("/Prefix.pch.gch"), .equal("\(SRCROOT)/Sources/Prefix.pch"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .equal("com.apple.compilers.llvm.clang.1_0.compiler")]) } // There should be an Info.plist processing task, and associated Preprocess (we explicitly enable it). results.checkTask(.matchTarget(target), .matchRuleType("Preprocess")) { task in - task.checkRuleInfo(["Preprocess", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/normal/x86_64/Preprocessed-Info.plist", "\(SRCROOT)/Sources/Info.plist"]) - task.checkCommandLine(["cc", "-E", "-P", "-x", "c", "-Wno-trigraphs", "\(SRCROOT)/Sources/Info.plist", "-F\(SRCROOT)/build/Debug", "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", core.loadSDK(.macOS).path.str, "-o", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/normal/x86_64/Preprocessed-Info.plist"]) + task.checkRuleInfo(["Preprocess", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/normal/\(results.runDestinationTargetArchitecture)/Preprocessed-Info.plist", "\(SRCROOT)/Sources/Info.plist"]) + task.checkCommandLine(["cc", "-E", "-P", "-x", "c", "-Wno-trigraphs", "\(SRCROOT)/Sources/Info.plist", "-F\(SRCROOT)/build/Debug", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", core.loadSDK(.macOS).path.str, "-o", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/normal/\(results.runDestinationTargetArchitecture)/Preprocessed-Info.plist"]) task.checkInputs([ .path("\(SRCROOT)/Sources/Info.plist"), .namePattern(.and(.prefix("target-"), .suffix("Producer"))), .namePattern(.and(.prefix("target-"), .suffix("-entry")))]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/normal/x86_64/Preprocessed-Info.plist")]) + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/normal/\(results.runDestinationTargetArchitecture)/Preprocessed-Info.plist")]) } results.checkTask(.matchTarget(target), .matchRuleType("ProcessInfoPlistFile")) { task in task.checkRuleInfo(["ProcessInfoPlistFile", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Info.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Preprocessed-Info.plist"]) @@ -307,7 +310,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { return } - sortedTasks[0].checkRuleInfo([.equal("CompileC"), .suffix("Lex.yy.o"), .suffix("Lex.yy.c"), .equal("normal"), .equal("x86_64"), .equal("c"), .any]) + sortedTasks[0].checkRuleInfo([.equal("CompileC"), .suffix("Lex.yy.o"), .suffix("Lex.yy.c"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("c"), .any]) // Check the pair of sources with non-unique names. let nonUniqueASource = Path(sortedTasks[1].ruleInfo[2]).basename @@ -317,33 +320,33 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { #expect(Set([nonUniqueASource, nonUniqueBSource]) == Set(["NonUnique.m", "NonUnique.mm"])) #expect(nonUniqueAObject != nonUniqueBObject) - sortedTasks[3].checkRuleInfo([.equal("CompileC"), .suffix("Script-Output-Custom-SourceFile.o"), .suffix("Script-Output-Custom-SourceFile.c"), .equal("normal"), .equal("x86_64"), .equal("c"), .any]) - sortedTasks[4].checkRuleInfo([.equal("CompileC"), .suffix("Script-Output-Standard-SourceFile.o"), .suffix("Script-Output-Standard-SourceFile.c"), .equal("normal"), .equal("x86_64"), .equal("c"), .any]) - sortedTasks[5].checkRuleInfo([.equal("CompileC"), .suffix("SourceFile-Matched-Included.o"), .suffix("SourceFile-Matched-Included.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) - sortedTasks[6].checkRuleInfo([.equal("CompileC"), .suffix("SourceFile.o"), .suffix("SourceFile.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) - sortedTasks[7].checkRuleInfo([.equal("CompileC"), .suffix("SourceFile_MRR.o"), .suffix("SourceFile_MRR.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) - sortedTasks[8].checkRuleInfo([.equal("CompileC"), .suffix("y.tab.o"), .suffix("y.tab.c"), .equal("normal"), .equal("x86_64"), .equal("c"), .any]) + sortedTasks[3].checkRuleInfo([.equal("CompileC"), .suffix("Script-Output-Custom-SourceFile.o"), .suffix("Script-Output-Custom-SourceFile.c"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("c"), .any]) + sortedTasks[4].checkRuleInfo([.equal("CompileC"), .suffix("Script-Output-Standard-SourceFile.o"), .suffix("Script-Output-Standard-SourceFile.c"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("c"), .any]) + sortedTasks[5].checkRuleInfo([.equal("CompileC"), .suffix("SourceFile-Matched-Included.o"), .suffix("SourceFile-Matched-Included.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) + sortedTasks[6].checkRuleInfo([.equal("CompileC"), .suffix("SourceFile.o"), .suffix("SourceFile.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) + sortedTasks[7].checkRuleInfo([.equal("CompileC"), .suffix("SourceFile_MRR.o"), .suffix("SourceFile_MRR.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) + sortedTasks[8].checkRuleInfo([.equal("CompileC"), .suffix("y.tab.o"), .suffix("y.tab.c"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("c"), .any]) } // Check that the expected separate headermaps are created. results.checkHeadermapGenerationTask(.matchTarget(target), .matchRuleItemBasename("AppTarget-project-headers.hmap")) { _ in } results.checkHeadermapGenerationTask(.matchTarget(target), .matchRuleItemBasename("AppTarget-generated-files.hmap")) { headermap in - headermap.checkEntry("AppTarget/Custom.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Custom.fake-lang") - headermap.checkEntry("AppTarget/Standard.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Standard.fake-lang") - headermap.checkEntry("AppTarget/Script-Output-Custom-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Script-Output-Custom-SourceFile.c") - headermap.checkEntry("AppTarget/Script-Output-Standard-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Script-Output-Standard-SourceFile.c") - headermap.checkEntry("AppTarget/foo-Custom.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo-Custom.h") - headermap.checkEntry("AppTarget/foo-Standard.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo-Standard.h") - headermap.checkEntry("AppTarget/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist") + headermap.checkEntry("AppTarget/Custom.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Custom.fake-lang") + headermap.checkEntry("AppTarget/Standard.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Standard.fake-lang") + headermap.checkEntry("AppTarget/Script-Output-Custom-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Script-Output-Custom-SourceFile.c") + headermap.checkEntry("AppTarget/Script-Output-Standard-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Script-Output-Standard-SourceFile.c") + headermap.checkEntry("AppTarget/foo-Custom.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo-Custom.h") + headermap.checkEntry("AppTarget/foo-Standard.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo-Standard.h") + headermap.checkEntry("AppTarget/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist") headermap.checkEntry("AppTarget/y.tab.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/y.tab.c") headermap.checkEntry("AppTarget/y.tab.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/y.tab.h") - headermap.checkEntry("Custom.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Custom.fake-lang") - headermap.checkEntry("Standard.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Standard.fake-lang") - headermap.checkEntry("Script-Output-Custom-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Script-Output-Custom-SourceFile.c") - headermap.checkEntry("Script-Output-Standard-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Script-Output-Standard-SourceFile.c") - headermap.checkEntry("foo-Custom.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo-Custom.h") - headermap.checkEntry("foo-Standard.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo-Standard.h") - headermap.checkEntry("foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist") + headermap.checkEntry("Custom.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Custom.fake-lang") + headermap.checkEntry("Standard.fake-lang", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Standard.fake-lang") + headermap.checkEntry("Script-Output-Custom-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Script-Output-Custom-SourceFile.c") + headermap.checkEntry("Script-Output-Standard-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Script-Output-Standard-SourceFile.c") + headermap.checkEntry("foo-Custom.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo-Custom.h") + headermap.checkEntry("foo-Standard.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo-Standard.h") + headermap.checkEntry("foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist") headermap.checkEntry("y.tab.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/y.tab.c") headermap.checkEntry("y.tab.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources/y.tab.h") @@ -354,11 +357,11 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { // There should be two CopyPlistFile tasks (from the script rule). results.checkTask(.matchTarget(target), .matchRuleType("CopyPlistFile"), .matchRuleItemPattern(.suffix("en.lproj/foo.plist"))) { task in - task.checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources/en.lproj/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo.plist"]) - task.checkCommandLine(["builtin-copyPlist", "--outdir", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources/en.lproj", "--", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo.plist"]) + task.checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources/en.lproj/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo.plist"]) + task.checkCommandLine(["builtin-copyPlist", "--outdir", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources/en.lproj", "--", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo.plist"]) task.checkInputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo.plist"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo.plist"), .namePattern(.prefix("target-")), .namePattern(.prefix("target-")), .name("WorkspaceHeaderMapVFSFilesWritten")]) @@ -368,11 +371,11 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { } results.checkTask(.matchTarget(target), .matchRuleType("CopyPlistFile"), .matchRuleItemPattern(.suffix("foo.plist"))) { task in - task.checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist"]) - task.checkCommandLine(["builtin-copyPlist", "--outdir", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources", "--", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist"]) + task.checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist"]) + task.checkCommandLine(["builtin-copyPlist", "--outdir", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/Resources", "--", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist"]) task.checkInputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist"), .namePattern(.prefix("target-")), .namePattern(.prefix("target-")), .name("WorkspaceHeaderMapVFSFilesWritten")]) @@ -383,7 +386,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { // There should be two RuleScriptExecution tasks. results.checkTask(.matchTarget(target), .matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("Custom.fake-lang")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo-Custom.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Script-Output-Custom-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Custom.fake-lang", "\(SRCROOT)/Sources/Custom.fake-lang", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo-Custom.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Script-Output-Custom-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Custom.fake-lang", "\(SRCROOT)/Sources/Custom.fake-lang", "normal", .equal(results.runDestinationTargetArchitecture)]) task.checkCommandLine(["/bin/sh", "-c", "echo hi"]) // Check that we pushed the script rule specific variables correctly. @@ -398,10 +401,10 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { "SCRIPT_INPUT_FILE_0": .equal("\(SRCROOT)/Sources/Project.fake-lang-settings"), "SCRIPT_INPUT_FILE_1": .equal("\(SRCROOT)/Sources/Custom.fake-lang-settings"), "SCRIPT_INPUT_FILE_COUNT": .equal("2"), - "SCRIPT_OUTPUT_FILE_0": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo-Custom.h"), - "SCRIPT_OUTPUT_FILE_1": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Script-Output-Custom-SourceFile.c"), - "SCRIPT_OUTPUT_FILE_2": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist"), - "SCRIPT_OUTPUT_FILE_3": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Custom.fake-lang"), + "SCRIPT_OUTPUT_FILE_0": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo-Custom.h"), + "SCRIPT_OUTPUT_FILE_1": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Script-Output-Custom-SourceFile.c"), + "SCRIPT_OUTPUT_FILE_2": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist"), + "SCRIPT_OUTPUT_FILE_3": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Custom.fake-lang"), "SCRIPT_OUTPUT_FILE_COUNT": .equal("4"), "SYSTEM_APPS_DIR": .equal("/Applications"), @@ -416,14 +419,14 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { .namePattern(.prefix("target-")), .name("WorkspaceHeaderMapVFSFilesWritten")]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo-Custom.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Script-Output-Custom-SourceFile.c"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/foo.plist"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/Custom.fake-lang")]) + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo-Custom.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Script-Output-Custom-SourceFile.c"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/Custom.fake-lang")]) } results.checkTask(.matchTarget(target), .matchRuleType("RuleScriptExecution"), .matchRuleItemBasename("Standard.fake-lang")) { task in - task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo-Standard.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Script-Output-Standard-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Standard.fake-lang", "\(SRCROOT)/Sources/en.lproj/Standard.fake-lang", "normal", "x86_64"]) + task.checkRuleInfo(["RuleScriptExecution", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo-Standard.h", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Script-Output-Standard-SourceFile.c", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo.plist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Standard.fake-lang", "\(SRCROOT)/Sources/en.lproj/Standard.fake-lang", "normal", .equal(results.runDestinationTargetArchitecture)]) task.checkCommandLine(["/bin/sh", "-c", "echo hi"]) // Check that we pushed the script rule specific variables correctly. @@ -439,10 +442,10 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { "SCRIPT_INPUT_FILE_0": .equal("\(SRCROOT)/Sources/Project.fake-lang-settings"), "SCRIPT_INPUT_FILE_1": .equal("\(SRCROOT)/Sources/en.lproj/Standard.fake-lang-settings"), "SCRIPT_INPUT_FILE_COUNT": .equal("2"), - "SCRIPT_OUTPUT_FILE_0": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo-Standard.h"), - "SCRIPT_OUTPUT_FILE_1": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Script-Output-Standard-SourceFile.c"), - "SCRIPT_OUTPUT_FILE_2": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo.plist"), - "SCRIPT_OUTPUT_FILE_3": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Standard.fake-lang"), + "SCRIPT_OUTPUT_FILE_0": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo-Standard.h"), + "SCRIPT_OUTPUT_FILE_1": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Script-Output-Standard-SourceFile.c"), + "SCRIPT_OUTPUT_FILE_2": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo.plist"), + "SCRIPT_OUTPUT_FILE_3": .equal("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Standard.fake-lang"), "SCRIPT_OUTPUT_FILE_COUNT": .equal("4"), "SYSTEM_APPS_DIR": .equal("/Applications"), @@ -457,10 +460,10 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { .namePattern(.prefix("target-")), .name("WorkspaceHeaderMapVFSFilesWritten")]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo-Standard.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Script-Output-Standard-SourceFile.c"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo.plist"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/Standard.fake-lang")]) + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo-Standard.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Script-Output-Standard-SourceFile.c"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo.plist"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/Standard.fake-lang")]) } // There should be one file copy of the strings file. @@ -492,22 +495,22 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget", "normal"]) - task.checkCommandLine(["clang++", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat", "-fobjc-arc", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-framework", "Framework", "-framework", "AppCore", "-weak_framework", "AppExtensions", "-framework", "Framework-Matched-Included", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"]) + task.checkCommandLine(["clang++", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-framework", "Framework", "-framework", "AppCore", "-weak_framework", "AppExtensions", "-framework", "Framework-Matched-Included", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"]) task.checkInputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/SourceFile.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o"), .any, .any, .any, .any, - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/Lex.yy.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Lex.yy.o"), .any, .any, .any, - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList"), .path("\(SRCROOT)/build/Debug"), .namePattern(.and(.prefix("target-"), .suffix("-generated-headers"))), .namePattern(.and(.prefix("target-"), .suffix("-swift-generated-headers"))), @@ -517,8 +520,8 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { task.checkOutputs([ .path("\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget"), .namePattern(.prefix("Linked Binary \(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget")), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_lto.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/x86_64/AppTarget_dependency_info.dat"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_lto.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget_dependency_info.dat"), ]) } @@ -836,7 +839,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { try await localFS.writePlist(Path(SRCROOT).join("Entitlements.plist"), .plDict([:])) // Check an install release build. - try await tester.checkBuild(BuildParameters(action: .install, configuration: "Release"), runDestination: .macOS, fs: localFS) { results -> Void in + try await tester.checkBuild(BuildParameters(action: .install, configuration: "Release"), runDestination: .macOS, processEnvironment: ["PATH": "/usr/bin:/usr/sbin"], fs: localFS) { results -> Void in try results.checkTarget("AppTarget") { target -> Void in // There should be a symlink task. try results.checkTask(.matchTarget(target), .matchRuleType("SymLink")) { task in @@ -887,7 +890,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { // There should be one prelinked object link task. results.checkTask(.matchTarget(target), .matchRuleType("PrelinkedObjectLink")) { task in - task.checkRuleInfo(["PrelinkedObjectLink", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/AppTarget-x86_64-prelink.o"]) + task.checkRuleInfo(["PrelinkedObjectLink", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/AppTarget-\(results.runDestinationTargetArchitecture)-prelink.o"]) let nonUniqueObjs = task.commandLineAsStrings.filter { $0.contains("NonUnique") } if nonUniqueObjs.count != 2 { #expect(nonUniqueObjs.count == 2) @@ -895,16 +898,16 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { } #expect(nonUniqueObjs[0] != nonUniqueObjs[1]) - task.checkCommandLineMatches([StringPattern.suffix("ld"), "-r", "-arch", "x86_64", "-platform_version", "1", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/SourceFile.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/SourceFile-Matched-Excluded.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/SourceFile-Matched-Included.o"), .equal(nonUniqueObjs[0]), .equal(nonUniqueObjs[1]), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/SourceFile_MRR.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/Lex.yy.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/y.tab.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/Script-Output-Custom-SourceFile.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/Script-Output-Standard-SourceFile.o"), "-o", .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/AppTarget-x86_64-prelink.o")]) + task.checkCommandLineMatches([StringPattern.suffix("ld"), "-r", "-arch", .equal(results.runDestinationTargetArchitecture), "-platform_version", "1", .any, .any, "-syslibroot", .equal(core.loadSDK(.macOS).path.str), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile-Matched-Excluded.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile-Matched-Included.o"), .equal(nonUniqueObjs[0]), .equal(nonUniqueObjs[1]), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile_MRR.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Lex.yy.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/y.tab.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Script-Output-Custom-SourceFile.o"), .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Script-Output-Standard-SourceFile.o"), "-o", .equal("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/AppTarget-\(results.runDestinationTargetArchitecture)-prelink.o")]) task.checkInputs([ - .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/SourceFile.o"), + .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o"), .any, .any, .any, .any, - .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/SourceFile_MRR.o"), - .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/Lex.yy.o"), + .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile_MRR.o"), + .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Lex.yy.o"), .any, .any, .any, @@ -915,12 +918,12 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { .namePattern(.prefix("target-"))]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/AppTarget-x86_64-prelink.o"),]) + .path("\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/AppTarget-\(results.runDestinationTargetArchitecture)-prelink.o"),]) } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/x86_64/AppTarget.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/AppTarget.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "/tmp/aProject.dst/Applications/AppTarget.app/Contents/MacOS/AppTarget", "normal"]) } @@ -1168,8 +1171,8 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { let sortedTasks = tasks.sorted { $0.ruleInfo.lexicographicallyPrecedes($1.ruleInfo) } #expect(sortedTasks.count == 3) sortedTasks[0].checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Release/AppTarget.app/Contents/Frameworks/PlistFileToCopy.plist", "\(SRCROOT)/Sources/PlistFileToCopy.plist"]) - sortedTasks[1].checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Release/AppTarget.app/Contents/Resources/en.lproj/foo.plist", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/DerivedSources-normal/x86_64/en.lproj/foo.plist"]) - sortedTasks[2].checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Release/AppTarget.app/Contents/Resources/foo.plist", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/DerivedSources-normal/x86_64/foo.plist"]) + sortedTasks[1].checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Release/AppTarget.app/Contents/Resources/en.lproj/foo.plist", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/en.lproj/foo.plist"]) + sortedTasks[2].checkRuleInfo(["CopyPlistFile", "\(SRCROOT)/build/Release/AppTarget.app/Contents/Resources/foo.plist", "\(SRCROOT)/build/aProject.build/Release/AppTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)/foo.plist"]) } } @@ -1323,21 +1326,21 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { let compileTasks = results.checkTasks(.matchTarget(target), .matchRuleType("CompileC")) { tasks -> [any PlannedTask] in let sortedTasks = tasks.sorted { $0.ruleInfo.lexicographicallyPrecedes($1.ruleInfo) } #expect(sortedTasks.count == 2) - sortedTasks[safe: 0]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceOne.o"), .suffix("SourceOne.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) - sortedTasks[safe: 1]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceTwo.o"), .suffix("SourceTwo.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) + sortedTasks[safe: 0]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceOne.o"), .suffix("SourceOne.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) + sortedTasks[safe: 1]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceTwo.o"), .suffix("SourceTwo.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) return sortedTasks } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/FrameworkTarget.framework/Versions/A/FrameworkTarget", "normal"]) task.checkCommandLine([ ["clang"], ["-Xlinker", "-reproducible"], - ["-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], - ["-dynamiclib", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget.LinkFileList", "-install_name", "/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"], - ["-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget_dependency_info.dat", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/FrameworkTarget.framework/Versions/A/FrameworkTarget"] + ["-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], + ["-dynamiclib", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.LinkFileList", "-install_name", "/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"], + ["-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget_dependency_info.dat", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/FrameworkTarget.framework/Versions/A/FrameworkTarget"] ].reduce([], +)) } @@ -1447,26 +1450,26 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTasks(.matchTarget(target), .matchRuleType("CompileC")) { tasks in let sortedTasks = tasks.sorted { $0.ruleInfo.lexicographicallyPrecedes($1.ruleInfo) } #expect(sortedTasks.count == 2) - sortedTasks[safe: 0]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceOne.o"), .suffix("SourceOne.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) - sortedTasks[safe: 1]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceTwo.o"), .suffix("SourceTwo.m"), .equal("normal"), .equal("x86_64"), .equal("objective-c"), .any]) + sortedTasks[safe: 0]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceOne.o"), .suffix("SourceOne.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) + sortedTasks[safe: 1]?.checkRuleInfo([.equal("CompileC"), .suffix("SourceTwo.o"), .suffix("SourceTwo.m"), .equal("normal"), .equal(results.runDestinationTargetArchitecture), .equal("objective-c"), .any]) } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "/tmp/aProject.dst/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget", "normal"]) task.checkCommandLine([ ["clang"], ["-Xlinker", "-reproducible"], - ["-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], - ["-dynamiclib", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Release", "-L\(SRCROOT)/build/Release", "-F\(SRCROOT)/build/EagerLinkingTBDs/Release", "-F\(SRCROOT)/build/Release", "-filelist", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget.LinkFileList", "-exported_symbols_list", "Exports.exp", "-unexported_symbols_list", "Unexports.exp", "-install_name", "/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"], - ["-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget_lto.o", "-Xlinker", "-final_output", "-Xlinker", "/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget_dependency_info.dat", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-Xlinker", "-no_adhoc_codesign", "-o", "/tmp/aProject.dst/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"] + ["-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], + ["-dynamiclib", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Release", "-L\(SRCROOT)/build/Release", "-F\(SRCROOT)/build/EagerLinkingTBDs/Release", "-F\(SRCROOT)/build/Release", "-filelist", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.LinkFileList", "-exported_symbols_list", "Exports.exp", "-unexported_symbols_list", "Unexports.exp", "-install_name", "/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"], + ["-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget_lto.o", "-Xlinker", "-final_output", "-Xlinker", "/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget_dependency_info.dat", "-fobjc-link-runtime", "-lstatic", "-ldynamic", "-Xlinker", "-no_adhoc_codesign", "-o", "/tmp/aProject.dst/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"] ].reduce([], +)) task.checkInputs([ - .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/SourceOne.o"), - .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/SourceTwo.o"), - .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget.LinkFileList"), + .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceOne.o"), + .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceTwo.o"), + .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget.LinkFileList"), .path("\(SRCROOT)/Exports.exp"), .path("\(SRCROOT)/Unexports.exp"), .path("\(SRCROOT)/build/Release"), @@ -1478,8 +1481,8 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { task.checkOutputs([ .path("/tmp/aProject.dst/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"), .name("Linked Binary /tmp/aProject.dst/Library/Frameworks/FrameworkTarget.framework/Versions/A/FrameworkTarget"), - .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget_lto.o"), - .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/x86_64/FrameworkTarget_dependency_info.dat"), + .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget_lto.o"), + .path("\(SRCROOT)/build/aProject.build/Release/FrameworkTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/FrameworkTarget_dependency_info.dat"), ]) } @@ -1879,23 +1882,23 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { if runDestination == .macOS { // There should be an Info.plist processing task, and associated Preprocess (we explicitly enable it). results.checkTask(.matchTarget(target), .matchRuleType("Preprocess")) { task in - task.checkRuleInfo(["Preprocess", targetPerArchBuildBaseDir.join("x86_64/Preprocessed-Info.plist").str, "\(SRCROOT)/Tool.plist"]) + task.checkRuleInfo(["Preprocess", targetPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Preprocessed-Info.plist").str, "\(SRCROOT)/Tool.plist"]) } results.checkTask(.matchTarget(target), .matchRuleType("ProcessInfoPlistFile")) { task in - task.checkRuleInfo(["ProcessInfoPlistFile", targetObjectsPerArchBuildBaseDir.join("x86_64/Processed-Info.plist").str, targetPerArchBuildBaseDir.join("x86_64/Preprocessed-Info.plist").str]) - task.checkCommandLine(["builtin-infoPlistUtility", targetPerArchBuildBaseDir.join("x86_64/Preprocessed-Info.plist").str, "-producttype", "com.apple.product-type.tool", "-expandbuildsettings", "-platform", "macosx", "-o", targetObjectsPerArchBuildBaseDir.join("x86_64/Processed-Info.plist").str]) + task.checkRuleInfo(["ProcessInfoPlistFile", targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Processed-Info.plist").str, targetPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Preprocessed-Info.plist").str]) + task.checkCommandLine(["builtin-infoPlistUtility", targetPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Preprocessed-Info.plist").str, "-producttype", "com.apple.product-type.tool", "-expandbuildsettings", "-platform", "macosx", "-o", targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Processed-Info.plist").str]) } // There should be a link task which incorporates the Info.plist file, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", targetObjectsPerArchBuildBaseDir.join("x86_64/Tool.LinkFileList").str])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Tool.LinkFileList").str])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "/tmp/aProject.dst/usr/local/bin/Tool", "normal"]) - task.checkCommandLineContainsUninterrupted(["-sectcreate", "__TEXT", "__info_plist", targetObjectsPerArchBuildBaseDir.join("x86_64/Processed-Info.plist").str]) + task.checkCommandLineContainsUninterrupted(["-sectcreate", "__TEXT", "__info_plist", targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Processed-Info.plist").str]) task.checkInputs(contain: [ - .path(targetObjectsPerArchBuildBaseDir.join("x86_64/SourceFile.o").str), - .path(targetObjectsPerArchBuildBaseDir.join("x86_64/PerArchFile.o").str), - .path(targetObjectsPerArchBuildBaseDir.join("x86_64/Tool.LinkFileList").str), - .path(targetObjectsPerArchBuildBaseDir.join("x86_64/Processed-Info.plist").str), + .path(targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/SourceFile.o").str), + .path(targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/PerArchFile.o").str), + .path(targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Tool.LinkFileList").str), + .path(targetObjectsPerArchBuildBaseDir.join("\(results.runDestinationTargetArchitecture)/Processed-Info.plist").str), ]) } @@ -2558,7 +2561,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget("Tool") { target in // There should be one Mig task. results.checkTask(.matchTarget(target), .matchRuleType("Mig")) { task in - task.checkRuleInfo(["Mig", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/Interfaces.h", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/InterfacesUser.c", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/InterfacesServer.h", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/InterfacesServer.c", "\(SRCROOT)/Interfaces.defs", "normal", "x86_64"]) + task.checkRuleInfo(["Mig", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/Interfaces.h", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/InterfacesUser.c", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/InterfacesServer.h", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/InterfacesServer.c", "\(SRCROOT)/Interfaces.defs", "normal", results.runDestinationTargetArchitecture]) // Check that the outputs are correct. XCTAssertMatch(task.outputs.map { $0.path.str }, [ @@ -2570,8 +2573,8 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { } // There should be two compile of the Mig-generated client and server. - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/InterfacesServer.o", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/InterfacesServer.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } - results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/InterfacesUser.o", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/x86_64/InterfacesUser.c", "normal", "x86_64", "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/InterfacesServer.o", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/InterfacesServer.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } + results.checkTask(.matchTarget(target), .matchRule(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/InterfacesUser.o", "\(SRCROOT)/build/aProject.build/Debug/Tool.build/DerivedSources/\(results.runDestinationTargetArchitecture)/InterfacesUser.c", "normal", results.runDestinationTargetArchitecture, "c", "com.apple.compilers.llvm.clang.1_0.compiler"])) { task in } results.checkNoTask(.matchRuleType("CompileC")) } @@ -2783,14 +2786,14 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget("Framework") { target in // There should be one task each for unvarianted content. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-normal/x86_64/Framework.swiftmodule"])) { _ in } - results.checkNoTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-debug/x86_64/Framework.swiftmodule"])) + results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Framework.swiftmodule"])) { _ in } + results.checkNoTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-debug/\(results.runDestinationTargetArchitecture)/Framework.swiftmodule"])) - results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-normal/x86_64/Framework.swiftdoc"])) { _ in } - results.checkNoTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-debug/x86_64/Framework.swiftdoc"])) + results.checkTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Framework.swiftdoc"])) { _ in } + results.checkNoTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Modules/Framework.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-debug/\(results.runDestinationTargetArchitecture)/Framework.swiftdoc"])) - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Headers/Framework-Swift.h", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-normal/x86_64/Framework-Swift.h"])) { _ in } - results.checkNoTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Headers/Framework-Swift.h", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-debug/x86_64/Framework-Swift.h"])) + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Headers/Framework-Swift.h", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-normal/\(results.runDestinationTargetArchitecture)/Framework-Swift.h"])) { _ in } + results.checkNoTask(.matchTarget(target), .matchRule(["Copy", "/tmp/aProject.dst/Library/Frameworks/Framework.framework/Versions/A/Headers/Framework-Swift.h", "\(SRCROOT)/build/aProject.build/Release/Framework.build/Objects-debug/\(results.runDestinationTargetArchitecture)/Framework-Swift.h"])) // There should be two strip tasks, one per variant. results.checkTasks(.matchTarget(target), .matchRuleType("Strip")) { tasks in @@ -3351,7 +3354,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // Check the search paths in the CompileC task. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", "x86_64", "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) + task.checkRuleInfo(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", results.runDestinationTargetArchitecture, "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) task.checkCommandLineContains([ // The target's explicitly specified search paths "-F/Target/Framework/Search/Path/A", @@ -3367,7 +3370,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { // Check the search paths in the Swift Planning task. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineContains([ // The build directory "-F", "\(SRCROOT)/build/Debug", @@ -3432,7 +3435,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // Check the search paths in the CompileC task. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", "x86_64", "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) + task.checkRuleInfo(["CompileC", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", results.runDestinationTargetArchitecture, "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) task.checkCommandLineContains([ // The target's explicitly specified search paths, each preceded by the remapping into the sparse SDK where appropriate "-I\(nonEmbeddedSparseSDKPath.str)/usr/local/include/one", @@ -3456,7 +3459,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { // Check the search paths in the SwiftDriver task. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkCommandLineContains([ // The build directory "-F", "\(SRCROOT)/build/Debug", @@ -3604,22 +3607,22 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // There should be one CompileC task. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo(["CompileC", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", "x86_64", "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) + task.checkRuleInfo(["CompileC", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", results.runDestinationTargetArchitecture, "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) task.checkCommandLineContains([ [clangCompilerPath.str, "-x", "objective-c"], - ["-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], - ["-fmessage-length=0", "-fdiagnostics-show-note-include-stack", "-fmacro-backtrace-limit=0", "-fmodules", "-gmodules", "-fmodules-cache-path=\(derivedData.str)/ModuleCache.noindex", "-fmodules-prune-interval=86400", "-fmodules-prune-after=345600", "-fbuild-session-file=\(derivedData.str)/ModuleCache.noindex/Session.modulevalidation", "-fmodules-validate-once-per-build-session", "-Wnon-modular-include-in-framework-module", "-Werror=non-modular-include-in-framework-module", /* non-module standard flags go here */ "-isysroot", core.loadSDK(.macOS).path.str, "-fasm-blocks", "-fstrict-aliasing", "-Wprotocol", "-Wdeprecated-declarations"], - ["-g", "-Wno-sign-conversion", "-Wno-infinite-recursion", "-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-ivfsoverlay"], ["-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-I\(products.str)/Debug/include", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/x86_64", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-F\(products.str)/Debug", "-MMD", "-MT", "dependencies", "-MF", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.d", "--serialize-diagnostics", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.dia", "-c", "\(SRCROOT)/Sources/SourceFile.m", "-o", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.o"] + ["-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], + ["-fmessage-length=0", "-fdiagnostics-show-note-include-stack", "-fmacro-backtrace-limit=0", "-fmodules", "-gmodules", "-fmodules-cache-path=\(derivedData.str)/ModuleCache.noindex", "-fmodules-prune-interval=86400", "-fmodules-prune-after=345600", "-fbuild-session-file=\(derivedData.str)/ModuleCache.noindex/Session.modulevalidation", "-fmodules-validate-once-per-build-session", "-Wnon-modular-include-in-framework-module", "-Werror=non-modular-include-in-framework-module", /* non-module standard flags go here */ "-isysroot", core.loadSDK(.macOS).path.str], ["-fstrict-aliasing", "-Wprotocol", "-Wdeprecated-declarations"], + ["-g", "-Wno-sign-conversion", "-Wno-infinite-recursion", "-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-ivfsoverlay"], ["-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-I\(products.str)/Debug/include", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-F\(products.str)/Debug", "-MMD", "-MT", "dependencies", "-MF", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.d", "--serialize-diagnostics", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.dia", "-c", "\(SRCROOT)/Sources/SourceFile.m", "-o", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o"] ].reduce([], +)) } // There should be one SwiftDriver task. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) - task.checkCommandLineContains([[swiftCompilerPath.str, "-module-name", targetName, "-O", "@\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName).SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", "-module-cache-path", "\(derivedData.str)/ModuleCache.noindex", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(products.str)/Debug", "-F", "\(products.str)/Debug", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName)-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName).swiftmodule", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc"], ["-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I\(products.str)/Debug/include", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/x86_64", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName)-Swift.h", "-working-directory", SRCROOT]].reduce([], +)) + task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) + task.checkCommandLineContains([[swiftCompilerPath.str, "-module-name", targetName, "-O", "@\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", "-module-cache-path", "\(derivedData.str)/ModuleCache.noindex", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(products.str)/Debug", "-F", "\(products.str)/Debug", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName)-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).swiftmodule", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-non-framework-target-headers.hmap", "-Xcc", "-ivfsoverlay", "-Xcc"], ["-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I\(products.str)/Debug/include", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName)-Swift.h", "-working-directory", SRCROOT]].reduce([], +)) } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName).SwiftFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).SwiftFileList"])) { task, contents in let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == ["\(SRCROOT)/Sources/SwiftFile.swift", ""]) } @@ -3635,22 +3638,22 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // There should be one CompileC task. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo(["CompileC", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", "x86_64", "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) + task.checkRuleInfo(["CompileC", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o", "\(SRCROOT)/Sources/SourceFile.m", "normal", results.runDestinationTargetArchitecture, "objective-c", "com.apple.compilers.llvm.clang.1_0.compiler"]) task.checkCommandLineContains([ [clangCompilerPath.str, "-x", "objective-c"], - ["-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], - ["-fmessage-length=0", "-fdiagnostics-show-note-include-stack", "-fmacro-backtrace-limit=0", "-fmodules", "-gmodules", "-fmodules-cache-path=\(derivedData.str)/ModuleCache.noindex", "-fmodules-prune-interval=86400", "-fmodules-prune-after=345600", "-fbuild-session-file=\(derivedData.str)/ModuleCache.noindex/Session.modulevalidation", "-fmodules-validate-once-per-build-session", "-Wnon-modular-include-in-framework-module", "-Werror=non-modular-include-in-framework-module", /* non-module standard flags go here */ "-isysroot", core.loadSDK(.macOS).path.str, "-fasm-blocks", "-fstrict-aliasing", "-Wprotocol", "-Wdeprecated-declarations"], - ["-g", "-Wno-sign-conversion", "-Wno-infinite-recursion", "-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-target-headers.hmap", "-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-I\(products.str)/Debug/include", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/x86_64", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-F\(products.str)/Debug", "-MMD", "-MT", "dependencies", "-MF", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.d", "--serialize-diagnostics", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.dia", "-c", "\(SRCROOT)/Sources/SourceFile.m", "-o", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/SourceFile.o"] + ["-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)"], + ["-fmessage-length=0", "-fdiagnostics-show-note-include-stack", "-fmacro-backtrace-limit=0", "-fmodules", "-gmodules", "-fmodules-cache-path=\(derivedData.str)/ModuleCache.noindex", "-fmodules-prune-interval=86400", "-fmodules-prune-after=345600", "-fbuild-session-file=\(derivedData.str)/ModuleCache.noindex/Session.modulevalidation", "-fmodules-validate-once-per-build-session", "-Wnon-modular-include-in-framework-module", "-Werror=non-modular-include-in-framework-module", /* non-module standard flags go here */ "-isysroot", core.loadSDK(.macOS).path.str], ["-fstrict-aliasing", "-Wprotocol", "-Wdeprecated-declarations"], + ["-g", "-Wno-sign-conversion", "-Wno-infinite-recursion", "-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-target-headers.hmap", "-iquote", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-I\(products.str)/Debug/include", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-F\(products.str)/Debug", "-MMD", "-MT", "dependencies", "-MF", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.d", "--serialize-diagnostics", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.dia", "-c", "\(SRCROOT)/Sources/SourceFile.m", "-o", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o"] ].reduce([], +)) } // There should be one SwiftDriver task. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) - task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", targetName, "-O", "@\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName).SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", "-module-cache-path", "\(derivedData.str)/ModuleCache.noindex", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(products.str)/Debug", "-F", "\(products.str)/Debug", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName)-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName).swiftmodule", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I\(products.str)/Debug/include", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/x86_64", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName)-Swift.h", "-working-directory", SRCROOT]) + task.checkRuleInfo(["SwiftDriver Compilation", targetName, "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) + task.checkCommandLineContains([swiftCompilerPath.str, "-module-name", targetName, "-O", "@\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", "-module-cache-path", "\(derivedData.str)/ModuleCache.noindex", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(products.str)/Debug", "-F", "\(products.str)/Debug", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName)-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).swiftmodule", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-generated-files.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-own-target-headers.hmap", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(intermediates.str)/aProject.build/Debug/CoreFoo.build/CoreFoo-project-headers.hmap", "-Xcc", "-I\(products.str)/Debug/include", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(intermediates.str)/aProject.build/Debug/\(targetName).build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName)-Swift.h", "-working-directory", SRCROOT]) } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/x86_64/\(targetName).SwiftFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(intermediates.str)/aProject.build/Debug/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).SwiftFileList"])) { task, contents in let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == ["\(SRCROOT)/Sources/SwiftFile.swift", ""]) } @@ -4000,7 +4003,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { searchPaths.append(arg) } } - #expect(searchPaths == ["-iquote", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-generated-files.hmap", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-own-target-headers.hmap", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-all-target-headers.hmap", "-iquote", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-project-headers.hmap", "-I\(SRCROOT)/build/Debug/include", "-I/Local/Library/Headers", "-I../../Sources", "-isystem", "/System/Library/Include", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources-normal/x86_64", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources/x86_64", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources", "-F\(SRCROOT)/build/Debug", "-F/Local/Library/Frameworks", "-F/Local/Library/Frameworks", "-iframework", "/System/Library/PrivateFrameworks"]) + #expect(searchPaths == ["-iquote", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-generated-files.hmap", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-own-target-headers.hmap", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-all-target-headers.hmap", "-iquote", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-project-headers.hmap", "-I\(SRCROOT)/build/Debug/include", "-I/Local/Library/Headers", "-I../../Sources", "-isystem", "/System/Library/Include", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources/\(results.runDestinationTargetArchitecture)", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources", "-F\(SRCROOT)/build/Debug", "-F/Local/Library/Frameworks", "-F/Local/Library/Frameworks", "-iframework", "/System/Library/PrivateFrameworks"]) } // Check options in the swiftc command. @@ -4027,7 +4030,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { } } } - #expect(searchPaths == ["-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "/Local/Library/Frameworks", "-F", "/Local/Library/Frameworks", "-F", "/System/Library/PrivateFrameworks", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I/Local/Library/Headers", "-Xcc", "-I../../Sources", "-Xcc", "-isystem", "-Xcc", "/System/Library/Include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources"]) + #expect(searchPaths == ["-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "/Local/Library/Frameworks", "-F", "/Local/Library/Frameworks", "-F", "/System/Library/PrivateFrameworks", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/\(targetName)-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I/Local/Library/Headers", "-Xcc", "-I../../Sources", "-Xcc", "-isystem", "-Xcc", "/System/Library/Include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/DerivedSources"]) } // Check options in the link command. @@ -4116,13 +4119,13 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // There should be one CompileC task, which includes the ASan option, and which puts its output in a -asan directory. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=address", "-fsanitize-stable-abi", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/SourceFile.o"]) + task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/\(results.runDestinationTargetArchitecture)/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=address", "-fsanitize-stable-abi", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/\(results.runDestinationTargetArchitecture)/SourceFile.o"]) } //There should be no task to copy dylib. While testing for -fsanitize-stable-abi is a temporary test. This test should remain. results.checkNoTask(.matchTarget(target), .matchRuleType("Copy"), .matchRuleItemBasename("libclang_rt.asan_osx_dynamic.dylib")) results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-sanitize=address", "-sanitize-stable-abi", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/\(targetName)-OutputFileMap.json"]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-sanitize=address", "-sanitize-stable-abi", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/\(results.runDestinationTargetArchitecture)/\(targetName)-OutputFileMap.json"]) } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkCommandLineContains( @@ -4136,13 +4139,13 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // There should be one CompileC task, which includes the ASan option, and which puts its output in a -asan directory. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=address", "-D_LIBCPP_HAS_NO_ASAN", "-D_LIBCPP_HAS_ASAN=0", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/SourceFile.o"]) + task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/\(results.runDestinationTargetArchitecture)/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=address", "-D_LIBCPP_HAS_NO_ASAN", "-D_LIBCPP_HAS_ASAN=0", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/\(results.runDestinationTargetArchitecture)/SourceFile.o"]) } // There should be one CompileSwiftSources task, which includes the ASan option, and which puts its output in a -asan directory. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-sanitize=address", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/\(targetName)-OutputFileMap.json"]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-sanitize=address", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/\(results.runDestinationTargetArchitecture)/\(targetName)-OutputFileMap.json"]) } // There should be one Ld task. @@ -4270,13 +4273,13 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // There should be one CompileC task, which includes the TSan option, and which puts its output in a -tsan directory. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-tsan/x86_64/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=thread", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-tsan/x86_64/SourceFile.o"]) + task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-tsan/\(results.runDestinationTargetArchitecture)/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=thread", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-tsan/\(results.runDestinationTargetArchitecture)/SourceFile.o"]) } // There should be one CompileSwiftSources task, which includes the TSan option, and which puts its output in a -tsan directory. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-sanitize=thread", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-tsan/x86_64/\(targetName)-OutputFileMap.json"]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "-sanitize=thread", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-tsan/\(results.runDestinationTargetArchitecture)/\(targetName)-OutputFileMap.json"]) } // There should be one Ld task. @@ -4325,13 +4328,13 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { results.checkTarget(targetName) { target in // There should be one CompileC task, which includes the UBSan option, and which puts its output in a -ubsan directory. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in - task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-ubsan/x86_64/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=undefined", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-ubsan/x86_64/SourceFile.o"]) + task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-ubsan/\(results.runDestinationTargetArchitecture)/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=undefined", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-ubsan/\(results.runDestinationTargetArchitecture)/SourceFile.o"]) } // There should be one CompileSwiftSources task, which puts its output in a -ubsan directory. But the UBSan option is not passed for swift. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-ubsan/x86_64/\(targetName)-OutputFileMap.json"]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-ubsan/\(results.runDestinationTargetArchitecture)/\(targetName)-OutputFileMap.json"]) } // There should be one Ld task. @@ -5443,7 +5446,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { await tester.checkBuild(runDestination: .macOS) { results in results.checkTarget("Tool") { target in results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile"), .matchRuleItemBasename("Tool.LinkFileList")) { task, contents in - #expect(contents == "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/SourceFile.o\n/tmp/Test/aProject/build/Debug/ObjectFile1.o\n") + #expect(contents == "/tmp/Test/aProject/build/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/SourceFile.o\n/tmp/Test/aProject/build/Debug/ObjectFile1.o\n") task.checkCommandLineDoesNotContain("\(SRCROOT)/build/Debug/ObjectFile2.o") } } @@ -5512,10 +5515,10 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { await tester.checkBuild(runDestination: .macOS) { results in results.checkTarget("Tool") { target in results.checkTask(.matchTarget(target), .matchRuleType("CompileC"), .matchRuleItemBasename("File.c")) { task in - task.checkCommandLineContains(["\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/File-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path(SRCROOT).join("File.c"))).o"]) + task.checkCommandLineContains(["\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/File-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path(SRCROOT).join("File.c"))).o"]) } results.checkTask(.matchTarget(target), .matchRuleType("CompileC"), .matchRuleItemBasename("file.c")) { task in - task.checkCommandLineContains(["\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/x86_64/file-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path(SRCROOT).join("file.c"))).o"]) + task.checkCommandLineContains(["\(SRCROOT)/build/aProject.build/Debug/Tool.build/Objects-normal/\(results.runDestinationTargetArchitecture)/file-\(BuildPhaseWithBuildFiles.filenameUniquefierSuffixFor(path: Path(SRCROOT).join("file.c"))).o"]) } } } @@ -7234,7 +7237,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { // For Swift, we need to check the actual output files. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "AppTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "AppTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) // Make sure that no path in the outputs occurs more than once. let outputPaths = task.outputs.map({ $0.path }) diff --git a/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift index 74349f70..f818fbef 100644 --- a/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift @@ -132,16 +132,16 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { } results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in - task.checkRuleInfo(["SwiftDriver Compilation Requirements", "UnitTestTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation Requirements", "UnitTestTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) - task.checkCommandLineContains([[swiftCompilerPath.str, "-module-name", "UnitTestTarget", "-O", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-Swift.h", "-working-directory", SRCROOT]].reduce([], +)) + task.checkCommandLineContains([[swiftCompilerPath.str, "-module-name", "UnitTestTarget", "-O", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-Swift.h", "-working-directory", SRCROOT]].reduce([], +)) task.checkInputs([ .path("\(SRCROOT)/TestOne.swift"), .path("\(SRCROOT)/TestTwo.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget_const_extract_protocols.json"), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), @@ -153,26 +153,26 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget Swift Compilation Requirements Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftmodule"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftsourceinfo"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.abi.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-Swift.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftdoc"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget Swift Compilation Requirements Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftmodule"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftsourceinfo"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.abi.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-Swift.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftdoc"), ]) } results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "UnitTestTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "UnitTestTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) - task.checkCommandLineContains([[swiftCompilerPath.str, "-module-name", "UnitTestTarget", "-O", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-Swift.h", "-working-directory", SRCROOT]].reduce([], +)) + task.checkCommandLineContains([[swiftCompilerPath.str, "-module-name", "UnitTestTarget", "-O", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/UnitTestTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-Swift.h", "-working-directory", SRCROOT]].reduce([], +)) task.checkInputs([ .path("\(SRCROOT)/TestOne.swift"), .path("\(SRCROOT)/TestTwo.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget_const_extract_protocols.json"), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), @@ -185,33 +185,33 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget Swift Compilation Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/TestOne.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/TestTwo.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/TestOne.swiftconstvalues"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/TestTwo.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget Swift Compilation Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestTwo.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestTwo.swiftconstvalues"), ]) } - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-OutputFileMap.json"])) { task in + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-OutputFileMap.json"])) { task in task.checkInputs([ .namePattern(.and(.prefix("target-"), .suffix("-immediate")))]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-OutputFileMap.json"),]) + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-OutputFileMap.json"),]) } - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget_const_extract_protocols.json"])) { task in + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget_const_extract_protocols.json"])) { task in } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.SwiftFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.SwiftFileList"])) { task, contents in let inputFiles = ["\(SRCROOT)/TestOne.swift", "\(SRCROOT)/TestTwo.swift"] let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == inputFiles + [""]) } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.SwiftConstValuesFileList"])) { task, contents in - let inputFiles = ["\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/TestOne.swiftconstvalues", - "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/TestTwo.swiftconstvalues"] + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.SwiftConstValuesFileList"])) { task, contents in + let inputFiles = ["\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.swiftconstvalues", + "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestTwo.swiftconstvalues"] let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == inputFiles + [""]) } @@ -225,25 +225,25 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/UnitTestTarget.xctest/Contents/MacOS/UnitTestTarget", "normal"]) - task.checkCommandLineMatches(["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-bundle", "-isysroot", .equal(core.loadSDK(.macOS).path.str), "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-L\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/usr/lib", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-iframework", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", .anySequence, "-filelist", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftmodule", "-Xlinker", "-needed_framework", "-Xlinker", "XCTest", "-framework", "XCTest", "-Xlinker", "-needed-lXCTestSwiftSupport", "-lXCTestSwiftSupport", "-framework", "FrameworkTarget", "-o", "\(SRCROOT)/build/Debug/UnitTestTarget.xctest/Contents/MacOS/UnitTestTarget"]) + task.checkCommandLineMatches(["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-bundle", "-isysroot", .equal(core.loadSDK(.macOS).path.str), "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-L\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/usr/lib", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-iframework", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", .anySequence, "-filelist", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftmodule", "-Xlinker", "-needed_framework", "-Xlinker", "XCTest", "-framework", "XCTest", "-Xlinker", "-needed-lXCTestSwiftSupport", "-lXCTestSwiftSupport", "-framework", "FrameworkTarget", "-o", "\(SRCROOT)/build/Debug/UnitTestTarget.xctest/Contents/MacOS/UnitTestTarget"]) } // There should be a 'Copy' of the generated header. - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources/UnitTestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/DerivedSources/UnitTestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget-Swift.h"])) { _ in } // There should be a 'Copy' of the module file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.abi.json"])) { _ in } // There should be a 'swiftsourceinfo' of the module file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftsourceinfo"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftsourceinfo"])) { _ in } // There should be a 'Copy' of the doc file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/x86_64/UnitTestTarget.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTarget.swiftdoc"])) { _ in } // There should be the expected mkdir tasks for the test bundle. results.checkTasks(.matchTarget(target), .matchRuleType("MkDir"), body: { (tasks) -> Void in @@ -537,15 +537,15 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { } results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in - task.checkRuleInfo(["SwiftDriver Compilation Requirements", "UnitTestTargetOne", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation Requirements", "UnitTestTargetOne", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) - task.checkCommandLineContains(([[swiftCompilerPath.str, "-module-name", "UnitTestTargetOne", "-O", "@\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-Swift.h", "-working-directory", SRCROOT]] as [[String]]).reduce([], +)) + task.checkCommandLineContains(([[swiftCompilerPath.str, "-module-name", "UnitTestTargetOne", "-O", "@\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-Swift.h", "-working-directory", SRCROOT]] as [[String]]).reduce([], +)) task.checkInputs([ .path("\(SRCROOT)/TestOne.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne_const_extract_protocols.json"), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), @@ -557,26 +557,26 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne Swift Compilation Requirements Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne Swift Compilation Requirements Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftmodule"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftsourceinfo"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.abi.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-Swift.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftdoc"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftmodule"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftsourceinfo"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.abi.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-Swift.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftdoc"), ]) } results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "UnitTestTargetOne", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation", "UnitTestTargetOne", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) - task.checkCommandLineContains(([[swiftCompilerPath.str, "-module-name", "UnitTestTargetOne", "-O", "@\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-Swift.h", "-working-directory", SRCROOT]] as [[String]]).reduce([], +)) + task.checkCommandLineContains(([[swiftCompilerPath.str, "-module-name", "UnitTestTargetOne", "-O", "@\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-parse-as-library", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-Swift.h", "-working-directory", SRCROOT]] as [[String]]).reduce([], +)) task.checkInputs([ .path("\(SRCROOT)/TestOne.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne_const_extract_protocols.json"), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), .namePattern(.suffix(".hmap")), @@ -589,49 +589,49 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne Swift Compilation Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/TestOne.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/TestOne.swiftconstvalues") + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne Swift Compilation Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.swiftconstvalues") ]) testTargetCompileTasks.append(task) } - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-OutputFileMap.json"])) { task in + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-OutputFileMap.json"])) { task in task.checkInputs([ .namePattern(.and(.prefix("target-"), .suffix("-immediate")))]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-OutputFileMap.json"),]) + .path("\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-OutputFileMap.json"),]) } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.SwiftFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.SwiftFileList"])) { task, contents in let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == ["\(SRCROOT)/TestOne.swift", ""]) } // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/PlugIns/UnitTestTargetOne.xctest/Contents/MacOS/UnitTestTargetOne", "normal"]) - task.checkCommandLineMatches(["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-bundle", "-isysroot", .equal(core.loadSDK(.macOS).path.str), "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-L\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/usr/lib", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-iframework", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", .anySequence, "-filelist", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-rpath", "-Xlinker", "@executable_path/../Frameworks", "-bundle_loader", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftmodule", "-Xlinker", "-needed_framework", "-Xlinker", "XCTest", "-framework", "XCTest", "-Xlinker", "-needed-lXCTestSwiftSupport", "-lXCTestSwiftSupport", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/PlugIns/UnitTestTargetOne.xctest/Contents/MacOS/UnitTestTargetOne"]) + task.checkCommandLineMatches(["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-bundle", "-isysroot", .equal(core.loadSDK(.macOS).path.str), "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-L\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/usr/lib", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-iframework", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", .anySequence, "-filelist", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-rpath", "-Xlinker", "@executable_path/../Frameworks", "-bundle_loader", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/MacOS/AppTarget", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftmodule", "-Xlinker", "-needed_framework", "-Xlinker", "XCTest", "-framework", "XCTest", "-Xlinker", "-needed-lXCTestSwiftSupport", "-lXCTestSwiftSupport", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/PlugIns/UnitTestTargetOne.xctest/Contents/MacOS/UnitTestTargetOne"]) testTargetLinkTasks.append(task) } // There should be a 'Copy' of the generated header. - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources/UnitTestTargetOne-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources/UnitTestTargetOne-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-Swift.h"])) { _ in } // There should be a 'Copy' of the module file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftmodule"])) { _ in } // There should be a 'Copy' of the sourceinfo file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftsourceinfo"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftsourceinfo"])) { _ in } // There should be a 'Copy' of the doc file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftdoc"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.abi.json"])) { _ in } // There should be the expected mkdir tasks for the test bundle. @@ -716,9 +716,9 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { // There should be a 'Touch' task. results.checkTask(.matchTarget(target), .matchRule(["Touch", "\(SRCROOT)/build/Debug/AppTarget.app/Contents/PlugIns/UnitTestTargetOne.xctest"])) { _ in } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.SwiftConstValuesFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.SwiftConstValuesFileList"])) { task, contents in let lines = contents.asString.components(separatedBy: .newlines) - #expect(lines == ["\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/TestOne.swiftconstvalues", ""]) + #expect(lines == ["\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.swiftconstvalues", ""]) } results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/UnitTestTargetOne.DependencyMetadataFileList"])) { task, contents in @@ -747,11 +747,11 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in testTargetLinkTasks.append(task) } - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/DerivedSources/UnitTestTargetTwo-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo-Swift.h"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo.abi.json"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo.swiftsourceinfo"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/DerivedSources/UnitTestTargetTwo-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo.swiftsourceinfo"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo.swiftdoc"])) { _ in } results.checkTasks(.matchTarget(target), .matchRuleType("MkDir")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("CopySwiftLibs")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("ProcessProductPackaging"), .matchRuleItemPattern(.suffix(".xcent"))) { _ in } @@ -849,10 +849,10 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { results.checkTaskExists(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) results.checkTasks(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile")) { _ in } results.checkTaskExists(.matchTarget(target), .matchRuleType("Ld")) - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources/UnitTestTargetOne-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne-Swift.h"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.abi.json"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/x86_64/UnitTestTargetOne.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/DerivedSources/UnitTestTargetOne-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetOne.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetOne.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetOne.swiftdoc"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("CopySwiftLibs")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("SetOwnerAndGroup")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("SetMode")) { _ in } @@ -910,10 +910,10 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { results.checkTaskExists(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) results.checkTasks(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile")) { _ in } results.checkTaskExists(.matchTarget(target), .matchRuleType("Ld")) - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/DerivedSources/UnitTestTargetTwo-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo-Swift.h"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo.abi.json"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/x86_64/UnitTestTargetTwo.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/DerivedSources/UnitTestTargetTwo-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UnitTestTargetTwo.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UnitTestTargetTwo.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UnitTestTargetTwo.swiftdoc"])) { _ in } results.checkTasks(.matchTarget(target), .matchRuleType("MkDir")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("CopySwiftLibs")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("ProcessProductPackaging")) { _ in } @@ -1179,11 +1179,11 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { results.checkTaskExists(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) results.checkTasks(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile")) { _ in } results.checkTaskExists(.matchTarget(target), .matchRuleType("Ld")) - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/DerivedSources/\(targetName)-Swift.h", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/x86_64/\(targetName)-Swift.h"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/x86_64-apple-watchos-simulator.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/x86_64/\(targetName).swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/x86_64-apple-watchos-simulator.abi.json", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/x86_64/\(targetName).abi.json"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/Project/x86_64-apple-watchos-simulator.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/x86_64/\(targetName).swiftsourceinfo"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/x86_64-apple-watchos-simulator.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/x86_64/\(targetName).swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/DerivedSources/\(targetName)-Swift.h", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName)-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/\(results.runDestinationTargetArchitecture)-apple-watchos-simulator.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/\(results.runDestinationTargetArchitecture)-apple-watchos-simulator.abi.json", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-watchos-simulator.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).swiftsourceinfo"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-watchsimulator/\(targetName).swiftmodule/\(results.runDestinationTargetArchitecture)-apple-watchos-simulator.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug-watchsimulator/\(targetName).build/Objects-normal/\(results.runDestinationTargetArchitecture)/\(targetName).swiftdoc"])) { _ in } results.checkTasks(.matchTarget(target), .matchRuleType("MkDir")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("CopySwiftLibs")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("ProcessProductPackaging"), .matchRuleItemPattern(.suffix("UnitTestTarget.xctest.xcent"))) { _ in } @@ -2318,14 +2318,14 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { // There should be one Swift compile phase, and a task to generate its output file map. results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation")) { task in - task.checkRuleInfo(["SwiftDriver Compilation", "UITestTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) - task.checkCommandLineContains(([[swiftCompilerPath.str, "-module-name", "UITestTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources-normal/x86_64", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-Swift.h", "-working-directory", SRCROOT]] as [[String]]).reduce([], +)) + task.checkRuleInfo(["SwiftDriver Compilation", "UITestTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) + task.checkCommandLineContains(([[swiftCompilerPath.str, "-module-name", "UITestTarget", "-O", "@\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.SwiftFileList", "-sdk", core.loadSDK(.macOS).path.str, "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-g", /* options from the xcspec which sometimes change appear here */ "-swift-version", swiftVersion, "-I", "\(SRCROOT)/build/Debug", "-F", "\(SRCROOT)/build/Debug", "-F", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", "-c", "-j\(compilerParallelismLevel)", "-incremental", "-output-file-map", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-OutputFileMap.json", "-serialize-diagnostics", "-emit-dependencies", "-emit-module", "-emit-module-path", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftmodule", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/swift-overrides.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-generated-files.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-own-target-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-all-target-headers.hmap", "-Xcc", "-iquote", "-Xcc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-project-headers.hmap", "-Xcc", "-I\(SRCROOT)/build/Debug/include", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources-normal/\(results.runDestinationTargetArchitecture)", "-Xcc", "-I\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources", "-emit-objc-header", "-emit-objc-header-path", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-Swift.h", "-working-directory", SRCROOT]] as [[String]]).reduce([], +)) task.checkInputs([ .path("\(SRCROOT)/TestOne.swift"), .path("\(SRCROOT)/TestTwo.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget_const_extract_protocols.json"), .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-generated-files.hmap"), .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-own-target-headers.hmap"), .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-all-target-headers.hmap"), @@ -2338,22 +2338,22 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget Swift Compilation Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/TestOne.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/TestTwo.o"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/TestOne.swiftconstvalues"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/TestTwo.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget Swift Compilation Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestTwo.o"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.swiftconstvalues"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestTwo.swiftconstvalues"), ]) } results.checkTask(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) { task in - task.checkRuleInfo(["SwiftDriver Compilation Requirements", "UITestTarget", "normal", "x86_64", "com.apple.xcode.tools.swift.compiler"]) + task.checkRuleInfo(["SwiftDriver Compilation Requirements", "UITestTarget", "normal", results.runDestinationTargetArchitecture, "com.apple.xcode.tools.swift.compiler"]) task.checkInputs([ .path("\(SRCROOT)/TestOne.swift"), .path("\(SRCROOT)/TestTwo.swift"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.SwiftFileList"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-OutputFileMap.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget_const_extract_protocols.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.SwiftFileList"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-OutputFileMap.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget_const_extract_protocols.json"), .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-generated-files.hmap"), .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-own-target-headers.hmap"), .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/UITestTarget-all-target-headers.hmap"), @@ -2365,30 +2365,30 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { ]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget Swift Compilation Requirements Finished"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftmodule"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftsourceinfo"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.abi.json"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-Swift.h"), - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftdoc"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget Swift Compilation Requirements Finished"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftmodule"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftsourceinfo"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.abi.json"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-Swift.h"), + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftdoc"), ]) } - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-OutputFileMap.json"])) { task in + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-OutputFileMap.json"])) { task in task.checkInputs([ .namePattern(.and(.prefix("target-"), .suffix("-immediate")))]) task.checkOutputs([ - .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-OutputFileMap.json"),]) + .path("\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-OutputFileMap.json"),]) } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.SwiftFileList"])) { task, contents in + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.SwiftFileList"])) { task, contents in let inputFiles = ["\(SRCROOT)/TestOne.swift", "\(SRCROOT)/TestTwo.swift"] let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == inputFiles + [""]) } - results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.SwiftConstValuesFileList"])) { task, contents in - let inputFiles = ["\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/TestOne.swiftconstvalues", - "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/TestTwo.swiftconstvalues"] + results.checkWriteAuxiliaryFileTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.SwiftConstValuesFileList"])) { task, contents in + let inputFiles = ["\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestOne.swiftconstvalues", + "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/TestTwo.swiftconstvalues"] let lines = contents.asString.components(separatedBy: .newlines) #expect(lines == inputFiles + [""]) } @@ -2403,25 +2403,25 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { // There should be one link task, and a task to generate its link file list. - results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.LinkFileList"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["WriteAuxiliaryFile", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.LinkFileList"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("Ld")) { task in task.checkRuleInfo(["Ld", "\(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/PlugIns/UITestTarget.xctest/Contents/MacOS/UITestTarget", "normal"]) - task.checkCommandLineMatches(["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-bundle", "-isysroot", .equal(core.loadSDK(.macOS).path.str), "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-L\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/usr/lib", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-iframework", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", .anySequence, "-filelist", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftmodule", "-Xlinker", "-needed_framework", "-Xlinker", "XCTest", "-framework", "XCTest", "-Xlinker", "-needed-lXCTestSwiftSupport", "-lXCTestSwiftSupport", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/PlugIns/UITestTarget.xctest/Contents/MacOS/UITestTarget"]) + task.checkCommandLineMatches(["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(MACOSX_DEPLOYMENT_TARGET)", "-bundle", "-isysroot", .equal(core.loadSDK(.macOS).path.str), "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-L\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/usr/lib", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-iframework", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Frameworks", .anySequence, "-filelist", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.LinkFileList", "-Xlinker", "-rpath", "-Xlinker", "@loader_path/../Frameworks", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget_dependency_info.dat", "-fobjc-link-runtime", "-L\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx", "-L/usr/lib/swift", "-Xlinker", "-add_ast_path", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftmodule", "-Xlinker", "-needed_framework", "-Xlinker", "XCTest", "-framework", "XCTest", "-Xlinker", "-needed-lXCTestSwiftSupport", "-lXCTestSwiftSupport", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/PlugIns/UITestTarget.xctest/Contents/MacOS/UITestTarget"]) } // There should be a 'Copy' of the generated header. - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources/UITestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources/UITestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-Swift.h"])) { _ in } // There should be a 'Copy' of the module file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.abi.json"])) { _ in } // There should be a 'Copy' of the sourceinfo file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/Project/x86_64-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftsourceinfo"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-macos.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftsourceinfo"])) { _ in } // There should be a 'Copy' of the doc file. - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftdoc"])) { _ in } // There should be the expected mkdir tasks for the test bundle. @@ -2464,7 +2464,7 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { // Check selected tasks to copy the XCTRunner.app. results.checkTask(.matchTarget(target), .matchRule(["CopyAndPreserveArchs", "\(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/MacOS/UITestTarget-Runner"])) { task in - task.checkCommandLine(["lipo", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Xcode/Agents/XCTRunner.app/Contents/MacOS/XCTRunner", "-output", "\(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/MacOS/UITestTarget-Runner", "-extract", "x86_64"]) + task.checkCommandLine(["lipo", "\(core.developerPath.path.str)/Platforms/MacOSX.platform/Developer/Library/Xcode/Agents/XCTRunner.app/Contents/MacOS/XCTRunner", "-output", "\(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/MacOS/UITestTarget-Runner", "-extract", results.runDestinationTargetArchitecture]) task.checkOutputs([ .path("\(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/MacOS/UITestTarget-Runner"), .name("Copy \(SRCROOT)/build/Debug/UITestTarget-Runner.app/Contents/MacOS/UITestTarget-Runner"), @@ -2647,10 +2647,10 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { results.checkTaskExists(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) results.checkTasks(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile")) { _ in } results.checkTaskExists(.matchTarget(target), .matchRuleType("Ld")) - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources/UITestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget-Swift.h"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/x86_64-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/x86_64-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.abi.json"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/x86_64-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/DerivedSources/UITestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.abi.json", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-macos.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftdoc"])) { _ in } results.checkTasks(.matchTarget(target), .matchRuleType("MkDir"), body: { _ in }) results.checkTask(.matchTarget(target), .matchRuleType("CopySwiftLibs")) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("SetOwnerAndGroup")) { _ in } @@ -3150,11 +3150,11 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests { results.checkTaskExists(.matchTarget(target), .matchRuleType("SwiftDriver Compilation Requirements")) results.checkTasks(.matchTarget(target), .matchRuleType("WriteAuxiliaryFile")) { _ in } results.checkTaskExists(.matchTarget(target), .matchRuleType("Ld")) - results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/DerivedSources/UITestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/x86_64/UITestTarget-Swift.h"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/x86_64-apple-ios-simulator.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftmodule"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/x86_64-apple-ios-simulator.abi.json", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/x86_64/UITestTarget.abi.json"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftsourceinfo"])) { _ in } - results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/x86_64-apple-ios-simulator.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/x86_64/UITestTarget.swiftdoc"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["SwiftMergeGeneratedHeaders", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/DerivedSources/UITestTarget-Swift.h", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget-Swift.h"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-ios-simulator.swiftmodule", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftmodule"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-ios-simulator.abi.json", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.abi.json"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/Project/\(results.runDestinationTargetArchitecture)-apple-ios-simulator.swiftsourceinfo", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftsourceinfo"])) { _ in } + results.checkTask(.matchTarget(target), .matchRule(["Copy", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget.swiftmodule/\(results.runDestinationTargetArchitecture)-apple-ios-simulator.swiftdoc", "\(SRCROOT)/build/aProject.build/Debug-iphonesimulator/UITestTarget.build/Objects-normal/\(results.runDestinationTargetArchitecture)/UITestTarget.swiftdoc"])) { _ in } results.checkTask(.matchTarget(target), .matchRuleType("CopySwiftLibs")) { _ in } results.checkTask(.matchTarget(target), .matchRule(["Touch", "\(SRCROOT)/build/Debug-iphonesimulator/UITestTarget-Runner.app/PlugIns/UITestTarget.xctest"])) { _ in } diff --git a/Tests/SWBTaskConstructionTests/WatchTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/WatchTaskConstructionTests.swift index 367ba7ef..4bb83b9d 100644 --- a/Tests/SWBTaskConstructionTests/WatchTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/WatchTaskConstructionTests.swift @@ -642,10 +642,10 @@ fileprivate struct WatchTaskConstructionTests: CoreBasedTests { // There should be tasks to copy the watchOS stub into the app as its binary, and into the sidecar directory. results.checkTask(.matchTarget(target), .matchRuleType("CopyAndPreserveArchs"), .matchRuleItem("\(builtWatchAppPath)/Watchable WatchKit App")) { task in - task.checkCommandLine(["lipo", "\(core.loadSDK(.watchOSSimulator).path.str)/Library/Application Support/WatchKit/WK", "-output", "\(builtWatchAppPath)/Watchable WatchKit App", "-extract", "x86_64"]) + task.checkCommandLine(["lipo", "\(core.loadSDK(.watchOSSimulator).path.str)/Library/Application Support/WatchKit/WK", "-output", "\(builtWatchAppPath)/Watchable WatchKit App", "-extract", results.runDestinationTargetArchitecture]) } results.checkTask(.matchTarget(target), .matchRuleType("CopyAndPreserveArchs"), .matchRuleItem("\(builtWatchAppPath)/_WatchKitStub/WK")) { task in - task.checkCommandLine(["lipo", "\(core.loadSDK(.watchOSSimulator).path.str)/Library/Application Support/WatchKit/WK", "-output", "\(builtWatchAppPath)/_WatchKitStub/WK", "-extract", "x86_64"]) + task.checkCommandLine(["lipo", "\(core.loadSDK(.watchOSSimulator).path.str)/Library/Application Support/WatchKit/WK", "-output", "\(builtWatchAppPath)/_WatchKitStub/WK", "-extract", results.runDestinationTargetArchitecture]) } // There should be a task to embed the watchOS extension and another to validate it. diff --git a/Tests/SWBTaskConstructionTests/XCFrameworkTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/XCFrameworkTaskConstructionTests.swift index bd1601b4..0a4c0884 100644 --- a/Tests/SWBTaskConstructionTests/XCFrameworkTaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/XCFrameworkTaskConstructionTests.swift @@ -1148,7 +1148,7 @@ fileprivate struct XCFrameworkTaskConstructionTests: CoreBasedTests { results.checkTaskFollows(task, antecedent: try #require(processSupportXCFrameworkTask)) results.checkTaskFollows(task, antecedent: try #require(processExtrasXCFrameworkTask)) - task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-dynamiclib", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/lib1.build/Objects-normal/x86_64/lib1.LinkFileList", "-install_name", "/Library/Frameworks/lib1.framework/Versions/A/lib1", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/lib1.build/Objects-normal/x86_64/lib1_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/lib1.build/Objects-normal/x86_64/lib1_dependency_info.dat", "-framework", "Support", "-framework", "Extras", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/lib1.framework/Versions/A/lib1"]) + task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-dynamiclib", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/lib1.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib1.LinkFileList", "-install_name", "/Library/Frameworks/lib1.framework/Versions/A/lib1", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/lib1.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib1_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/lib1.build/Objects-normal/\(results.runDestinationTargetArchitecture)/lib1_dependency_info.dat", "-framework", "Support", "-framework", "Extras", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/lib1.framework/Versions/A/lib1"]) } } @@ -1158,7 +1158,7 @@ fileprivate struct XCFrameworkTaskConstructionTests: CoreBasedTests { results.checkTaskFollows(task, antecedent: try #require(processSupportXCFrameworkTask)) results.checkTaskFollows(task, antecedent: try #require(processExtrasXCFrameworkTask)) - task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "x86_64-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/App.build/Objects-normal/x86_64/App.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/App.build/Objects-normal/x86_64/App_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/App.build/Objects-normal/x86_64/App_dependency_info.dat", "-framework", "Support", "-framework", "Extras", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/App.app/Contents/MacOS/App"]) + task.checkCommandLine(["clang", "-Xlinker", "-reproducible", "-target", "\(results.runDestinationTargetArchitecture)-apple-macos\(core.loadSDK(.macOS).defaultDeploymentTarget)", "-isysroot", core.loadSDK(.macOS).path.str, "-Os", "-L\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-L\(SRCROOT)/build/Debug", "-F\(SRCROOT)/build/EagerLinkingTBDs/Debug", "-F\(SRCROOT)/build/Debug", "-filelist", "\(SRCROOT)/build/aProject.build/Debug/App.build/Objects-normal/\(results.runDestinationTargetArchitecture)/App.LinkFileList", "-Xlinker", "-object_path_lto", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/App.build/Objects-normal/\(results.runDestinationTargetArchitecture)/App_lto.o", "-Xlinker", "-dependency_info", "-Xlinker", "\(SRCROOT)/build/aProject.build/Debug/App.build/Objects-normal/\(results.runDestinationTargetArchitecture)/App_dependency_info.dat", "-framework", "Support", "-framework", "Extras", "-Xlinker", "-no_adhoc_codesign", "-o", "\(SRCROOT)/build/Debug/App.app/Contents/MacOS/App"]) } } diff --git a/Tests/SWBTaskExecutionTests/ProcessProductEntitlementsTaskActionTests.swift b/Tests/SWBTaskExecutionTests/ProcessProductEntitlementsTaskActionTests.swift index 0ff0f27f..27a66ec7 100644 --- a/Tests/SWBTaskExecutionTests/ProcessProductEntitlementsTaskActionTests.swift +++ b/Tests/SWBTaskExecutionTests/ProcessProductEntitlementsTaskActionTests.swift @@ -39,16 +39,12 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { /// - Parameter commandLine: array of passed command line arguments, first one is the programs name /// - Parameter expected: the returned status code of the task action that is expected for the given input /// - Parameter checkOutput: optional handler to check emitted output - func testPerformTaskAction(commandLine: [String], expected expectedResult: CommandResult, entitlementsVariant: EntitlementsVariant = .signed, destinationPlatformName: String = "platformname", schemeCommand: SchemeCommand = .launch, buildSettings: ((inout MacroValueAssignmentTable, MacroNamespace) throws -> Void)? = nil, modifications: (() throws -> Void)? = nil, checkOutput: ((MockTaskOutputDelegate) throws -> Void)? = nil) async rethrows { - let namespace = MacroNamespace(parent: BuiltinMacros.namespace, debugDescription: #function) - var table = MacroValueAssignmentTable(namespace: namespace) - try buildSettings?(&table, namespace) - let scope = MacroEvaluationScope(table: table) - - let action = ProcessProductEntitlementsTaskAction(scope: scope, - fs: fs, + func testPerformTaskAction(commandLine: [String], expected expectedResult: CommandResult, entitlementsVariant: EntitlementsVariant = .signed, allowEntitlementsModification: Bool = false, entitlementsDestination: EntitlementsDestination = .none, destinationPlatformName: String = "platformname", schemeCommand: SchemeCommand = .launch, modifications: (() throws -> Void)? = nil, checkOutput: ((MockTaskOutputDelegate) throws -> Void)? = nil) async rethrows { + let action = ProcessProductEntitlementsTaskAction(fs: fs, entitlements: entitlements, entitlementsVariant: entitlementsVariant, + allowEntitlementsModification: allowEntitlementsModification, + entitlementsDestination: entitlementsDestination, destinationPlatformName: destinationPlatformName, entitlementsFilePath: entitlementsPath) @@ -98,7 +94,7 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { // No error if we opt out try await testPerformTaskAction(commandLine: ["programName", "-entitlements", "-o", "/temp/foobar.output"], expected: .succeeded, - buildSettings: { table, namespace in table.push(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION, namespace.parseLiteralString("YES")) }, + allowEntitlementsModification: true, modifications: { try fs.write(entitlementsPath, contents: ByteString(PropertyListItem.plDict(["key": .plString("value2")]).asBytes(.xml))) }, checkOutput: { output in #expect(output.warnings.isEmpty, "Warnings shouldn't be emitted") @@ -110,10 +106,8 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { try await testPerformTaskAction(commandLine: ["programName", "-entitlements", "-o", "/temp/foobar.output"], expected: .succeeded, entitlementsVariant: .signed, - buildSettings: { table, namespace in - table.push(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION, namespace.parseLiteralString("YES")) - table.push(BuiltinMacros.ENTITLEMENTS_DESTINATION, namespace.parseLiteralString("__entitlements")) - }, + allowEntitlementsModification: true, + entitlementsDestination: .entitlementsSection, modifications: { try fs.write(entitlementsPath, contents: ByteString(PropertyListItem.plDict(["key": .plString("value2")]).asBytes(.xml))) }, checkOutput: { output in #expect(output.warnings.isEmpty, "Warnings shouldn't be emitted") @@ -125,10 +119,8 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { try await testPerformTaskAction(commandLine: ["programName", "-entitlements", "-o", "/temp/foobar.output"], expected: .succeeded, entitlementsVariant: .signed, - buildSettings: { table, namespace in - table.push(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION, namespace.parseLiteralString("YES")) - table.push(BuiltinMacros.ENTITLEMENTS_DESTINATION, namespace.parseLiteralString("Signature")) - }, + allowEntitlementsModification: true, + entitlementsDestination: .codeSignature, modifications: { try fs.write(entitlementsPath, contents: ByteString(PropertyListItem.plDict(["key": .plString("value2")]).asBytes(.xml))) }, checkOutput: { output in #expect(output.warnings.isEmpty, "Warnings shouldn't be emitted") @@ -140,10 +132,8 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { try await testPerformTaskAction(commandLine: ["programName", "-entitlements", "-o", "/temp/foobar.output"], expected: .succeeded, entitlementsVariant: .simulated, - buildSettings: { table, namespace in - table.push(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION, namespace.parseLiteralString("YES")) - table.push(BuiltinMacros.ENTITLEMENTS_DESTINATION, namespace.parseLiteralString("__entitlements")) - }, + allowEntitlementsModification: true, + entitlementsDestination: .entitlementsSection, modifications: { try fs.write(entitlementsPath, contents: ByteString(PropertyListItem.plDict(["key": .plString("value2")]).asBytes(.xml))) }, checkOutput: { output in #expect(output.warnings.isEmpty, "Warnings shouldn't be emitted") @@ -153,10 +143,8 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { try await testPerformTaskAction(commandLine: ["programName", "-entitlements", "-o", "/temp/foobar.output"], expected: .succeeded, entitlementsVariant: .simulated, - buildSettings: { table, namespace in - table.push(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION, namespace.parseLiteralString("YES")) - table.push(BuiltinMacros.ENTITLEMENTS_DESTINATION, namespace.parseLiteralString("Signature")) - }, + allowEntitlementsModification: true, + entitlementsDestination: .codeSignature, modifications: { try fs.write(entitlementsPath, contents: ByteString(PropertyListItem.plDict(["key": .plString("value2")]).asBytes(.xml))) }, checkOutput: { output in #expect(output.warnings.isEmpty, "Warnings shouldn't be emitted") @@ -168,10 +156,8 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { try await testPerformTaskAction(commandLine: ["programName", "-entitlements", "-o", "/temp/foobar.output"], expected: .succeeded, entitlementsVariant: .simulated, - buildSettings: { table, namespace in - table.push(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION, namespace.parseLiteralString("YES")) - table.push(BuiltinMacros.ENTITLEMENTS_DESTINATION, namespace.parseLiteralString("")) - }, + allowEntitlementsModification: true, + entitlementsDestination: .none, modifications: { try fs.write(entitlementsPath, contents: ByteString(PropertyListItem.plDict(["key": .plString("value2")]).asBytes(.xml))) }, checkOutput: { output in #expect(output.warnings.isEmpty, "Warnings shouldn't be emitted") @@ -181,10 +167,8 @@ fileprivate struct ProcessProductEntitlementsTaskActionTests { try await testPerformTaskAction(commandLine: ["programName", "-entitlements", "-o", "/temp/foobar.output"], expected: .succeeded, entitlementsVariant: .signed, - buildSettings: { table, namespace in - table.push(BuiltinMacros.CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION, namespace.parseLiteralString("YES")) - table.push(BuiltinMacros.ENTITLEMENTS_DESTINATION, namespace.parseLiteralString("")) - }, + allowEntitlementsModification: true, + entitlementsDestination: .none, modifications: { try fs.write(entitlementsPath, contents: ByteString(PropertyListItem.plDict(["key": .plString("value2")]).asBytes(.xml))) }, checkOutput: { output in #expect(output.warnings.isEmpty, "Warnings shouldn't be emitted") diff --git a/Tests/SWBTaskExecutionTests/ProcessProductPackagingTaskTests.swift b/Tests/SWBTaskExecutionTests/ProcessProductPackagingTaskTests.swift index 8433f549..92403287 100644 --- a/Tests/SWBTaskExecutionTests/ProcessProductPackagingTaskTests.swift +++ b/Tests/SWBTaskExecutionTests/ProcessProductPackagingTaskTests.swift @@ -29,10 +29,7 @@ fileprivate struct ProcessProductEntitlementsTaskTests { func diagnostics() async { func checkDiagnostics(_ commandLine: [String], errors: [String] = [], warnings: [String] = [], notes: [String] = [], sourceLocation: SourceLocation = #_sourceLocation) async { - let namespace = MacroNamespace(parent: BuiltinMacros.namespace, debugDescription: #function) - let table = MacroValueAssignmentTable(namespace: namespace) - let scope = MacroEvaluationScope(table: table) - let action = ProcessProductEntitlementsTaskAction(scope: scope, fs: PseudoFS(), entitlements: .plDict([:]), entitlementsVariant: .signed, destinationPlatformName: "iphoneos", entitlementsFilePath: nil) + let action = ProcessProductEntitlementsTaskAction(fs: PseudoFS(), entitlements: .plDict([:]), entitlementsVariant: .signed, allowEntitlementsModification: false, entitlementsDestination: .none, destinationPlatformName: "iphoneos", entitlementsFilePath: nil) let task = Task(forTarget: nil, ruleInfo: [], commandLine: commandLine, workingDirectory: Path(""), action: action) let executionDelegate = MockExecutionDelegate() let outputDelegate = MockTaskOutputDelegate() @@ -87,17 +84,11 @@ fileprivate struct ProcessProductEntitlementsTaskTests { let entitlements = PropertyListItem(entitlementsData) - // Create a MacroEvaluationScope for the tool to use to evaluate build settings. - let namespace = MacroNamespace(parent: BuiltinMacros.namespace, debugDescription: "testEntitlementsBasics()") - let table = MacroValueAssignmentTable(namespace: namespace) - // Any overrides desired should be pushed here. - let scope = MacroEvaluationScope(table: table) - // Define the location of the output file. let output = Path.root.join("dst/iOSApp.app.xcent") try executionDelegate.fs.createDirectory(output.dirname) - let action = ProcessProductEntitlementsTaskAction(scope: scope, fs: PseudoFS(), entitlements: entitlements, entitlementsVariant: .signed, destinationPlatformName: "iphoneos", entitlementsFilePath: nil) + let action = ProcessProductEntitlementsTaskAction(fs: PseudoFS(), entitlements: entitlements, entitlementsVariant: .signed, allowEntitlementsModification: false, entitlementsDestination: .none, destinationPlatformName: "iphoneos", entitlementsFilePath: nil) var builder = PlannedTaskBuilder(type: mockTaskType, ruleInfo: [], commandLine: ["productPackagingUtility", "-entitlements", "-format", "xml", input.str, "-o", output.str].map{ .literal(ByteString(encodingAsUTF8: $0)) }) let task = Task(&builder) let result = await action.performTaskAction( @@ -181,16 +172,11 @@ fileprivate struct ProcessProductEntitlementsTaskTests { ], ].merging(additionalEntitlements) { (_, new) in new } - // Create a MacroEvaluationScope for the tool to use to evaluate build settings. - let namespace = MacroNamespace(parent: BuiltinMacros.namespace, debugDescription: "testEntitlementsBasics()") - let table = MacroValueAssignmentTable(namespace: namespace) - let scope = MacroEvaluationScope(table: table) - // Define the location of the output file. let output = Path.root.join("dst/macOSApp.app.xcent") try executionDelegate.fs.createDirectory(output.dirname) - let action = ProcessProductEntitlementsTaskAction(scope: scope, fs: PseudoFS(), entitlements: .plDict(entitlements), entitlementsVariant: .signed, destinationPlatformName: destinationPlatformName, entitlementsFilePath: nil) + let action = ProcessProductEntitlementsTaskAction(fs: PseudoFS(), entitlements: .plDict(entitlements), entitlementsVariant: .signed, allowEntitlementsModification: false, entitlementsDestination: .none, destinationPlatformName: destinationPlatformName, entitlementsFilePath: nil) var builder = PlannedTaskBuilder(type: mockTaskType, ruleInfo: [], commandLine: ["productPackagingUtility", "-entitlements", "-format", "xml", input.str, "-o", output.str].map{ .literal(ByteString(encodingAsUTF8: $0)) }) let task = Task(&builder) let result = await action.performTaskAction( diff --git a/Tests/SWBUtilTests/FSProxyTests.swift b/Tests/SWBUtilTests/FSProxyTests.swift index bc30b942..2b69e22f 100644 --- a/Tests/SWBUtilTests/FSProxyTests.swift +++ b/Tests/SWBUtilTests/FSProxyTests.swift @@ -18,9 +18,9 @@ import SWBTestSupport @_spi(TestSupport) import SWBUtil #if canImport(System) -public import System +import System #else -public import SystemPackage +import SystemPackage #endif @Suite fileprivate struct FSProxyTests { diff --git a/Tests/SwiftBuildTests/AppClipsTests.swift b/Tests/SwiftBuildTests/AppClipsTests.swift index 3638d137..603db8dc 100644 --- a/Tests/SwiftBuildTests/AppClipsTests.swift +++ b/Tests/SwiftBuildTests/AppClipsTests.swift @@ -114,7 +114,10 @@ fileprivate struct AppClipsTests: CoreBasedTests { results.checkError(.equal("App Clips are not available when building for Mac Catalyst.")) results.checkNoFailedTasks() } else { - results.checkError(.equal("Your target is built for macOS but contains embedded content built for the iOS platform (BarClip.app), which is not allowed.")) + results.checkError(.or( + .prefix("Your target is built for macOS but contains embedded content built for the iOS platform (BarClip.app), which is not allowed."), + .prefix("This target is built for macOS but contains embedded content (BarClip.app) built for iOS, which is not allowed.") + )) } results.checkNoDiagnostics() } diff --git a/Tests/SwiftBuildTests/IndexingInfoTests.swift b/Tests/SwiftBuildTests/IndexingInfoTests.swift index 575ca27a..07ef77b4 100644 --- a/Tests/SwiftBuildTests/IndexingInfoTests.swift +++ b/Tests/SwiftBuildTests/IndexingInfoTests.swift @@ -213,7 +213,7 @@ fileprivate struct IndexingInfoTests: CoreBasedTests { let expectedPath = Path("\(projectFilesDir)/Source.c") await results.checkIndexingInfo(.matchSourceFilePath(expectedPath)) { info in info.checkSourceFilePath(expectedPath) - info.checkOutputFilePath(Path("\(projectDir)/build/aProject.build/Config1/Target1.build/Objects-normal/x86_64/Source.o")) + info.checkOutputFilePath(Path("\(projectDir)/build/aProject.build/Config1/Target1.build/Objects-normal/\(RunDestinationInfo.macOS.targetArchitecture)/Source.o")) // We should _only_ have the output (and source) file paths due to the `outputPathOnly` flag, no other keys. info.checkNoUnmatchedKeys() @@ -231,7 +231,7 @@ fileprivate struct IndexingInfoTests: CoreBasedTests { let expectedPath = Path("\(projectFilesDir)/Source.c") await results.checkIndexingInfo(.matchSourceFilePath(expectedPath)) { info in info.checkSourceFilePath(expectedPath) - info.checkOutputFilePath(Path("\(projectDir)/build/aProject.build/Config1/Target1.build/Objects-normal/x86_64/Source.o")) + info.checkOutputFilePath(Path("\(projectDir)/build/aProject.build/Config1/Target1.build/Objects-normal/\(RunDestinationInfo.macOS.targetArchitecture)/Source.o")) // We should _only_ have the output (and source) file paths due to the `outputPathOnly` flag, no other keys. info.checkNoUnmatchedKeys() @@ -242,7 +242,7 @@ fileprivate struct IndexingInfoTests: CoreBasedTests { let expectedPath = Path("\(projectFilesDir)/Source2.c") await results.checkIndexingInfo(.matchSourceFilePath(expectedPath)) { info in info.checkSourceFilePath(expectedPath) - info.checkOutputFilePath(Path("\(projectDir)/build/aProject.build/Config1/Target1.build/Objects-normal/x86_64/Source2.o")) + info.checkOutputFilePath(Path("\(projectDir)/build/aProject.build/Config1/Target1.build/Objects-normal/\(RunDestinationInfo.macOS.targetArchitecture)/Source2.o")) // We should _only_ have the output (and source) file paths due to the `outputPathOnly` flag, no other keys. info.checkNoUnmatchedKeys()