diff --git a/.github/scripts/format-check.sh b/.github/scripts/format-check.sh
new file mode 100755
index 00000000..6c515276
--- /dev/null
+++ b/.github/scripts/format-check.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+##===----------------------------------------------------------------------===##
+##
+## 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
+##
+##===----------------------------------------------------------------------===##
+
+set -euo pipefail
+
+fail=0
+
+while IFS= read -r file; do
+ # Skip empty or binary files
+ if [ ! -s "$file" ] || [[ "$file" == *png ]] || [[ "$file" == *mlmodel ]] || [[ "$file" == *mlpackage* ]] ; then
+ continue
+ fi
+
+ # --- Check for trailing whitespace (spaces or tabs before end of line) ---
+ # Using POSIX-compatible regex; no -P flag needed.
+ if grep -nE '[[:space:]]+$' "$file" >/dev/null; then
+ echo "❌ Trailing whitespace in: $file"
+ # Print offending lines (indent for readability)
+ grep -nE '[[:space:]]+$' "$file" | sed 's/^/ /'
+ fail=1
+ fi
+
+ # --- Check for final newline ---
+ # tail -c handles both GNU and BSD variants
+ lastchar=$(tail -c 1 "$file" | od -An -tx1 | tr -d ' \n')
+ if [[ "$lastchar" != "0a" ]]; then
+ echo "❌ Missing final newline: $file"
+ fail=1
+ fi
+
+done < <(git ls-files)
+
+if [[ $fail -eq 0 ]]; then
+ echo "✅ All tracked files are clean (no trailing whitespace, final newline present)."
+else
+ echo "⚠️ Some files failed checks."
+ exit 1
+fi
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index a9bc56eb..2d88f56c 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -54,3 +54,13 @@ jobs:
license_header_check_project_name: "Swift"
api_breakage_check_enabled: false
format_check_enabled: false
+
+ space-format-check:
+ name: Space format check
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ - name: Run space format check
+ run: cat .github/scripts/format-check.sh | bash
diff --git a/.swift-version b/.swift-version
index 4ac4fded..6abaeb2f 100644
--- a/.swift-version
+++ b/.swift-version
@@ -1 +1 @@
-6.2.0
\ No newline at end of file
+6.2.0
diff --git a/Plugins/generate-windows-installer-component-groups/generate-windows-installer-component-groups.swift b/Plugins/generate-windows-installer-component-groups/generate-windows-installer-component-groups.swift
index 76899ac1..a2b4150f 100644
--- a/Plugins/generate-windows-installer-component-groups/generate-windows-installer-component-groups.swift
+++ b/Plugins/generate-windows-installer-component-groups/generate-windows-installer-component-groups.swift
@@ -28,7 +28,7 @@ struct GenerateWindowsInstallerComponentGroups: CommandPlugin {
-
+
"""#
let resources = sourceModule.sourceFiles.filter { resource in resource.type == .resource && ["xcspec", "xcbuildrules"].contains(resource.url.pathExtension) }
@@ -41,7 +41,7 @@ struct GenerateWindowsInstallerComponentGroups: CommandPlugin {
-
+
"""#
}
resourcesComponents += " \n"
diff --git a/Sources/SWBAndroidPlatform/AndroidSDK.swift b/Sources/SWBAndroidPlatform/AndroidSDK.swift
index 249b64cd..f5342ed9 100644
--- a/Sources/SWBAndroidPlatform/AndroidSDK.swift
+++ b/Sources/SWBAndroidPlatform/AndroidSDK.swift
@@ -108,11 +108,11 @@ public import Foundation
init(from decoder: any Decoder, configuration: Version) throws {
struct DynamicCodingKey: CodingKey {
var stringValue: String
-
+
init?(stringValue: String) {
self.stringValue = stringValue
}
-
+
let intValue: Int? = nil
init?(intValue: Int) {
diff --git a/Sources/SWBApplePlatform/EXUtil.swift b/Sources/SWBApplePlatform/EXUtil.swift
index d1a82063..86fb6679 100644
--- a/Sources/SWBApplePlatform/EXUtil.swift
+++ b/Sources/SWBApplePlatform/EXUtil.swift
@@ -46,7 +46,7 @@ final class ExtensionPointExtractorSpec: GenericCommandLineToolSpec, SpecIdentif
let inputs = cbc.inputs.map { input in
return delegate.createNode(input.absolutePath)
}.filter { node in
- node.path.fileExtension == "swiftconstvalues"
+ node.path.fileExtension == "swiftconstvalues"
}
var outputs = [any PlannedNode]()
diff --git a/Sources/SWBApplePlatform/ExtensionPointExtractorTaskProducer.swift b/Sources/SWBApplePlatform/ExtensionPointExtractorTaskProducer.swift
index 9a37cbe1..e842bdb9 100644
--- a/Sources/SWBApplePlatform/ExtensionPointExtractorTaskProducer.swift
+++ b/Sources/SWBApplePlatform/ExtensionPointExtractorTaskProducer.swift
@@ -126,7 +126,7 @@ final class AppExtensionInfoPlistGeneratorTaskProducer: PhasedTaskProducer, Task
let isApplePlatform = context.isApplePlatform
guard AppExtensionPlistGeneratorSpec.shouldConstructTask(scope: scope, productType: productType, isApplePlatform: isApplePlatform) else {
return []
- }
+ }
let tasks: [any PlannedTask] = []
let buildFilesProcessingContext = BuildFilesProcessingContext(scope)
diff --git a/Sources/SWBBuildService/Messages.swift b/Sources/SWBBuildService/Messages.swift
index d014b03c..0c6cd516 100644
--- a/Sources/SWBBuildService/Messages.swift
+++ b/Sources/SWBBuildService/Messages.swift
@@ -1622,7 +1622,7 @@ package struct ServiceMessageHandlers: ServiceExtension {
service.registerMessageHandler(ComputeDependencyClosureMsg.self)
service.registerMessageHandler(ComputeDependencyGraphMsg.self)
service.registerMessageHandler(DumpBuildDependencyInfoMsg.self)
-
+
service.registerMessageHandler(BuildDescriptionConfiguredTargetsMsg.self)
service.registerMessageHandler(BuildDescriptionSelectConfiguredTargetsForIndexMsg.self)
service.registerMessageHandler(BuildDescriptionConfiguredTargetSourcesMsg.self)
diff --git a/Sources/SWBBuildSystem/BuildOperation.swift b/Sources/SWBBuildSystem/BuildOperation.swift
index 88543fe2..8129e0aa 100644
--- a/Sources/SWBBuildSystem/BuildOperation.swift
+++ b/Sources/SWBBuildSystem/BuildOperation.swift
@@ -474,7 +474,7 @@ package final class BuildOperation: BuildSystemOperation {
// Create the low-level build system.
let adaptor: OperationSystemAdaptor
let system: BuildSystem
-
+
let llbQoS: SWBLLBuild.BuildSystem.QualityOfService?
switch request.qos {
case .default: llbQoS = .default
diff --git a/Sources/SWBCore/CustomTaskTypeDescription.swift b/Sources/SWBCore/CustomTaskTypeDescription.swift
index e94df0cd..ee15c9a8 100644
--- a/Sources/SWBCore/CustomTaskTypeDescription.swift
+++ b/Sources/SWBCore/CustomTaskTypeDescription.swift
@@ -13,48 +13,48 @@
public import SWBUtil
public final class CustomTaskTypeDescription: TaskTypeDescription {
-
+
private init() {
}
-
+
public static let only: any TaskTypeDescription = CustomTaskTypeDescription()
-
+
public var payloadType: (any TaskPayload.Type)? {
nil
}
-
+
public var isUnsafeToInterrupt: Bool {
false
}
-
+
public var toolBasenameAliases: [String] {
[]
}
-
+
public func commandLineForSignature(for task: any ExecutableTask) -> [ByteString]? {
return nil
}
-
+
public func serializedDiagnosticsPaths(_ task: any ExecutableTask, _ fs: any FSProxy) -> [Path] {
[]
}
-
+
public func generateIndexingInfo(for task: any ExecutableTask, input: TaskGenerateIndexingInfoInput) -> [TaskGenerateIndexingInfoOutput] {
[]
}
-
+
public func generatePreviewInfo(for task: any ExecutableTask, input: TaskGeneratePreviewInfoInput, fs: any FSProxy) -> [TaskGeneratePreviewInfoOutput] {
[]
}
-
+
public func generateDocumentationInfo(for task: any ExecutableTask, input: TaskGenerateDocumentationInfoInput) -> [TaskGenerateDocumentationInfoOutput] {
[]
}
-
+
public func customOutputParserType(for task: any ExecutableTask) -> (any TaskOutputParser.Type)? {
ShellScriptOutputParser.self
}
-
+
public func interestingPath(for task: any ExecutableTask) -> Path? {
nil
}
diff --git a/Sources/SWBCore/ShellScript.swift b/Sources/SWBCore/ShellScript.swift
index 77191e9e..2c42f82f 100644
--- a/Sources/SWBCore/ShellScript.swift
+++ b/Sources/SWBCore/ShellScript.swift
@@ -153,7 +153,7 @@ public func computeScriptEnvironment(_ type: ScriptType, scope: MacroEvaluationS
for macro in alwaysPresentPathMacros {
result[macro.name] = scope.evaluate(macro).str
}
-
+
for macro in [BuiltinMacros.BUILD_COMPONENTS, BuiltinMacros.BUILD_VARIANTS] {
result[macro.name] = scope.evaluateAsString(macro)
}
diff --git a/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift b/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift
index 6e8bdf85..8c8e6bc3 100644
--- a/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift
+++ b/Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift
@@ -183,7 +183,7 @@ public struct DiscoveredLdLinkerToolSpecInfo: DiscoveredCommandLineToolSpecInfo
// Any unparsed bytes belong to the first line. We don't want to run `split` over these because it can lead to accidentally quadratic behavior if write is called many times per line.
lines[0] = unparsedBytes + lines[0]
-
+
let linesToParse = lines.dropLast()
if let target = self.task.forTarget?.target {
@@ -203,13 +203,13 @@ public struct DiscoveredLdLinkerToolSpecInfo: DiscoveredCommandLineToolSpecInfo
let lineString = String(decoding: lineBytes, as: Unicode.UTF8.self)
if lineString.contains(": error:")
|| lineString.contains(": warning:") {
-
+
let issueString = "\(projectPath.str): \(targetName): \(lineString)"
return ByteString(encodingAsUTF8: issueString)
}
return ByteString(lineBytes)
}
-
+
// Forward the bytes
processedLines.forEach {
delegate.emitOutput($0)
@@ -223,12 +223,12 @@ public struct DiscoveredLdLinkerToolSpecInfo: DiscoveredCommandLineToolSpecInfo
delegate.emitOutput("\n")
}
}
-
+
// Parse any complete lines of output.
for line in linesToParse {
parseLine(line)
}
-
+
// Track the last, incomplete line to as the unparsed bytes.
unparsedBytes = lines.last ?? []
}
@@ -809,7 +809,7 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
func emitDependencyDiagnostic(type: String, node: PlannedPathNode) {
if delegate.userPreferences.enableDebugActivityLogs {
let projectLocation = cbc.producer.projectLocation
-
+
delegate.note("Added \(type) dependency '\(node.path.str)' from command line argument \(arg)", location: projectLocation)
}
}
diff --git a/Sources/SWBCore/SwiftSDK.swift b/Sources/SWBCore/SwiftSDK.swift
index 51bf0003..c8f7f43f 100644
--- a/Sources/SWBCore/SwiftSDK.swift
+++ b/Sources/SWBCore/SwiftSDK.swift
@@ -122,7 +122,7 @@ public struct SwiftSDK: Sendable {
// Load info.json from the artifact bundle
let infoPath = artifactBundle.join("info.json")
guard try fs.isFile(infoPath) else { return [] }
-
+
let infoData = try Data(fs.read(infoPath))
let schema = try JSONDecoder().decode(SchemaVersionInfo.self, from: infoData)
diff --git a/Sources/SWBCore/ToolInfo/ClangToolInfo.swift b/Sources/SWBCore/ToolInfo/ClangToolInfo.swift
index c8b20017..4e4ba77d 100644
--- a/Sources/SWBCore/ToolInfo/ClangToolInfo.swift
+++ b/Sources/SWBCore/ToolInfo/ClangToolInfo.swift
@@ -74,7 +74,7 @@ public struct DiscoveredClangToolSpecInfo: DiscoveredCommandLineToolSpecInfo {
public var toolFeatures: ToolFeatures
public func hasFeature(_ feature: String) -> Bool {
// FIXME: Remove once the feature flag is re-added to clang.
- // rdar://139515136
+ // rdar://139515136
if feature == FeatureFlag.extractAPISupportsCPlusPlus.rawValue {
return clangVersion > Version(17)
}
diff --git a/Sources/SWBLLBuild/LowLevelBuildSystem.swift b/Sources/SWBLLBuild/LowLevelBuildSystem.swift
index d23d6f98..42487c84 100644
--- a/Sources/SWBLLBuild/LowLevelBuildSystem.swift
+++ b/Sources/SWBLLBuild/LowLevelBuildSystem.swift
@@ -27,7 +27,7 @@ extension SWBUtil.FileInfo: SWBLLBuild.FileInfo {
// This should be remove from llbuild FileInfo protocol as it just not needed, would also be nice to remove the stat requirement too.
preconditionFailure()
}
-
+
public var statBuf: stat {
var statBuf: stat = stat()
diff --git a/Sources/SWBProtocol/BuildOperationMessages.swift b/Sources/SWBProtocol/BuildOperationMessages.swift
index 9f964ebd..2f7c774d 100644
--- a/Sources/SWBProtocol/BuildOperationMessages.swift
+++ b/Sources/SWBProtocol/BuildOperationMessages.swift
@@ -286,7 +286,7 @@ public struct CreateBuildRequest: SessionChannelBuildMessage, RequestMessage, Se
public struct BuildStartRequest: SessionMessage, RequestMessage, Equatable {
public typealias ResponseMessage = VoidResponse
-
+
public static let name = "BUILD_START"
/// The identifier for the session to initiate the request in.
diff --git a/Sources/SWBProtocol/DependencyClosureMessages.swift b/Sources/SWBProtocol/DependencyClosureMessages.swift
index 045464e4..0a451a38 100644
--- a/Sources/SWBProtocol/DependencyClosureMessages.swift
+++ b/Sources/SWBProtocol/DependencyClosureMessages.swift
@@ -14,7 +14,7 @@ public import SWBUtil
public struct ComputeDependencyClosureRequest: SessionMessage, RequestMessage, SerializableCodable, Equatable {
public typealias ResponseMessage = StringListResponse
-
+
public static let name = "COMPUTE_DEPENDENCY_CLOSURE_REQUEST"
public let sessionHandle: String
diff --git a/Sources/SWBProtocol/DependencyGraphMessages.swift b/Sources/SWBProtocol/DependencyGraphMessages.swift
index 423e544c..bb2b6815 100644
--- a/Sources/SWBProtocol/DependencyGraphMessages.swift
+++ b/Sources/SWBProtocol/DependencyGraphMessages.swift
@@ -77,7 +77,7 @@ public struct DependencyGraphResponse: Message, SerializableCodable, Equatable {
public struct DumpBuildDependencyInfoRequest: SessionChannelBuildMessage, RequestMessage, SerializableCodable, Equatable {
public typealias ResponseMessage = VoidResponse
-
+
public static let name = "DUMP_BUILD_DEPENDENCY_INFO_REQUEST"
/// The identifier for the session to initiate the request in.
diff --git a/Sources/SWBProtocol/DocumentationMessages.swift b/Sources/SWBProtocol/DocumentationMessages.swift
index 04e2dad9..d7e42831 100644
--- a/Sources/SWBProtocol/DocumentationMessages.swift
+++ b/Sources/SWBProtocol/DocumentationMessages.swift
@@ -17,7 +17,7 @@ public import SWBUtil
/// For a description of how this feature works, see the `SWBBuildServiceSession.generateDocumentationInfo` documentation.
public struct DocumentationInfoRequest: SessionChannelBuildMessage, RequestMessage, Equatable {
public typealias ResponseMessage = VoidResponse
-
+
public static let name = "DOCUMENTATION_INFO_REQUESTED"
/// The identifier for the session to initiate the request in.
diff --git a/Sources/SWBProtocol/IndexingMessages.swift b/Sources/SWBProtocol/IndexingMessages.swift
index e15a98d2..40c00ce7 100644
--- a/Sources/SWBProtocol/IndexingMessages.swift
+++ b/Sources/SWBProtocol/IndexingMessages.swift
@@ -94,7 +94,7 @@ public struct IndexingFileSettingsResponse: IndexingInfoResponse, Message, Equat
public struct IndexingHeaderInfoRequest: IndexingInfoRequest, RequestMessage, SessionChannelBuildMessage, SerializableCodable, Equatable {
public typealias ResponseMessage = VoidResponse
-
+
public static let name = "INDEXING_HEADER_INFO_REQUESTED"
/// The identifier for the session to initiate the request in.
@@ -143,7 +143,7 @@ let indexingMessageTypes: [any Message.Type] = [
public struct BuildDescriptionTargetInfoRequest: SessionChannelBuildMessage, RequestMessage, SerializableCodable, Equatable {
public typealias ResponseMessage = VoidResponse
-
+
public static let name = "BUILD_DESCRIPTION_TARGET_INFO"
/// The identifier for the session to initiate the request in.
diff --git a/Sources/SWBProtocol/MacroEvaluationMessages.swift b/Sources/SWBProtocol/MacroEvaluationMessages.swift
index 4f8579bd..faea9a3a 100644
--- a/Sources/SWBProtocol/MacroEvaluationMessages.swift
+++ b/Sources/SWBProtocol/MacroEvaluationMessages.swift
@@ -158,7 +158,7 @@ public struct AllExportedMacrosAndValuesResponse: Message, Equatable, Serializab
/// Request to get macro assignment and resolved value information to show in the build settings editor.
public struct BuildSettingsEditorInfoRequest: SessionMessage, RequestMessage, Equatable, SerializableCodable {
public typealias ResponseMessage = BuildSettingsEditorInfoResponse
-
+
public static let name = "INFO_FOR_BUILD_SETTINGS_EDITOR_REQUEST"
public let sessionHandle: String
diff --git a/Sources/SWBProtocol/Message.swift b/Sources/SWBProtocol/Message.swift
index 8299c71c..7ddd0670 100644
--- a/Sources/SWBProtocol/Message.swift
+++ b/Sources/SWBProtocol/Message.swift
@@ -65,7 +65,7 @@ public struct PingRequest: RequestMessage, Equatable {
public struct SetConfigItemRequest: RequestMessage, Equatable {
public typealias ResponseMessage = VoidResponse
-
+
public static let name = "SET_CONFIG_ITEM"
public let key: String
@@ -288,7 +288,7 @@ public struct GetBuildSettingsDescriptionRequest: SessionMessage, RequestMessage
public struct CreateXCFrameworkRequest: RequestMessage, Equatable, SerializableCodable {
public typealias ResponseMessage = StringResponse
-
+
public static let name = "CREATE_XCFRAMEWORK_REQUEST"
public let developerPath: Path?
diff --git a/Sources/SWBProtocol/ProjectDescriptorMessages.swift b/Sources/SWBProtocol/ProjectDescriptorMessages.swift
index 82450fae..327d3e23 100644
--- a/Sources/SWBProtocol/ProjectDescriptorMessages.swift
+++ b/Sources/SWBProtocol/ProjectDescriptorMessages.swift
@@ -70,7 +70,7 @@ public struct DescribeSchemesResponse: Message, Equatable {
public struct DescribeProductsRequest: SessionChannelMessage, RequestMessage, Equatable {
public typealias ResponseMessage = VoidResponse
-
+
public static let name = "PRODUCT_DESCRIPTION_REQUESTED"
/// The identifier for the session to initiate the request in.
diff --git a/Sources/SWBProtocol/ProjectModel/CustomTask.swift b/Sources/SWBProtocol/ProjectModel/CustomTask.swift
index 7ab24559..68380303 100644
--- a/Sources/SWBProtocol/ProjectModel/CustomTask.swift
+++ b/Sources/SWBProtocol/ProjectModel/CustomTask.swift
@@ -32,7 +32,7 @@ public struct CustomTask: SerializableCodable, Sendable {
self.enableSandboxing = enableSandboxing
self.preparesForIndexing = preparesForIndexing
}
-
+
enum CodingKeys: CodingKey {
case commandLine
case environmentVars
@@ -44,7 +44,7 @@ public struct CustomTask: SerializableCodable, Sendable {
case enableSandboxing
case preparesForIndexing
}
-
+
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.commandLine, forKey: .commandLine)
@@ -57,7 +57,7 @@ public struct CustomTask: SerializableCodable, Sendable {
try container.encode(enableSandboxing, forKey: .enableSandboxing)
try container.encode(preparesForIndexing, forKey: .preparesForIndexing)
}
-
+
public init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.commandLine = try container.decode([MacroExpressionSource].self, forKey: .commandLine)
diff --git a/Sources/SWBTaskConstruction/TaskProducers/OtherTaskProducers/CustomTaskProducer.swift b/Sources/SWBTaskConstruction/TaskProducers/OtherTaskProducers/CustomTaskProducer.swift
index a2c06777..823ca369 100644
--- a/Sources/SWBTaskConstruction/TaskProducers/OtherTaskProducers/CustomTaskProducer.swift
+++ b/Sources/SWBTaskConstruction/TaskProducers/OtherTaskProducers/CustomTaskProducer.swift
@@ -21,7 +21,7 @@ final class CustomTaskProducer: PhasedTaskProducer, TaskProducer {
await appendGeneratedTasks(&tasks) { delegate in
for customTask in context.configuredTarget?.target.customTasks ?? [] {
-
+
let commandLine = customTask.commandLine.map { context.settings.globalScope.evaluate($0) }
var environmentAssignments = await computeScriptEnvironment(.shellScriptPhase, scope: context.settings.globalScope, settings: context.settings, workspaceContext: context.workspaceContext, allDeploymentTargetMacroNames: context.allDeploymentTargetMacroNames())
if context.workspaceContext.core.hostOperatingSystem != .macOS {
@@ -67,7 +67,7 @@ final class CustomTaskProducer: PhasedTaskProducer, TaskProducer {
// If there are no outputs, create a virtual output that can be wired up to gates
outputs.append(delegate.createVirtualNode("CustomTask-\(taskSignature)"))
}
-
+
delegate.createTask(
type: CustomTaskTypeDescription.only,
ruleInfo: ["CustomTask", context.settings.globalScope.evaluate(customTask.executionDescription), taskSignature],
diff --git a/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift b/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift
index 2ea642df..f69701a4 100644
--- a/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift
+++ b/Sources/SWBTaskConstruction/TaskProducers/TaskProducer.swift
@@ -1209,7 +1209,7 @@ extension TaskProducerContext: CommandProducer {
public func lookupPlatformInfo(platform: BuildVersion.Platform) -> (any PlatformInfoProvider)? {
workspaceContext.core.lookupPlatformInfo(platform: platform)
}
-
+
public var preferredArch: String? {
return settings.preferredArch
}
diff --git a/Sources/SWBTaskExecution/TaskActions/GenericCachingTaskAction.swift b/Sources/SWBTaskExecution/TaskActions/GenericCachingTaskAction.swift
index d68eb864..e46de075 100644
--- a/Sources/SWBTaskExecution/TaskActions/GenericCachingTaskAction.swift
+++ b/Sources/SWBTaskExecution/TaskActions/GenericCachingTaskAction.swift
@@ -247,12 +247,12 @@ public final class GenericCachingTaskAction: TaskAction {
let sandboxProfile: ByteString = """
(version 1)
(allow default)
-
+
(deny network*)
-
+
(deny file-write*)
(allow file-write* (subpath "/dev/")) ; Allow writes to locations such as /dev/null
-
+
(deny file-read* (subpath "/Users/")) ; Block access to most locations under user control, while allowing reads to parts of the system required by frameworks and tools
(allow file-read* (subpath (param "XCODE"))) ; Allow reads into Xcode.app
@@ -265,7 +265,7 @@ public final class GenericCachingTaskAction: TaskAction {
; Allow reads and writes to the task sandbox location
(allow file-read* file-write* (subpath (param "TASK_SANDBOX")))
-
+
; Allow reads and writes to specific files required by system frameworks and libraries
(allow file-read-data file-write-data
(regex
@@ -273,7 +273,7 @@ public final class GenericCachingTaskAction: TaskAction {
#"^/usr/share/nls/"
#"^/usr/share/zoneinfo /var/db/timezone/zoneinfo/"
))
-
+
(allow file-read-metadata)
"""
try executionDelegate.fs.write(sandboxPath, contents: sandboxProfile)
diff --git a/Sources/SWBTaskExecution/TaskActions/LinkerTaskAction.swift b/Sources/SWBTaskExecution/TaskActions/LinkerTaskAction.swift
index be739b13..4eaa7d8f 100644
--- a/Sources/SWBTaskExecution/TaskActions/LinkerTaskAction.swift
+++ b/Sources/SWBTaskExecution/TaskActions/LinkerTaskAction.swift
@@ -15,11 +15,11 @@ public import SWBCore
public import SWBUtil
public final class LinkerTaskAction: TaskAction {
-
+
public override class var toolIdentifier: String {
return "linker"
}
-
+
/// Whether response files should be expanded before invoking the linker.
private let expandResponseFiles: Bool
private let responseFileFormat: ResponseFileFormat
@@ -29,7 +29,7 @@ public final class LinkerTaskAction: TaskAction {
self.responseFileFormat = responseFileFormat
super.init()
}
-
+
public override func serialize(to serializer: T) {
serializer.beginAggregate(3)
serializer.serialize(expandResponseFiles)
@@ -37,14 +37,14 @@ public final class LinkerTaskAction: TaskAction {
super.serialize(to: serializer)
serializer.endAggregate()
}
-
+
public required init(from deserializer: any Deserializer) throws {
try deserializer.beginAggregate(3)
self.expandResponseFiles = try deserializer.deserialize()
self.responseFileFormat = try deserializer.deserialize()
try super.init(from: deserializer)
}
-
+
public override func performTaskAction(
_ task: any ExecutableTask,
dynamicExecutionDelegate: any DynamicTaskExecutionDelegate,
@@ -53,7 +53,7 @@ public final class LinkerTaskAction: TaskAction {
outputDelegate: any TaskOutputDelegate
) async -> CommandResult {
var commandLine = Array(task.commandLineAsStrings)
-
+
if expandResponseFiles {
do {
commandLine = try ResponseFiles.expandResponseFiles(
@@ -67,7 +67,7 @@ public final class LinkerTaskAction: TaskAction {
return .failed
}
}
-
+
let processDelegate = TaskProcessDelegate(outputDelegate: outputDelegate)
do {
let success = try await dynamicExecutionDelegate.spawn(
@@ -76,7 +76,7 @@ public final class LinkerTaskAction: TaskAction {
workingDirectory: task.workingDirectory,
processDelegate: processDelegate
)
-
+
if let error = processDelegate.executionError {
outputDelegate.emitError(error)
return .failed
diff --git a/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift b/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift
index 2779938d..e9708dc9 100644
--- a/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift
+++ b/Sources/SWBTestSupport/CapturingTaskGenerationDelegate.swift
@@ -247,7 +247,7 @@ extension CapturingTaskGenerationDelegate: TaskActionCreationDelegate {
package func createValidateDependenciesTaskAction() -> any PlannedTaskAction {
return ValidateDependenciesTaskAction()
}
-
+
package func createObjectLibraryAssemblerTaskAction() -> any PlannedTaskAction {
return ObjectLibraryAssemblerTaskAction()
}
diff --git a/Sources/SWBUniversalPlatform/Specs/Clang.xcspec b/Sources/SWBUniversalPlatform/Specs/Clang.xcspec
index e2935b3e..36ec0772 100644
--- a/Sources/SWBUniversalPlatform/Specs/Clang.xcspec
+++ b/Sources/SWBUniversalPlatform/Specs/Clang.xcspec
@@ -367,15 +367,15 @@
);
// Disable c++ modules if it was set by CLANG_ENABLE_MODULES or
// when using a c++ language mode that implicitly enables it.
- Condition = "$(CLANG_ENABLE_MODULES) ||
+ Condition = "$(CLANG_ENABLE_MODULES) ||
!($(CLANG_CXX_LANGUAGE_STANDARD) == 'c++98' ||
- $(CLANG_CXX_LANGUAGE_STANDARD) == 'gnu++98' ||
+ $(CLANG_CXX_LANGUAGE_STANDARD) == 'gnu++98' ||
$(CLANG_CXX_LANGUAGE_STANDARD) == 'c++0x' ||
$(CLANG_CXX_LANGUAGE_STANDARD) == 'gnu++0x' ||
$(CLANG_CXX_LANGUAGE_STANDARD) == 'c++14' ||
$(CLANG_CXX_LANGUAGE_STANDARD) == 'gnu++14' ||
$(CLANG_CXX_LANGUAGE_STANDARD) == 'c++17' ||
- $(CLANG_CXX_LANGUAGE_STANDARD) == 'gnu++17'||
+ $(CLANG_CXX_LANGUAGE_STANDARD) == 'gnu++17'||
$(CLANG_CXX_LANGUAGE_STANDARD) == 'compiler-default')";
// Intentionally hidden.
},
diff --git a/Sources/SWBUniversalPlatform/Specs/Ld.xcspec b/Sources/SWBUniversalPlatform/Specs/Ld.xcspec
index 43082279..49937a83 100644
--- a/Sources/SWBUniversalPlatform/Specs/Ld.xcspec
+++ b/Sources/SWBUniversalPlatform/Specs/Ld.xcspec
@@ -642,7 +642,7 @@
CommandLineArgs = {
"" = ();
"<>" = (
- "-Xlinker",
+ "-Xlinker",
"-dependency_info",
"-Xlinker",
"$(value)",
diff --git a/Sources/SWBUniversalPlatform/TestEntryPointGenerationTaskAction.swift b/Sources/SWBUniversalPlatform/TestEntryPointGenerationTaskAction.swift
index d5f8ba5f..bad72bbd 100644
--- a/Sources/SWBUniversalPlatform/TestEntryPointGenerationTaskAction.swift
+++ b/Sources/SWBUniversalPlatform/TestEntryPointGenerationTaskAction.swift
@@ -54,9 +54,9 @@ class TestEntryPointGenerationTaskAction: TaskAction {
#if canImport(Testing)
import Testing
#endif
-
+
\(testObservationFragment)
-
+
public import XCTest
\(discoveredTestsFragment(tests: tests, options: options))
@@ -75,7 +75,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
// Fallback if not specified: run XCTest (legacy behavior)
return "xctest"
}
-
+
private static func testOutputPath() -> String? {
var iterator = CommandLine.arguments.makeIterator()
while let argument = iterator.next() {
@@ -85,7 +85,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
}
return nil
}
-
+
#if os(Linux)
@_silgen_name("$ss13_runAsyncMainyyyyYaKcF")
private static func _runAsyncMain(_ asyncFun: @Sendable @escaping () async throws -> ())
@@ -189,17 +189,17 @@ class TestEntryPointGenerationTaskAction: TaskAction {
#if !os(Windows) // Test observation is not supported on Windows
public import Foundation
public import XCTest
-
+
public final class __SwiftPMXCTestObserver: NSObject {
let testOutputPath: String
-
+
public init(testOutputPath: String) {
self.testOutputPath = testOutputPath
super.init()
XCTestObservationCenter.shared.addTestObserver(self)
}
}
-
+
extension __SwiftPMXCTestObserver: XCTestObservation {
private func write(record: any Encodable) {
let lock = __SwiftPMFileLock(at: URL(fileURLWithPath: self.testOutputPath + ".lock"))
@@ -207,7 +207,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
self._write(record: record)
}
}
-
+
private func _write(record: any Encodable) {
if let data = try? JSONEncoder().encode(record) {
if let fileHandle = FileHandle(forWritingAtPath: self.testOutputPath) {
@@ -220,28 +220,28 @@ class TestEntryPointGenerationTaskAction: TaskAction {
}
}
}
-
+
public func __SwiftPMTestBundleWillStart(_ __SwiftPMTestBundle: Bundle) {
let record = __SwiftPMTestBundleEventRecord(bundle: .init(__SwiftPMTestBundle), event: .start)
write(record: __SwiftPMTestEventRecord(bundleEvent: record))
}
-
+
public func testSuiteWillStart(_ testSuite: XCTestSuite) {
let record = __SwiftPMTestSuiteEventRecord(suite: .init(testSuite), event: .start)
write(record: __SwiftPMTestEventRecord(suiteEvent: record))
}
-
+
public func testCaseWillStart(_ testCase: XCTestCase) {
let record = __SwiftPMTestCaseEventRecord(testCase: .init(testCase), event: .start)
write(record: __SwiftPMTestEventRecord(caseEvent: record))
}
-
+
#if canImport(Darwin)
public func testCase(_ testCase: XCTestCase, didRecord issue: XCTIssue) {
let record = __SwiftPMTestCaseFailureRecord(testCase: .init(testCase), issue: .init(issue), failureKind: .unexpected)
write(record: __SwiftPMTestEventRecord(caseFailure: record))
}
-
+
public func testCase(_ testCase: XCTestCase, didRecord expectedFailure: XCTExpectedFailure) {
let record = __SwiftPMTestCaseFailureRecord(testCase: .init(testCase), issue: .init(expectedFailure.issue), failureKind: .expected(failureReason: expectedFailure.failureReason))
write(record: __SwiftPMTestEventRecord(caseFailure: record))
@@ -253,18 +253,18 @@ class TestEntryPointGenerationTaskAction: TaskAction {
write(record: __SwiftPMTestEventRecord(caseFailure: record))
}
#endif
-
+
public func testCaseDidFinish(_ testCase: XCTestCase) {
let record = __SwiftPMTestCaseEventRecord(testCase: .init(testCase), event: .finish)
write(record: __SwiftPMTestEventRecord(caseEvent: record))
}
-
+
#if canImport(Darwin)
public func testSuite(_ testSuite: XCTestSuite, didRecord issue: XCTIssue) {
let record = __SwiftPMTestSuiteFailureRecord(suite: .init(testSuite), issue: .init(issue), failureKind: .unexpected)
write(record: __SwiftPMTestEventRecord(suiteFailure: record))
}
-
+
public func testSuite(_ testSuite: XCTestSuite, didRecord expectedFailure: XCTExpectedFailure) {
let record = __SwiftPMTestSuiteFailureRecord(suite: .init(testSuite), issue: .init(expectedFailure.issue), failureKind: .expected(failureReason: expectedFailure.failureReason))
write(record: __SwiftPMTestEventRecord(suiteFailure: record))
@@ -276,20 +276,20 @@ class TestEntryPointGenerationTaskAction: TaskAction {
write(record: __SwiftPMTestEventRecord(suiteFailure: record))
}
#endif
-
+
public func testSuiteDidFinish(_ testSuite: XCTestSuite) {
let record = __SwiftPMTestSuiteEventRecord(suite: .init(testSuite), event: .finish)
write(record: __SwiftPMTestEventRecord(suiteEvent: record))
}
-
+
public func __SwiftPMTestBundleDidFinish(_ __SwiftPMTestBundle: Bundle) {
let record = __SwiftPMTestBundleEventRecord(bundle: .init(__SwiftPMTestBundle), event: .finish)
write(record: __SwiftPMTestEventRecord(bundleEvent: record))
}
}
-
+
// FIXME: Copied from `Lock.swift` in TSCBasic, would be nice if we had a better way
-
+
#if canImport(Glibc)
@_exported import Glibc
#elseif canImport(Musl)
@@ -304,22 +304,22 @@ class TestEntryPointGenerationTaskAction: TaskAction {
#else
@_exported import Darwin.C
#endif
-
+
import Foundation
-
+
public final class __SwiftPMFileLock {
#if os(Windows)
private var handle: HANDLE?
#else
private var fileDescriptor: CInt?
#endif
-
+
private let lockFile: URL
-
+
public init(at lockFile: URL) {
self.lockFile = lockFile
}
-
+
public func lock() throws {
#if os(Windows)
if handle == nil {
@@ -366,7 +366,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
}
#endif
}
-
+
public func unlock() {
#if os(Windows)
var overlapped = OVERLAPPED()
@@ -381,7 +381,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
flock(fd, LOCK_UN)
#endif
}
-
+
deinit {
#if os(Windows)
guard let handle = handle else { return }
@@ -393,30 +393,30 @@ class TestEntryPointGenerationTaskAction: TaskAction {
close(fd)
#endif
}
-
+
public func withLock(_ body: () throws -> T) throws -> T {
try lock()
defer { unlock() }
return try body()
}
-
+
public func withLock(_ body: () async throws -> T) async throws -> T {
try lock()
defer { unlock() }
return try await body()
}
}
-
+
// FIXME: Copied from `XCTEvents.swift`, would be nice if we had a better way
-
+
struct __SwiftPMTestEventRecord: Codable {
let caseFailure: __SwiftPMTestCaseFailureRecord?
let suiteFailure: __SwiftPMTestSuiteFailureRecord?
-
+
let bundleEvent: __SwiftPMTestBundleEventRecord?
let suiteEvent: __SwiftPMTestSuiteEventRecord?
let caseEvent: __SwiftPMTestCaseEventRecord?
-
+
init(
caseFailure: __SwiftPMTestCaseFailureRecord? = nil,
suiteFailure: __SwiftPMTestSuiteFailureRecord? = nil,
@@ -431,72 +431,72 @@ class TestEntryPointGenerationTaskAction: TaskAction {
self.caseEvent = caseEvent
}
}
-
+
// MARK: - Records
-
+
struct __SwiftPMTestAttachment: Codable {
let name: String?
// TODO: Handle `userInfo: [AnyHashable : Any]?`
let uniformTypeIdentifier: String
let payload: Data?
}
-
+
struct __SwiftPMTestBundleEventRecord: Codable {
let bundle: __SwiftPMTestBundle
let event: __SwiftPMTestEvent
}
-
+
struct __SwiftPMTestCaseEventRecord: Codable {
let testCase: __SwiftPMTestCase
let event: __SwiftPMTestEvent
}
-
+
struct __SwiftPMTestCaseFailureRecord: Codable, CustomStringConvertible {
let testCase: __SwiftPMTestCase
let issue: __SwiftPMTestIssue
let failureKind: __SwiftPMTestFailureKind
-
+
var description: String {
return "\\(issue.sourceCodeContext.description)\\(testCase) \\(issue.compactDescription)"
}
}
-
+
struct __SwiftPMTestSuiteEventRecord: Codable {
let suite: __SwiftPMTestSuiteRecord
let event: __SwiftPMTestEvent
}
-
+
struct __SwiftPMTestSuiteFailureRecord: Codable {
let suite: __SwiftPMTestSuiteRecord
let issue: __SwiftPMTestIssue
let failureKind: __SwiftPMTestFailureKind
}
-
+
// MARK: Primitives
-
+
struct __SwiftPMTestBundle: Codable {
let bundleIdentifier: String?
let bundlePath: String
}
-
+
struct __SwiftPMTestCase: Codable {
let name: String
}
-
+
struct __SwiftPMTestErrorInfo: Codable {
let description: String
let type: String
}
-
+
enum __SwiftPMTestEvent: Codable {
case start
case finish
}
-
+
enum __SwiftPMTestFailureKind: Codable, Equatable {
case unexpected
case expected(failureReason: String?)
-
+
var isExpected: Bool {
switch self {
case .expected: return true
@@ -504,7 +504,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
}
}
}
-
+
struct __SwiftPMTestIssue: Codable {
let type: __SwiftPMTestIssueType
let compactDescription: String
@@ -513,7 +513,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
let sourceCodeContext: __SwiftPMTestSourceCodeContext
let attachments: [__SwiftPMTestAttachment]
}
-
+
enum __SwiftPMTestIssueType: Codable {
case assertionFailure
case performanceRegression
@@ -523,43 +523,43 @@ class TestEntryPointGenerationTaskAction: TaskAction {
case unmatchedExpectedFailure
case unknown
}
-
+
struct __SwiftPMTestLocation: Codable, CustomStringConvertible {
let file: String
let line: Int
-
+
var description: String {
return "\\(file):\\(line) "
}
}
-
+
struct __SwiftPMTestSourceCodeContext: Codable, CustomStringConvertible {
let callStack: [__SwiftPMTestSourceCodeFrame]
let location: __SwiftPMTestLocation?
-
+
var description: String {
return location?.description ?? ""
}
}
-
+
struct __SwiftPMTestSourceCodeFrame: Codable {
let address: UInt64
let symbolInfo: __SwiftPMTestSourceCodeSymbolInfo?
let symbolicationError: __SwiftPMTestErrorInfo?
}
-
+
struct __SwiftPMTestSourceCodeSymbolInfo: Codable {
let imageName: String
let symbolName: String
let location: __SwiftPMTestLocation?
}
-
+
struct __SwiftPMTestSuiteRecord: Codable {
let name: String
}
-
+
// MARK: XCTest compatibility
-
+
extension __SwiftPMTestIssue {
init(description: String, inFile filePath: String?, atLine lineNumber: Int) {
let location: __SwiftPMTestLocation?
@@ -571,9 +571,9 @@ class TestEntryPointGenerationTaskAction: TaskAction {
self.init(type: .assertionFailure, compactDescription: description, detailedDescription: description, associatedError: nil, sourceCodeContext: .init(callStack: [], location: location), attachments: [])
}
}
-
+
public import XCTest
-
+
#if canImport(Darwin) // XCTAttachment is unavailable in swift-corelibs-xctest.
extension __SwiftPMTestAttachment {
init(_ attachment: XCTAttachment) {
@@ -585,7 +585,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
}
}
#endif
-
+
extension __SwiftPMTestBundle {
init(_ testBundle: Bundle) {
self.init(
@@ -594,19 +594,19 @@ class TestEntryPointGenerationTaskAction: TaskAction {
)
}
}
-
+
extension __SwiftPMTestCase {
init(_ testCase: XCTestCase) {
self.init(name: testCase.name)
}
}
-
+
extension __SwiftPMTestErrorInfo {
init(_ error: any Swift.Error) {
self.init(description: "\\(error)", type: "\\(Swift.type(of: error))")
}
}
-
+
#if canImport(Darwin) // XCTIssue is unavailable in swift-corelibs-xctest.
extension __SwiftPMTestIssue {
init(_ issue: XCTIssue) {
@@ -620,7 +620,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
)
}
}
-
+
extension __SwiftPMTestIssueType {
init(_ type: XCTIssue.IssueType) {
switch type {
@@ -635,7 +635,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
}
}
#endif
-
+
#if canImport(Darwin) // XCTSourceCodeLocation/XCTSourceCodeContext/XCTSourceCodeFrame/XCTSourceCodeSymbolInfo is unavailable in swift-corelibs-xctest.
extension __SwiftPMTestLocation {
init(_ location: XCTSourceCodeLocation) {
@@ -645,7 +645,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
)
}
}
-
+
extension __SwiftPMTestSourceCodeContext {
init(_ context: XCTSourceCodeContext) {
self.init(
@@ -654,7 +654,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
)
}
}
-
+
extension __SwiftPMTestSourceCodeFrame {
init(_ frame: XCTSourceCodeFrame) {
self.init(
@@ -664,7 +664,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
)
}
}
-
+
extension __SwiftPMTestSourceCodeSymbolInfo {
init(_ symbolInfo: XCTSourceCodeSymbolInfo) {
self.init(
@@ -675,7 +675,7 @@ class TestEntryPointGenerationTaskAction: TaskAction {
}
}
#endif
-
+
extension __SwiftPMTestSuiteRecord {
init(_ testSuite: XCTestSuite) {
self.init(name: testSuite.name)
diff --git a/Sources/SWBUniversalPlatform/TestEntryPointGenerationTool.swift b/Sources/SWBUniversalPlatform/TestEntryPointGenerationTool.swift
index 406241e8..ae18b283 100644
--- a/Sources/SWBUniversalPlatform/TestEntryPointGenerationTool.swift
+++ b/Sources/SWBUniversalPlatform/TestEntryPointGenerationTool.swift
@@ -21,10 +21,10 @@ final class TestEntryPointGenerationToolSpec: GenericCommandLineToolSpec, SpecId
var args = await super.commandLineFromTemplate(cbc, delegate, optionContext: optionContext, specialArgs: specialArgs, lookup: lookup)
if cbc.scope.evaluate(BuiltinMacros.GENERATED_TEST_ENTRY_POINT_INCLUDE_DISCOVERED_TESTS) {
args.append("--discover-tests")
-
+
let format = cbc.scope.evaluate(BuiltinMacros.LINKER_FILE_LIST_FORMAT)
args.append(contentsOf: ["--linker-file-list-format", .literal(.init(encodingAsUTF8: format.rawValue))])
-
+
for toolchainLibrarySearchPath in cbc.producer.toolchains.map({ StackedSearchPath(paths: $0.librarySearchPaths.paths + $0.fallbackLibrarySearchPaths.paths, fs: $0.librarySearchPaths.fs) } ) {
if let path = toolchainLibrarySearchPath.findLibrary(operatingSystem: cbc.producer.hostOperatingSystem, basename: "IndexStore") {
args.append(contentsOf: ["--index-store-library-path", .path(path)])
@@ -55,7 +55,7 @@ final class TestEntryPointGenerationToolSpec: GenericCommandLineToolSpec, SpecId
for indexStorePath in indexStorePaths {
commandLine.append(contentsOf: ["--index-store", .path(indexStorePath)])
}
-
+
for basePath in indexUnitBasePaths {
commandLine.append(contentsOf: ["--index-unit-base-path", .path(basePath)])
}
diff --git a/Sources/SWBUtil/FSProxy.swift b/Sources/SWBUtil/FSProxy.swift
index f222a63f..7f907cc2 100644
--- a/Sources/SWBUtil/FSProxy.swift
+++ b/Sources/SWBUtil/FSProxy.swift
@@ -67,11 +67,11 @@ public struct FileInfo: Equatable, Sendable {
}
public var isDirectory: Bool {
- return fileAttrs[.type] as! FileAttributeType == .typeDirectory
+ return fileAttrs[.type] as! FileAttributeType == .typeDirectory
}
public var isSymlink: Bool {
- return fileAttrs[.type] as! FileAttributeType == .typeSymbolicLink
+ return fileAttrs[.type] as! FileAttributeType == .typeSymbolicLink
}
public var size: Int64 {
diff --git a/Sources/SWBUtil/HashContext.swift b/Sources/SWBUtil/HashContext.swift
index 4465820c..916adc37 100644
--- a/Sources/SWBUtil/HashContext.swift
+++ b/Sources/SWBUtil/HashContext.swift
@@ -122,9 +122,9 @@ fileprivate final class SwiftCryptoHashContext: HashContext {
guard let result = self.result else {
let digest = hash.finalize()
let byteCount = type(of: digest).byteCount
-
+
var result = [UInt8](repeating: 0, count: Int(byteCount) * 2)
-
+
digest.withUnsafeBytes { ptr in
for i in 0..: HashContext {
result[i*2 + 1] = hexchar(value & 0x0F)
}
}
-
+
let tmp = ByteString(result)
self.result = tmp
return tmp
diff --git a/Sources/SwiftBuild/ProjectModel/BuildConfig.swift b/Sources/SwiftBuild/ProjectModel/BuildConfig.swift
index 5efd5f58..51a7b675 100644
--- a/Sources/SwiftBuild/ProjectModel/BuildConfig.swift
+++ b/Sources/SwiftBuild/ProjectModel/BuildConfig.swift
@@ -20,7 +20,7 @@ extension ProjectModel {
public var name: String
public var settings: BuildSettings
public var impartedBuildProperties: ImpartedBuildProperties
-
+
public init(id: GUID, name: String, settings: BuildSettings, impartedBuildSettings: BuildSettings = .init()) {
precondition(!name.isEmpty)
self.id = id
@@ -39,7 +39,7 @@ extension ProjectModel.BuildConfig: Codable {
self.settings = try container.decode(ProjectModel.BuildSettings.self, forKey: .buildSettings)
self.impartedBuildProperties = try container.decode(ProjectModel.ImpartedBuildProperties.self, forKey: .impartedBuildProperties)
}
-
+
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(id, forKey: .guid)
diff --git a/Sources/SwiftBuild/ProjectModel/BuildFile.swift b/Sources/SwiftBuild/ProjectModel/BuildFile.swift
index 9044cd9c..6b7a310d 100644
--- a/Sources/SwiftBuild/ProjectModel/BuildFile.swift
+++ b/Sources/SwiftBuild/ProjectModel/BuildFile.swift
@@ -95,7 +95,7 @@ extension ProjectModel.BuildFile: Codable {
}
}
-
+
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.id, forKey: .guid)
diff --git a/Sources/SwiftBuild/ProjectModel/PlatformFilter.swift b/Sources/SwiftBuild/ProjectModel/PlatformFilter.swift
index 76b12071..d33c92fa 100644
--- a/Sources/SwiftBuild/ProjectModel/PlatformFilter.swift
+++ b/Sources/SwiftBuild/ProjectModel/PlatformFilter.swift
@@ -31,7 +31,7 @@ extension ProjectModel.PlatformFilter: Codable {
self.platform = try container.decode(String.self, forKey: .platform)
self.environment = try container.decodeIfPresent(String.self, forKey: .environment) ?? ""
}
-
+
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.platform, forKey: .platform)
diff --git a/Sources/SwiftBuild/ProjectModel/References.swift b/Sources/SwiftBuild/ProjectModel/References.swift
index 81921cf8..3de841e8 100644
--- a/Sources/SwiftBuild/ProjectModel/References.swift
+++ b/Sources/SwiftBuild/ProjectModel/References.swift
@@ -136,7 +136,7 @@ extension ProjectModel.Reference: Codable {
throw DecodingError.dataCorruptedError(forKey: .type, in: container, debugDescription: "Unknown value for key")
}
}
-
+
public func encode(to encoder: any Encoder) throws {
switch self {
case let .file(fref):
diff --git a/Sources/SwiftBuild/ProjectModel/TargetDependency.swift b/Sources/SwiftBuild/ProjectModel/TargetDependency.swift
index 83ca2d9e..88dc8c43 100644
--- a/Sources/SwiftBuild/ProjectModel/TargetDependency.swift
+++ b/Sources/SwiftBuild/ProjectModel/TargetDependency.swift
@@ -34,7 +34,7 @@ extension ProjectModel.TargetDependency: Codable {
self.targetId = try container.decode(ProjectModel.GUID.self, forKey: .guid)
self.platformFilters = try container.decode(Set.self, forKey: .platformFilters)
}
-
+
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.targetId, forKey: .guid)
diff --git a/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift b/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift
index 1e4dd699..58df9bc4 100644
--- a/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift
+++ b/Tests/SWBBuildSystemTests/BuildBacktraceTests.swift
@@ -236,7 +236,7 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests {
file <<<
"""
func foo() {}
-
+
func bar() {}
"""
}
@@ -568,7 +568,7 @@ fileprivate struct BuildBacktraceTests: CoreBasedTests {
#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
#7: file '\(SRCROOT.str)/Sources/foo.c' changed
-
+
""")
}
}
diff --git a/Tests/SWBBuildSystemTests/ShellScriptSandboxingTests.swift b/Tests/SWBBuildSystemTests/ShellScriptSandboxingTests.swift
index 6309bb44..b1f0f3f6 100644
--- a/Tests/SWBBuildSystemTests/ShellScriptSandboxingTests.swift
+++ b/Tests/SWBBuildSystemTests/ShellScriptSandboxingTests.swift
@@ -415,14 +415,14 @@ fileprivate struct ShellScriptSandboxingTests: CoreBasedTests {
set -o pipefail
mkdir -p "${SCRIPT_OUTPUT_FILE_0}"
cd "${SCRIPT_INPUT_FILE_0}"
-
+
for headerFile in ${SCRIPT_INPUT_FILE_0}/*.fake-h
do
cp "$headerFile" "${SCRIPT_OUTPUT_FILE_0}"/
done
-
+
ls "${SCRIPT_OUTPUT_FILE_0}"/
-
+
cat "${SCRIPT_OUTPUT_FILE_0}"/*
"""#,
inputs: ["$(SRCROOT)/myCryptoProject/raw/"], outputs: ["$(SHARED_DERIVED_FILE_DIR)/headers/"]),
diff --git a/Tests/SWBBuildSystemTests/SwiftDriverTests.swift b/Tests/SWBBuildSystemTests/SwiftDriverTests.swift
index e872fd5f..facdb73a 100644
--- a/Tests/SWBBuildSystemTests/SwiftDriverTests.swift
+++ b/Tests/SWBBuildSystemTests/SwiftDriverTests.swift
@@ -1039,7 +1039,7 @@ fileprivate struct SwiftDriverTests: CoreBasedTests {
file <<<
"""
import TargetA
-
+
struct D {
let a = A()
}
@@ -1056,7 +1056,7 @@ fileprivate struct SwiftDriverTests: CoreBasedTests {
file <<<
"""
import TargetB
-
+
struct F {
let c = C()
}
@@ -5186,7 +5186,7 @@ fileprivate struct SwiftDriverTests: CoreBasedTests {
public struct A {
public init() { }
}
-
+
public func foo() { }
"""
}
diff --git a/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift b/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift
index fba9edb1..0a7c1617 100644
--- a/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift
+++ b/Tests/SWBBuildSystemTests/UnitTestBuildOperationTests.swift
@@ -830,7 +830,7 @@ fileprivate struct UnitTestBuildOperationTests: CoreBasedTests {
if let task = results.getTask(.matchTargetName("AppTarget"), .matchRuleType("Ld")) {
results.check(notContains: .taskHadEvent(task, event: .started))
}
-
+
// Check that the test target's compile and link tasks ran.
if let task = results.getTask(.matchTargetName("UnitTestTarget"), .matchRuleType("SwiftDriver")) {
results.check(contains: .taskHadEvent(task, event: .started))
@@ -838,7 +838,7 @@ fileprivate struct UnitTestBuildOperationTests: CoreBasedTests {
if let task = results.getTask(.matchTargetName("UnitTestTarget"), .matchRuleType("Ld")) {
results.check(contains: .taskHadEvent(task, event: .started))
}
-
+
// Check that the test and app's code sign tasks both ran.
if let task = results.getTask(.matchTargetName("UnitTestTarget"), .matchRuleType("CodeSign")) {
results.check(contains: .taskHadEvent(task, event: .started))
@@ -846,7 +846,7 @@ fileprivate struct UnitTestBuildOperationTests: CoreBasedTests {
if let task = results.getTask(.matchTargetName("AppTarget"), .matchRuleType("CodeSign"), .matchRuleItemBasename("AppTarget.app")) {
results.check(contains: .taskHadEvent(task, event: .started))
}
-
+
// Check that there are no errors.
results.checkNoDiagnostics()
}
diff --git a/Tests/SWBCoreTests/ClangSerializedDiagnosticsTests.swift b/Tests/SWBCoreTests/ClangSerializedDiagnosticsTests.swift
index 3f37e39e..e77c1c3a 100644
--- a/Tests/SWBCoreTests/ClangSerializedDiagnosticsTests.swift
+++ b/Tests/SWBCoreTests/ClangSerializedDiagnosticsTests.swift
@@ -54,15 +54,15 @@ fileprivate struct ClangSerializedDiagnosticsTests: CoreBasedTests {
try localFS.write(cFilePath, contents: "#include \"other/foo.h\"\nint main() { return 0; }")
let taskWorkingDirectory = cFilePath.dirname
_ = try? await runHostProcess(["clang", "-I../", "-Wall", "-serialize-diagnostics", diagnosticsPath.str, "foo.c"], workingDirectory: taskWorkingDirectory)
-
+
let libclang = try #require(await Libclang(path: libclangPath))
libclang.leak()
-
+
// Ensure there's only one diagnostic and its path is relative.
let clangDiagnostics = try libclang.loadDiagnostics(filePath: diagnosticsPath.str)
#expect(clangDiagnostics.count == 1, Comment(rawValue: clangDiagnostics.description))
#expect(clangDiagnostics.only?.fileName == "../other/foo.h")
-
+
// Ensure there's only one diagnostic and its path has been made absolute.
let diagnostics = clangDiagnostics.map { Diagnostic($0, workingDirectory: taskWorkingDirectory, appendToOutputStream: false) }
#expect(diagnostics.count == 1)
diff --git a/Tests/SWBCoreTests/SettingsTests.swift b/Tests/SWBCoreTests/SettingsTests.swift
index 68394735..1c6b835a 100644
--- a/Tests/SWBCoreTests/SettingsTests.swift
+++ b/Tests/SWBCoreTests/SettingsTests.swift
@@ -5371,7 +5371,7 @@ import SWBMacro
#include \"\(Path.root.join("tmp/A.xcconfig").strWithPosixSlashes)\"
#include \"\(Path.root.join("tmp/D.xcconfig").strWithPosixSlashes)\"
#include \"\(Path.root.join("tmp/E.xcconfig").strWithPosixSlashes)\"
-
+
"""
let info = buildRequestContext.loadSettingsFromConfig(data: ByteString(encodingAsUTF8: data), path: Path.root.join("mock/base/path"), namespace: MacroNamespace(), searchPaths: [Path]())
@@ -5393,7 +5393,7 @@ import SWBMacro
let data: String = """
#include "\(Path.root.join("tmp/A").strWithPosixSlashes)"
#include "\(Path.root.join("tmp/B").strWithPosixSlashes)"
-
+
"""
let buildRequestContext = BuildRequestContext(workspaceContext: context)
diff --git a/Tests/SWBMacroTests/MacroParsingTests.swift b/Tests/SWBMacroTests/MacroParsingTests.swift
index a5144803..84593196 100644
--- a/Tests/SWBMacroTests/MacroParsingTests.swift
+++ b/Tests/SWBMacroTests/MacroParsingTests.swift
@@ -824,7 +824,7 @@ fileprivate let testFileData = [
expectedIncludeDirectivesCount: 1
)
}
-
+
@Test
func finalLineAndColumnTracking() {
// Test empty string
@@ -835,7 +835,7 @@ fileprivate let testFileData = [
expectedEndLine: 1,
expectedEndColumn: 1
)
-
+
// Test single line assignment
TestMacroConfigFileParser("A = B",
expectedAssignments: [(macro: "A", conditions: [], value: "B")],
@@ -844,7 +844,7 @@ fileprivate let testFileData = [
expectedEndLine: 1,
expectedEndColumn: 6
)
-
+
// Test multiple lines with empty line at end
TestMacroConfigFileParser("A = B\n\n",
expectedAssignments: [(macro: "A", conditions: [], value: "B")],
@@ -853,7 +853,7 @@ fileprivate let testFileData = [
expectedEndLine: 3,
expectedEndColumn: 1
)
-
+
// Test with comment-only line at end
TestMacroConfigFileParser("A = B\n// This is a comment",
expectedAssignments: [(macro: "A", conditions: [], value: "B")],
@@ -912,7 +912,7 @@ private func TestMacroConfigFileParser(_ string: String, expectedAssignments: [A
// Create a parser, and do the parse.
let parser = MacroConfigFileParser(byteString: ByteString(encodingAsUTF8: string), path: Path("TestMacroConfigFileParser().xcconfig"), delegate: delegate)
parser.parse()
-
+
// Check the final line and column numbers if expected values are provided.
if let expectedEndLine {
#expect(parser.finalLineNumber == expectedEndLine, "expected final line number \(expectedEndLine), but instead got \(parser.finalLineNumber)", sourceLocation: sourceLocation)
diff --git a/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift
index 777d0f2f..74349f70 100644
--- a/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift
+++ b/Tests/SWBTaskConstructionTests/UnitTestTaskConstructionTests.swift
@@ -369,17 +369,17 @@ fileprivate struct UnitTestTaskConstructionTests: CoreBasedTests {
results.checkTarget("UnitTestRunner") { target in
results.checkTask(.matchTarget(target), .matchRuleType("GenerateTestEntryPoint")) { task in
task.checkCommandLineMatches([
- .suffix("builtin-generateTestEntryPoint"),
- "--output",
- .suffix("test_entry_point.swift"),
- "--discover-tests",
- "--linker-file-list-format",
+ .suffix("builtin-generateTestEntryPoint"),
+ "--output",
+ .suffix("test_entry_point.swift"),
+ "--discover-tests",
+ "--linker-file-list-format",
.any,
- "--index-store-library-path",
- .or(.suffix("libIndexStore.so"), .suffix("libIndexStore.dll")),
- "--linker-filelist", .suffix("UnitTestTarget.LinkFileList"),
+ "--index-store-library-path",
+ .or(.suffix("libIndexStore.so"), .suffix("libIndexStore.dll")),
+ "--linker-filelist", .suffix("UnitTestTarget.LinkFileList"),
"--index-store", .equal(Path("/index").str),
- "--index-unit-base-path",
+ "--index-unit-base-path",
.equal(Path.root.join("/tmp/Test/aProject/build").str)
])
task.checkInputs([
diff --git a/Tests/SWBTaskExecutionTests/PBXCpTests.swift b/Tests/SWBTaskExecutionTests/PBXCpTests.swift
index 069101ef..a2c7a7eb 100644
--- a/Tests/SWBTaskExecutionTests/PBXCpTests.swift
+++ b/Tests/SWBTaskExecutionTests/PBXCpTests.swift
@@ -298,7 +298,7 @@ fileprivate struct PBXCpTests: CoreBasedTests {
}
/// Check that we can invoke `strip`.
- @Test
+ @Test
func stripUnstrippedBinaries() async throws {
try await withTemporaryDirectory { tmp in
let src = tmp.join("src")
@@ -324,7 +324,7 @@ fileprivate struct PBXCpTests: CoreBasedTests {
}
}
- @Test
+ @Test
func relativeDestinationToCWD() async throws {
try await withTemporaryDirectory { tmp in
let src = tmp.join("src")
diff --git a/Tests/SWBTestSupportTests/TestSupportTests.swift b/Tests/SWBTestSupportTests/TestSupportTests.swift
index 098f48c3..18157b48 100644
--- a/Tests/SWBTestSupportTests/TestSupportTests.swift
+++ b/Tests/SWBTestSupportTests/TestSupportTests.swift
@@ -41,7 +41,7 @@ import SWBUtil
}
@Suite fileprivate struct TaskCheckingTests: CoreBasedTests {
- @Test(.requireSDKs(.host))
+ @Test(.requireSDKs(.host))
func ensureTaskBelongToCorrectBuild() async throws {
try await withTemporaryDirectory { tmpDir in
let testWorkspace = TestWorkspace("TestWorkspace", sourceRoot: tmpDir, projects: [
diff --git a/Tests/SWBUtilTests/EnvironmentKeyTests.swift b/Tests/SWBUtilTests/EnvironmentKeyTests.swift
index 4cc38480..1396531d 100644
--- a/Tests/SWBUtilTests/EnvironmentKeyTests.swift
+++ b/Tests/SWBUtilTests/EnvironmentKeyTests.swift
@@ -20,7 +20,7 @@ import Testing
init() throws {
isCaseInsensitive = try ProcessInfo.processInfo.hostOperatingSystem() == .windows
}
-
+
@Test func comparable() {
let key0 = EnvironmentKey("Test")
let key1 = EnvironmentKey("Test1")
diff --git a/Tests/SWBWindowsPlatformTests/SWBWindowsPlatformTests.swift b/Tests/SWBWindowsPlatformTests/SWBWindowsPlatformTests.swift
index 25771aa5..23140d3e 100644
--- a/Tests/SWBWindowsPlatformTests/SWBWindowsPlatformTests.swift
+++ b/Tests/SWBWindowsPlatformTests/SWBWindowsPlatformTests.swift
@@ -109,4 +109,4 @@ import SWBMacro
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Tests/SwiftBuildTests/ConsoleCommands/ServiceConsoleTests.swift b/Tests/SwiftBuildTests/ConsoleCommands/ServiceConsoleTests.swift
index 467977df..78305d03 100644
--- a/Tests/SwiftBuildTests/ConsoleCommands/ServiceConsoleTests.swift
+++ b/Tests/SwiftBuildTests/ConsoleCommands/ServiceConsoleTests.swift
@@ -56,7 +56,7 @@ fileprivate struct ServiceConsoleTests {
let executionResult = try await Process.getOutput(url: try CLIConnection.swiftbuildToolURL, arguments: ["isAlive"], environment: CLIConnection.environment)
let output = String(decoding: executionResult.stdout, as: UTF8.self)
-
+
// Verify there were no errors.
#expect(output == "is alive? yes\(String.newline)")
diff --git a/Tests/SwiftBuildTests/ToolchainTests.swift b/Tests/SwiftBuildTests/ToolchainTests.swift
index 87e0ecd1..0a3a70af 100644
--- a/Tests/SwiftBuildTests/ToolchainTests.swift
+++ b/Tests/SwiftBuildTests/ToolchainTests.swift
@@ -36,7 +36,7 @@ fileprivate struct ToolchainTests: CoreBasedTests {
try await testSession.close()
}
}
-
+
let id = try await testSession.session.lookupToolchain(at: tmpDir.join("toolchain.xctoolchain").str)
#expect(id?.rawValue == "com.foo.bar")
}