Пример #1
0
 def _compute_classes_by_src(artifact):
   """Compute src->classes."""
   if not os.path.exists(artifact.analysis_file):
     return {}
   len_rel_classes_dir = len(artifact.classes_dir) - len(get_buildroot())
   analysis = ZincAnalysisCollection(stop_after=ZincAnalysisCollection.PRODUCTS)
   analysis.add_and_parse_file(artifact.analysis_file, artifact.classes_dir)
   classes_by_src = {}
   for src, classes in analysis.products.items():
     classes_by_src[src] = [cls[len_rel_classes_dir:] for cls in classes]
   return classes_by_src
Пример #2
0
  def get_analysis_collection(self):
    """ Populates and retrieves the merged analysis collection for this compilation """

    if self.zinc_analysis_collection is None:
      self.zinc_analysis_collection = \
          ZincAnalysisCollection(False,
                                 package_prefixes=self.package_prefixes)
      for af in self.all_analysis_files:
        basedir = os.path.relpath(af.class_basedir, self.context._buildroot)
        self.zinc_analysis_collection.add_and_parse_file(af.analysis_file, basedir)
    return self.zinc_analysis_collection
Пример #3
0
    def _get_deleted_sources(self):
        """Returns the list of sources present in the last analysis that have since been deleted.

    This is a global list. We have no way of associating them to individual targets.
    """
        # We compute the list lazily.
        if self._deleted_sources is None:
            with self.context.new_workunit('find-deleted-sources'):
                analysis = ZincAnalysisCollection(
                    stop_after=ZincAnalysisCollection.PRODUCTS)
                if os.path.exists(self._analysis_file):
                    analysis.add_and_parse_file(self._analysis_file,
                                                self._classes_dir)
                old_sources = analysis.products.keys()
                self._deleted_sources = filter(lambda x: not os.path.exists(x),
                                               old_sources)
        return self._deleted_sources