Skip to content

Commit acfcfc1

Browse files
authored
Merge pull request #77415 from hamishknight/reenable-xcodegen-test
[xcodegen] Allow `output` to be missing in `compile_commands.json`
2 parents 72f49bd + 94b744c commit acfcfc1

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

utils/swift-xcodegen/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ PROJECT CONFIGURATION:
7474
Generate a target for C/C++ files in the standard library (default: --stdlib)
7575
--stdlib-swift/--no-stdlib-swift
7676
Generate targets for Swift files in the standard library. This requires
77-
using Xcode with with a main development snapshot (and as such is disabled
77+
using Xcode with a main development snapshot (and as such is disabled
7878
by default). (default: --no-stdlib-swift)
7979
--test-folders/--no-test-folders
8080
Add folder references for test files (default: --test-folders)

utils/swift-xcodegen/Sources/SwiftXcodeGen/BuildArgs/ClangBuildArgsProvider.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ struct ClangBuildArgsProvider {
3434
// Gather the candidates for each file to get build arguments for. We may
3535
// have multiple outputs, in which case, pick the first one that exists.
3636
var commandsToAdd: [RelativePath:
37-
(output: AbsolutePath, args: [Command.Argument])] = [:]
37+
(output: AbsolutePath?, args: [Command.Argument])] = [:]
3838
for command in parsed {
3939
guard command.command.executable.knownCommand == .clang,
4040
let relFilePath = command.file.removingPrefix(repoPath)
4141
else {
4242
continue
4343
}
44-
let output = command.directory.appending(command.output)
44+
let output = command.output.map { command.directory.appending($0) }
4545
if let existing = commandsToAdd[relFilePath],
46-
existing.output.exists || !output.exists {
46+
let existingOutput = existing.output,
47+
output == nil || existingOutput.exists || !output!.exists {
4748
continue
4849
}
4950
commandsToAdd[relFilePath] = (output, command.command.args)

utils/swift-xcodegen/Sources/SwiftXcodeGen/Command/CompileCommands.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension CompileCommands {
2727
struct Element: Decodable {
2828
var directory: AbsolutePath
2929
var file: AbsolutePath
30-
var output: RelativePath
30+
var output: RelativePath?
3131
var command: Command
3232
}
3333
}

utils/swift-xcodegen/Sources/swift-xcodegen/Options.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct ProjectOptions: ParsableArguments {
164164
name: .customLong("stdlib-swift"), inversion: .prefixedNo,
165165
help: """
166166
Generate targets for Swift files in the standard library. This requires
167-
using Xcode with with a main development snapshot (and as such is disabled
167+
using Xcode with a main development snapshot (and as such is disabled
168168
by default).
169169
"""
170170
)

validation-test/BuildSystem/swift-xcodegen.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# REQUIRES: standalone_build
99
# REQUIRES: target-same-as-host
1010

11-
# REQUIRES: issue_77407
12-
1311
# First copy swift-xcodegen to the temporary location
1412
# so we don't touch the user's build, and make sure
1513
# we're doing a clean build.

0 commit comments

Comments
 (0)