Skip to content

Commit ab39e87

Browse files
authored
Merge pull request swiftlang#1284 from artemcm/HandleScannerOutputSpecification
[Explicit Module Builds] Handle dependency scanners that produce `-o` arguments explicitly
2 parents 65e0b28 + 6db7d25 commit ab39e87

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,18 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
176176
commandLine.appendFlag(.explicitInterfaceModuleBuild)
177177
}
178178

179-
// Set the output path
180-
commandLine.appendFlag(.o)
181-
commandLine.appendPath(VirtualPath.lookup(moduleInfo.modulePath.path))
179+
// FIXME: This is a temporary measure meant to be deleted once supported toolchains'
180+
// scanners always output commands with '-o'.
181+
//
182+
// If the dependency scanner did not append its own "-o", add it here.
183+
// This is temporary and is meant to handle both: the scanner that
184+
// appends '-o' and one that doesn't, until we have a toolchain snapshot with the scanner
185+
// that appends '-o' always.
186+
let outputFlagIndeces = commandLine.enumerated().compactMap { $1 == .flag("-o") ? $0 : nil }
187+
if outputFlagIndeces.isEmpty {
188+
commandLine.appendFlag(.o)
189+
commandLine.appendPath(VirtualPath.lookup(moduleInfo.modulePath.path))
190+
}
182191

183192
jobs.append(Job(
184193
moduleName: moduleId.moduleName,

Sources/SwiftDriver/ExplicitModuleBuilds/ModuleDependencyScanning.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ extension Diagnostic.Message {
6363
// try resolveVersionedClangDependencies(dependencyGraph: &dependencyGraph)
6464

6565
// Set dependency modules' paths to be saved in the module cache.
66-
try resolveDependencyModulePaths(dependencyGraph: &dependencyGraph)
66+
// try resolveDependencyModulePaths(dependencyGraph: &dependencyGraph)
6767

6868
if parsedOptions.hasArgument(.printExplicitDependencyGraph) {
6969
let outputFormat = parsedOptions.getLastArgument(.explicitDependencyGraphFormat)?.asSingle

0 commit comments

Comments
 (0)