Skip to content

Commit c23b4ff

Browse files
authored
Merge pull request #1803 from ahoppen/indexbuild-subfolder
Make `.index-build` a subdirectory of `.build`
2 parents 6237c30 + ec0a7c4 commit c23b4ff

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

.devcontainer/default/devcontainer.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
"mounts": [
1111
// Use a named volume for the build products for optimal performance (https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume)
12-
"source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/.build,type=volume",
13-
// Do the same for experimental background indexing
14-
"source=${localWorkspaceFolderBasename}-index-build,target=${containerWorkspaceFolder}/.index-build,type=volume"
12+
"source=${localWorkspaceFolderBasename}-build,target=${containerWorkspaceFolder}/.build,type=volume"
1513
],
1614
"customizations": {
1715
"vscode": {

Documentation/Enable Experimental Background Indexing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ By default SourceKit-LSP does not update its global index in the background or b
3434

3535
If you hit any issues that are not mentioned above, please [file a GitHub issue](https://github.com/swiftlang/sourcekit-lsp/issues/new/choose) and attach the following information, if possible:
3636
- A diagnostic bundle generated by running `path/to/sourcekit-lsp diagnose`.
37-
- Your project including the `.index-build` folder, if possible.
37+
- Your project including the `.build` folder, if possible.

Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
207207

208208
package let connectionToSourceKitLSP: any Connection
209209

210-
/// Whether the `SwiftPMBuildSystem` is pointed at a `.index-build` directory that's independent of the
210+
/// Whether the `SwiftPMBuildSystem` is pointed at a `.build/index-build` directory that's independent of the
211211
/// user's build.
212212
private var isForIndexBuild: Bool { options.backgroundIndexingOrDefault }
213213

@@ -322,7 +322,7 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
322322
fileSystem: localFileSystem
323323
)
324324
if options.backgroundIndexingOrDefault {
325-
location.scratchDirectory = AbsolutePath(projectRoot.appending(component: ".index-build"))
325+
location.scratchDirectory = AbsolutePath(projectRoot.appending(components: ".build", "index-build"))
326326
} else if let scratchDirectory = options.swiftPMOrDefault.scratchPath,
327327
let scratchDirectoryPath = try? AbsolutePath(validating: scratchDirectory)
328328
{

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,8 @@ final class BackgroundIndexingTests: XCTestCase {
868868
let nestedIndexBuildURL = try XCTUnwrap(
869869
project.uri(for: "OtherLib.swift").fileURL?
870870
.deletingLastPathComponent()
871-
.appendingPathComponent(".index-build")
871+
.appendingPathComponent(".build")
872+
.appendingPathComponent("index-build")
872873
)
873874
XCTAssertFalse(
874875
FileManager.default.fileExists(at: nestedIndexBuildURL),
@@ -1237,7 +1238,7 @@ final class BackgroundIndexingTests: XCTestCase {
12371238
// Simulate a package update which goes as follows:
12381239
// - The user runs `swift package update`
12391240
// - This updates `Package.resolved`, which we watch
1240-
// - We reload the package, which updates `Dependency.swift` in `.index-build/checkouts`, which we also watch.
1241+
// - We reload the package, which updates `Dependency.swift` in `.build/index-build/checkouts`, which we also watch.
12411242
try await Process.run(
12421243
arguments: [
12431244
unwrap(ToolchainRegistry.forTesting.default?.swift?.pathString),

0 commit comments

Comments
 (0)