2d515b55b25a62b1f5961955e977e2fce4ae511e,src/python/pants/backend/jvm/tasks/jvm_dependency_analyzer.py,JvmDependencyAnalyzer,targets_by_file,#JvmDependencyAnalyzer#,48

Before Change



    // Compute jar -> target.
    self.context.log.debug("Mapping jars...")
    compile_classpath = self.context.products.get_data("compile_classpath")
    for jar_lib in self.context.targets(lambda t: isinstance(t, JarLibrary)):
      for _, artifact_path in compile_classpath.get_for_target(jar_lib, transitive=False):
        targets_by_file[artifact_path].add(jar_lib)
        if artifact_path.endswith(".jar"):
          for cls in self._jar_classfiles(artifact_path):
            targets_by_file[cls].add(jar_lib)

    return targets_by_file

  def _jar_classfiles(self, jar_file):
    Returns an iterator over the classfiles inside jar_file.

After Change


    self.context.log.debug("Mapping classpath...")
    for target in self.context.targets():
      // Classpath content.
      files = ClasspathUtil.classpath_contents((target,), runtime_classpath, transitive=False)
      // And jars; for binary deps, zinc doesn"t emit precise deps (yet).
      cp_entries = ClasspathUtil.classpath_entries((target,), runtime_classpath, transitive=False)
      jars = [cpe for cpe in cp_entries if ClasspathUtil.is_jar(cpe)]
      for coll in [files, jars]:
        for f in coll:
          targets_by_file[f].add(target)

    return targets_by_file

  def _jar_classfiles(self, jar_file):
    Returns an iterator over the classfiles inside jar_file.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: src/python/pants/backend/jvm/tasks/jvm_dependency_analyzer.py
Class Name: JvmDependencyAnalyzer
Method Name: targets_by_file


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: src/python/pants/backend/jvm/tasks/junit_run.py
Class Name: _JUnitRunner
Method Name: _calculate_tests_from_targets


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: src/python/pants/backend/jvm/tasks/detect_duplicates.py
Class Name: DuplicateDetector
Method Name: _get_internal_dependencies