Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ package actor CompilationDatabaseBuildSystem: BuiltInBuildSystem {
let args = command.commandLine
for i in args.indices.reversed() {
if args[i] == "-index-store-path" && i + 1 < args.count {
return URL(fileURLWithPath: args[i + 1])
return URL(
fileURLWithPath: args[i + 1],
relativeTo: URL(fileURLWithPath: command.directory, isDirectory: true)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,25 @@ final class CompilationDatabaseTests: XCTestCase {
)
}
}

func testIndexStorePathRelativeToWorkingDirectory() async throws {
try await checkCompilationDatabaseBuildSystem(
"""
[
{
"file": "a.swift",
"directory": "/a",
"arguments": ["swift", "a.swift", "-index-store-path", "index-store"]
}
]
"""
) { buildSystem in
assertEqual(
try await buildSystem.indexStorePath?.filePath,
"\(pathSeparator)a\(pathSeparator)index-store"
)
}
}
}

fileprivate var pathSeparator: String {
Expand Down