Skip to content

[xcodegen] Allow output to be missing in compile_commands.json #77415

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
Nov 6, 2024
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
2 changes: 1 addition & 1 deletion utils/swift-xcodegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ PROJECT CONFIGURATION:
Generate a target for C/C++ files in the standard library (default: --stdlib)
--stdlib-swift/--no-stdlib-swift
Generate targets for Swift files in the standard library. This requires
using Xcode with with a main development snapshot (and as such is disabled
using Xcode with a main development snapshot (and as such is disabled
by default). (default: --no-stdlib-swift)
--test-folders/--no-test-folders
Add folder references for test files (default: --test-folders)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ struct ClangBuildArgsProvider {
// Gather the candidates for each file to get build arguments for. We may
// have multiple outputs, in which case, pick the first one that exists.
var commandsToAdd: [RelativePath:
(output: AbsolutePath, args: [Command.Argument])] = [:]
(output: AbsolutePath?, args: [Command.Argument])] = [:]
for command in parsed {
guard command.command.executable.knownCommand == .clang,
let relFilePath = command.file.removingPrefix(repoPath)
else {
continue
}
let output = command.directory.appending(command.output)
let output = command.output.map { command.directory.appending($0) }
if let existing = commandsToAdd[relFilePath],
existing.output.exists || !output.exists {
let existingOutput = existing.output,
output == nil || existingOutput.exists || !output!.exists {
continue
}
commandsToAdd[relFilePath] = (output, command.command.args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extension CompileCommands {
struct Element: Decodable {
var directory: AbsolutePath
var file: AbsolutePath
var output: RelativePath
var output: RelativePath?
var command: Command
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ struct ProjectOptions: ParsableArguments {
name: .customLong("stdlib-swift"), inversion: .prefixedNo,
help: """
Generate targets for Swift files in the standard library. This requires
using Xcode with with a main development snapshot (and as such is disabled
using Xcode with a main development snapshot (and as such is disabled
by default).
"""
)
Expand Down
2 changes: 0 additions & 2 deletions validation-test/BuildSystem/swift-xcodegen.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
# REQUIRES: standalone_build
# REQUIRES: target-same-as-host

# REQUIRES: issue_77407

# First copy swift-xcodegen to the temporary location
# so we don't touch the user's build, and make sure
# we're doing a clean build.
Expand Down