Skip to content

Commit 4b6b994

Browse files
authored
Merge pull request #530 from artemcm/AdjustCompileDisplayInputs
Do not add precompiled bridging header to a Compile job's display inputs
2 parents e7b468a + 31992e4 commit 4b6b994

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,8 +1080,13 @@ extension Driver {
10801080
}
10811081
// All input action IDs for this action.
10821082
var inputIds = [UInt]()
1083+
1084+
var jobInputs = job.primaryInputs.isEmpty ? job.inputs : job.primaryInputs
1085+
if let pchPath = bridgingPrecompiledHeader, job.kind == .compile {
1086+
jobInputs.append(TypedVirtualPath(file: pchPath, type: .pch))
1087+
}
10831088
// Collect input job IDs.
1084-
for input in job.displayInputs.isEmpty ? job.inputs : job.displayInputs {
1089+
for input in jobInputs {
10851090
if let id = inputIdMap[input] {
10861091
inputIds.append(id)
10871092
continue

Sources/SwiftDriver/Jobs/CompileJob.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,20 +357,17 @@ extension Driver {
357357
inputs.append(TypedVirtualPath(file: moduleOutputInfo.output!.outputPath, type: .swiftModule))
358358
}
359359

360-
var displayInputs = primaryInputs
361-
362360
// Bridging header is needed for compiling these .swift sources.
363361
if let pchPath = bridgingPrecompiledHeader {
364362
let pchInput = TypedVirtualPath(file: pchPath, type: .pch)
365363
inputs.append(pchInput)
366-
displayInputs.append(pchInput)
367364
}
368365
return Job(
369366
moduleName: moduleOutputInfo.name,
370367
kind: .compile,
371368
tool: .absolute(try toolchain.getToolPath(.swiftCompiler)),
372369
commandLine: commandLine,
373-
displayInputs: displayInputs,
370+
displayInputs: primaryInputs,
374371
inputs: inputs,
375372
primaryInputs: primaryInputs,
376373
outputs: outputs,

Sources/SwiftDriver/Jobs/Job.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,18 @@ public struct Job: Codable, Equatable, Hashable {
6767
/// Whether or not the job supports using response files to pass command line arguments.
6868
public var supportsResponseFiles: Bool
6969

70-
/// The list of inputs to use for displaying purposes.
71-
public var displayInputs: [TypedVirtualPath]
72-
73-
/// The list of inputs for this job.
70+
/// The list of inputs for this job. These are all files that must be provided in order for this job to execute,
71+
/// and this list, along with the corresponding `outputs` is used to establish producer-consumer dependency
72+
/// relationship among jobs.
7473
public var inputs: [TypedVirtualPath]
7574

75+
/// The list of inputs to use for displaying purposes. These files are the ones the driver will communicate
76+
/// to the user/client as being objects of the selected compilation action.
77+
/// For example, a frontend job to compile a `.swift` source file may require multiple binary `inputs`,
78+
/// such as a pre-compiled bridging header and binary Swift module dependencies, but only the input `.swift`
79+
/// source file is meant to be the displayed object of compilation - a display input.
80+
public var displayInputs: [TypedVirtualPath]
81+
7682
/// The primary inputs for compile jobs
7783
public var primaryInputs: [TypedVirtualPath]
7884

0 commit comments

Comments
 (0)