code: def _upstream_analysis(self, compile_contexts, classpath_entries):
      
      # Reorganize the compile_contexts by class directory.
      compile_contexts_by_directory = {}
      for compile_context in compile_contexts.values():
        compile_context = self.select_runtime_context(compile_context)
        compile_contexts_by_directory[compile_context.classes_dir.path] = compile_context
      # If we have a compile context for the target, include it.
      for entry in classpath_entries:
        path = entry.path
        if not path.endswith('.jar'):
          compile_context = compile_contexts_by_directory.get(path)
          if not compile_context:
            self.context.log.debug('Missing upstream analysis for {}'.format(path))
          else:
            yield compile_context.classes_dir.path, compile_context.analysis_file
docs: Returns tuples of classes_dir->analysis_file for the closure of the target.