Merge pull request #1950 from ahoppen/gardening

Gardening
This commit is contained in:
Alex Hoppen
2025-01-24 22:33:51 -08:00
committed by GitHub
28 changed files with 12 additions and 582 deletions

View File

@@ -425,23 +425,7 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
throw NonFileURIError(uri: file)
}
let compileArguments = try buildTarget.compileArguments(for: fileURL)
#if compiler(>=6.1)
#warning("When we drop support for Swift 5.10 we no longer need to adjust compiler arguments for the Modules move")
#endif
// Fix up compiler arguments that point to a `/Modules` subdirectory if the Swift version in the toolchain is less
// than 6.0 because it places the modules one level higher up.
let toolchainVersion = await orLog("Getting Swift version") { try await toolchain.swiftVersion }
guard let toolchainVersion, toolchainVersion < SwiftVersion(6, 0) else {
return compileArguments
}
return compileArguments.map { argument in
if argument.hasSuffix("/Modules"), argument.contains(self.swiftPMWorkspace.location.scratchDirectory.pathString) {
return String(argument.dropLast(8))
}
return argument
}
return try buildTarget.compileArguments(for: fileURL)
}
package func buildTargets(request: WorkspaceBuildTargetsRequest) async throws -> WorkspaceBuildTargetsResponse {