Skip to content
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

Vend modulesPath as API to SourceKit-LSP #7200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ public final class SwiftTargetBuildDescription {
}
}

var modulesPath: AbsolutePath {
public var modulesPath: AbsolutePath { // note: needs to be public because of sourcekit-lsp
return self.buildParameters.buildPath.appending(component: "Modules")
}

/// The path to the swiftmodule file after compilation.
public var moduleOutputPath: AbsolutePath { // note: needs to be public because of sourcekit-lsp
var moduleOutputPath: AbsolutePath {
// If we're an executable and we're not allowing test targets to link against us, we hide the module.
let triple = buildParameters.triple
let allowLinkingAgainstExecutables = (triple.isDarwin() || triple.isLinux() || triple.isWindows()) && self.toolsVersion >= .v5_5
Expand Down
2 changes: 1 addition & 1 deletion Sources/Build/BuildPlan/BuildPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
for target in targets {
switch target {
case .swift(let targetDescription):
arguments += ["-I", targetDescription.moduleOutputPath.parentDirectory.pathString]
arguments += ["-I", targetDescription.modulesPath.pathString]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These paths aren't the same I assume? If so, shouldn't this change have some impact on the test suite, either requiring to update tests or add a new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're the same in the majority of cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'm worried about the fact that the remaining minority of cases doesn't seem to be covered with tests, otherwise this change would've broken such tests?

case .clang(let targetDescription):
if let includeDir = targetDescription.moduleMap?.parentDirectory {
arguments += ["-I", includeDir.pathString]
Expand Down