   /// The context required during job execution.
   struct Context {
 
-    /// This contains mapping from an output to the job that produces that output.
-    let producerMap: [VirtualPath: Job]
+    /// This contains mapping from an output to the index(in the jobs array) of the job that produces that output.
+    let producerMap: [VirtualPath: Int]
+
+    /// All the jobs being executed.
+    let jobs: [Job]
 
     /// The resolver for argument template.
     let argsResolver: ArgsResolver

      env: env,
      fileSystem: fileSystem,
      producerMap: producerMap,
      executorDelegate: executorDelegate,
      jobQueue: jobQueue,
      processSet: processSet,

  struct RuleKey: LLBuildKey {
    typealias BuildValue = DriverBuildValue
    typealias BuildRule = ExecuteAllJobsRule
  }

  override class var ruleName: String { "\(ExecuteAllJobsRule.self)" }

  private let key: RuleKey
  private let jobs: [Job]

  /// True if any of the inputs had any error.
  private var allInputsSucceeded: Bool = true

  init(_ key: Key, jobs: [Job], fileSystem: FileSystem) {
    self.key = RuleKey(key)
    self.jobs = jobs
    super.init(fileSystem: fileSystem)
  }

  override func start(_ engine: LLTaskBuildEngine) {
    for index in jobs.indices {
      let key = ExecuteJobRule.RuleKey(index: index)
      engine.taskNeedsInput(key, inputID: index)
    }
  }

