Skip to content

Do not add precompiled bridging header to a Compile job's display inputs #530

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 1 commit into from
Mar 8, 2021
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
7 changes: 6 additions & 1 deletion Sources/SwiftDriver/Driver/Driver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1080,8 +1080,13 @@ extension Driver {
}
// All input action IDs for this action.
var inputIds = [UInt]()

var jobInputs = job.primaryInputs.isEmpty ? job.inputs : job.primaryInputs
if let pchPath = bridgingPrecompiledHeader, job.kind == .compile {
jobInputs.append(TypedVirtualPath(file: pchPath, type: .pch))
}
// Collect input job IDs.
for input in job.displayInputs.isEmpty ? job.inputs : job.displayInputs {
for input in jobInputs {
if let id = inputIdMap[input] {
inputIds.append(id)
continue
Expand Down
5 changes: 1 addition & 4 deletions Sources/SwiftDriver/Jobs/CompileJob.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,20 +304,17 @@ extension Driver {
inputs.append(TypedVirtualPath(file: moduleOutputInfo.output!.outputPath, type: .swiftModule))
}

var displayInputs = primaryInputs

// Bridging header is needed for compiling these .swift sources.
if let pchPath = bridgingPrecompiledHeader {
let pchInput = TypedVirtualPath(file: pchPath, type: .pch)
inputs.append(pchInput)
displayInputs.append(pchInput)
}
return Job(
moduleName: moduleOutputInfo.name,
kind: .compile,
tool: .absolute(try toolchain.getToolPath(.swiftCompiler)),
commandLine: commandLine,
displayInputs: displayInputs,
displayInputs: primaryInputs,
inputs: inputs,
primaryInputs: primaryInputs,
outputs: outputs,
Expand Down
14 changes: 10 additions & 4 deletions Sources/SwiftDriver/Jobs/Job.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,18 @@ public struct Job: Codable, Equatable, Hashable {
/// Whether or not the job supports using response files to pass command line arguments.
public var supportsResponseFiles: Bool

/// The list of inputs to use for displaying purposes.
public var displayInputs: [TypedVirtualPath]

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

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

/// The primary inputs for compile jobs
public var primaryInputs: [TypedVirtualPath]

Expand Down