Skip to content

Commit 2ed97d4

Browse files
authored
Merge pull request #1036 from allevato/separate-module-response-files
Refactor job response file handling to (hopefully) prevent regressions.
2 parents f84b001 + 7cf36a7 commit 2ed97d4

31 files changed

+212
-97
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
172172
jobs.append(Job(
173173
moduleName: moduleId.moduleName,
174174
kind: .emitModule,
175-
tool: .absolute(try toolchain.getToolPath(.swiftCompiler)),
175+
tool: try toolchain.resolvedTool(.swiftCompiler),
176176
commandLine: commandLine,
177177
inputs: inputs,
178178
primaryInputs: [],
@@ -237,7 +237,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
237237
jobs.append(Job(
238238
moduleName: moduleId.moduleName,
239239
kind: .generatePCM,
240-
tool: .absolute(try toolchain.getToolPath(.swiftCompiler)),
240+
tool: try toolchain.resolvedTool(.swiftCompiler),
241241
commandLine: commandLine,
242242
inputs: inputs,
243243
primaryInputs: [],

Sources/SwiftDriver/ExplicitModuleBuilds/ModuleDependencyScanning.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ public extension Driver {
3030
// Construct the scanning job.
3131
return Job(moduleName: moduleOutputInfo.name,
3232
kind: .scanDependencies,
33-
tool: VirtualPath.absolute(try toolchain.getToolPath(.swiftCompiler)),
33+
tool: try toolchain.resolvedTool(.swiftCompiler),
3434
commandLine: commandLine,
3535
displayInputs: inputs,
3636
inputs: inputs,
3737
primaryInputs: [],
38-
outputs: [TypedVirtualPath(file: .standardOutput, type: .jsonDependencies)],
39-
supportsResponseFiles: false)
38+
outputs: [TypedVirtualPath(file: .standardOutput, type: .jsonDependencies)])
4039
}
4140

4241
/// Generate a full command-line invocation to be used for the dependency scanning action
@@ -263,13 +262,12 @@ public extension Driver {
263262
// Construct the scanning job.
264263
return Job(moduleName: moduleOutputInfo.name,
265264
kind: .scanDependencies,
266-
tool: VirtualPath.absolute(try toolchain.getToolPath(.swiftCompiler)),
265+
tool: try toolchain.resolvedTool(.swiftCompiler),
267266
commandLine: commandLine,
268267
displayInputs: inputs,
269268
inputs: inputs,
270269
primaryInputs: [],
271-
outputs: [TypedVirtualPath(file: .standardOutput, type: .jsonDependencies)],
272-
supportsResponseFiles: false)
270+
outputs: [TypedVirtualPath(file: .standardOutput, type: .jsonDependencies)])
273271
}
274272

275273
/// Precompute the dependencies for a given collection of modules using swift frontend's batch scanning mode
@@ -312,13 +310,12 @@ public extension Driver {
312310
// Construct the scanning job.
313311
return Job(moduleName: moduleOutputInfo.name,
314312
kind: .scanDependencies,
315-
tool: VirtualPath.absolute(try toolchain.getToolPath(.swiftCompiler)),
313+
tool: try toolchain.resolvedTool(.swiftCompiler),
316314
commandLine: commandLine,
317315
displayInputs: inputs,
318316
inputs: inputs,
319317
primaryInputs: [],
320-
outputs: outputs,
321-
supportsResponseFiles: false)
318+
outputs: outputs)
322319
}
323320

324321
/// Serialize a collection of modules into an input format expected by the batch module dependency scanner.

Sources/SwiftDriver/Jobs/APIDigesterJobs.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ extension Driver {
5656
return Job(
5757
moduleName: moduleOutputInfo.name,
5858
kind: mode.baselineGenerationJobKind,
59-
tool: .absolute(try toolchain.getToolPath(.swiftAPIDigester)),
59+
tool: try toolchain.resolvedTool(.swiftAPIDigester),
6060
commandLine: commandLine,
6161
inputs: [.init(file: modulePath, type: .swiftModule)],
6262
primaryInputs: [],
63-
outputs: [.init(file: outputPath, type: mode.baselineFileType)],
64-
supportsResponseFiles: true
63+
outputs: [.init(file: outputPath, type: mode.baselineFileType)]
6564
)
6665
}
6766

@@ -100,12 +99,11 @@ extension Driver {
10099
return Job(
101100
moduleName: moduleOutputInfo.name,
102101
kind: .compareABIBaseline,
103-
tool: .absolute(try toolchain.getToolPath(.swiftAPIDigester)),
102+
tool: try toolchain.resolvedTool(.swiftAPIDigester),
104103
commandLine: commandLine,
105104
inputs: inputs,
106105
primaryInputs: [],
107-
outputs: [diag],
108-
supportsResponseFiles: true
106+
outputs: [diag]
109107
)
110108
}
111109

@@ -141,12 +139,11 @@ extension Driver {
141139
return Job(
142140
moduleName: moduleOutputInfo.name,
143141
kind: mode.baselineComparisonJobKind,
144-
tool: .absolute(try toolchain.getToolPath(.swiftAPIDigester)),
142+
tool: try toolchain.resolvedTool(.swiftAPIDigester),
145143
commandLine: commandLine,
146144
inputs: inputs,
147145
primaryInputs: [],
148-
outputs: [.init(file: serializedDiagnosticsPath ?? VirtualPath.Handle.standardOutput, type: .diagnostics)],
149-
supportsResponseFiles: true
146+
outputs: [.init(file: serializedDiagnosticsPath ?? VirtualPath.Handle.standardOutput, type: .diagnostics)]
150147
)
151148
}
152149

Sources/SwiftDriver/Jobs/AutolinkExtractJob.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ extension Driver {
4343
return Job(
4444
moduleName: moduleOutputInfo.name,
4545
kind: .autolinkExtract,
46-
tool: .absolute(try toolchain.getToolPath(.swiftAutolinkExtract)),
46+
tool: try toolchain.resolvedTool(.swiftAutolinkExtract),
4747
commandLine: commandLine,
4848
inputs: inputs,
4949
primaryInputs: [],
50-
outputs: [.init(file: output.intern(), type: .autolink)],
51-
supportsResponseFiles: true
50+
outputs: [.init(file: output.intern(), type: .autolink)]
5251
)
5352
}
5453
}

Sources/SwiftDriver/Jobs/BackendJob.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ extension Driver {
7070
return Job(
7171
moduleName: moduleOutputInfo.name,
7272
kind: .backend,
73-
tool: .absolute(try toolchain.getToolPath(.swiftCompiler)),
73+
tool: try toolchain.resolvedTool(.swiftCompiler),
7474
commandLine: commandLine,
7575
displayInputs: inputs,
7676
inputs: inputs,
7777
primaryInputs: [],
78-
outputs: outputs,
79-
supportsResponseFiles: true
78+
outputs: outputs
8079
)
8180
}
8281
}

Sources/SwiftDriver/Jobs/CompileJob.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,13 @@ extension Driver {
383383
return Job(
384384
moduleName: moduleOutputInfo.name,
385385
kind: .compile,
386-
tool: .absolute(try toolchain.getToolPath(.swiftCompiler)),
386+
tool: try toolchain.resolvedTool(.swiftCompiler),
387387
commandLine: commandLine,
388388
displayInputs: displayInputs,
389389
inputs: inputs,
390390
primaryInputs: primaryInputs,
391391
outputs: outputs,
392-
inputOutputMap: inputOutputMap,
393-
supportsResponseFiles: true
392+
inputOutputMap: inputOutputMap
394393
)
395394
}
396395
}

Sources/SwiftDriver/Jobs/DarwinToolchain+LinkerSupport.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ extension DarwinToolchain {
206206
lto: LTOKind?,
207207
sanitizers: Set<Sanitizer>,
208208
targetInfo: FrontendTargetInfo
209-
) throws -> AbsolutePath {
209+
) throws -> ResolvedTool {
210210
// Set up for linking.
211211
let linkerTool: Tool
212212
switch linkerOutputType {
@@ -251,7 +251,7 @@ extension DarwinToolchain {
251251
commandLine.appendFlag("-o")
252252
commandLine.appendPath(outputFile)
253253

254-
return try getToolPath(linkerTool)
254+
return try resolvedTool(linkerTool)
255255
}
256256

257257
private func addLinkInputs(shouldUseInputFileList: Bool,

Sources/SwiftDriver/Jobs/EmitModuleJob.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ extension Driver {
120120
return Job(
121121
moduleName: moduleOutputInfo.name,
122122
kind: .emitModule,
123-
tool: .absolute(try toolchain.getToolPath(.swiftCompiler)),
123+
tool: try toolchain.resolvedTool(.swiftCompiler),
124124
commandLine: commandLine,
125125
inputs: inputs,
126126
primaryInputs: [],

Sources/SwiftDriver/Jobs/EmitSupportedFeaturesJob.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ extension Toolchain {
4040
return Job(
4141
moduleName: "",
4242
kind: .emitSupportedFeatures,
43-
tool: .absolute(try getToolPath(.swiftCompiler)),
43+
tool: try resolvedTool(.swiftCompiler),
4444
commandLine: commandLine,
4545
displayInputs: [],
4646
inputs: inputs,
4747
primaryInputs: [],
4848
outputs: [.init(file: .standardOutput, type: .jsonCompilerFeatures)],
49-
requiresInPlaceExecution: requiresInPlaceExecution,
50-
supportsResponseFiles: false
49+
requiresInPlaceExecution: requiresInPlaceExecution
5150
)
5251
}
5352
}

Sources/SwiftDriver/Jobs/GenerateDSYMJob.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension Driver {
3333
return Job(
3434
moduleName: moduleOutputInfo.name,
3535
kind: .generateDSYM,
36-
tool: .absolute(try toolchain.getToolPath(.dsymutil)),
36+
tool: try toolchain.resolvedTool(.dsymutil),
3737
commandLine: commandLine,
3838
displayInputs: [],
3939
inputs: inputs,

0 commit comments

Comments
 (0)