Skip to content

Gardening #1950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,14 @@ var targets: [Target] = [
.target(
name: "CompletionScoring",
dependencies: ["CCompletionScoring"],
exclude: ["CMakeLists.txt"],
swiftSettings: globalSwiftSettings
),

.target(
name: "CompletionScoringForPlugin",
dependencies: ["CCompletionScoring"],
exclude: ["CMakeLists.txt"],
swiftSettings: globalSwiftSettings
),

Expand Down Expand Up @@ -549,6 +551,7 @@ var targets: [Target] = [
"SwiftExtensionsForPlugin",
"SwiftSourceKitPluginCommon",
],
exclude: ["CMakeLists.txt"],
swiftSettings: globalSwiftSettings + [
.unsafeFlags([
"-module-alias", "SourceKitD=SourceKitDForPlugin",
Expand All @@ -568,6 +571,7 @@ var targets: [Target] = [
"SwiftExtensionsForPlugin",
"SKLoggingForPlugin",
],
exclude: ["CMakeLists.txt"],
swiftSettings: globalSwiftSettings + [
.unsafeFlags([
"-module-alias", "SourceKitD=SourceKitDForPlugin",
Expand All @@ -590,6 +594,7 @@ var targets: [Target] = [
"SwiftSourceKitPluginCommon",
"SwiftExtensionsForPlugin",
],
exclude: ["CMakeLists.txt"],
swiftSettings: globalSwiftSettings + [
.unsafeFlags([
"-module-alias", "CompletionScoring=CompletionScoringForPlugin",
Expand Down
18 changes: 1 addition & 17 deletions Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -413,23 +413,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 {
Expand Down
Loading