     try unhandledModules.forEach { moduleName in
       diagnosticEngine.emit(warning: "handle \(moduleName) as dangling jobs")
       try forEachInputOutputPair(moduleName) { input, output in
-        danglingJobs.append(try generateSingleModuleBuildingJob(moduleName,
-          prebuiltModuleDir, input, output, [], abiDumpDir))
+        danglingJobs.append(contentsOf: try generateSingleModuleBuildingJob(moduleName,
+          prebuiltModuleDir, input, output, [], abiDumpDir, abiBaselineDir))
       }
     }
 

      inputs: dependencies,
      primaryInputs: [],
      outputs: allOutputs
    )
  }

  public mutating func generatePrebuitModuleGenerationJobs(with inputMap: [String: [PrebuiltModuleInput]],
                                                           into prebuiltModuleDir: AbsolutePath,
                                                           exhaustive: Bool,
                                                           dotGraphPath: AbsolutePath? = nil,
                                                           abiDumpDir: AbsolutePath? = nil) throws -> ([Job], [Job]) {
    assert(sdkPath != nil)
    // Run the dependency scanner and update the dependency oracle with the results
    // We only need Swift dependencies here, so we don't need to invoke gatherModuleDependencies,


extension Driver {

  fileprivate mutating func generateABICheckJob(_ moduleName: String,
                                                _ baselineABIDir: AbsolutePath,
                                                _ currentABI: TypedVirtualPath) throws -> Job? {
    let baselineABI = TypedVirtualPath(file: VirtualPath.absolute(baselineABIDir
      .appending(component: "\(moduleName).swiftmodule")
      .appending(component: currentABI.file.basename)).intern(), type: .jsonABIBaseline)
    guard try localFileSystem.exists(baselineABI.file) else {
      return nil
    }
    var commandLine: [Job.ArgTemplate] = []
    commandLine.appendFlag(.diagnoseSdk)
    commandLine.appendFlag(.inputPaths)
    commandLine.appendPath(baselineABI.file)
    commandLine.appendFlag(.inputPaths)
    commandLine.appendPath(currentABI.file)
    commandLine.appendFlag(.compilerStyleDiags)
    commandLine.appendFlag(.abi)
    commandLine.appendFlag(.swiftOnly)
    commandLine.appendFlag(.printModule)
    return Job(
      moduleName: moduleName,
      kind: .compareABIBaseline,
      tool: .absolute(try toolchain.getToolPath(.swiftAPIDigester)),
      commandLine: commandLine,
      inputs: [currentABI, baselineABI],
      primaryInputs: [],
      outputs: []
    )
  }

  private mutating func generateSingleModuleBuildingJob(_ moduleName: String,  _ prebuiltModuleDir: AbsolutePath,
                                                        _ inputPath: PrebuiltModuleInput, _ outputPath: PrebuiltModuleOutput,
                                                        _ dependencies: [TypedVirtualPath], _ abiDumpDir: AbsolutePath?,
                                                        _ abiBaselineDir: AbsolutePath?) throws -> [Job] {
    assert(inputPath.path.file.basenameWithoutExt == outputPath.path.file.basenameWithoutExt)
    var commandLine: [Job.ArgTemplate] = []
    commandLine.appendFlag(.compileModuleFromInterface)
