136206c62ff375644ac5f0b76f619d049ecd34e0,src/python/pants/backend/jvm/tasks/bundle_create.py,BundleCreate,consolidate_classpath,#BundleCreate#Any#Any#,177

Before Change



    safe_mkdir(self.workdir)
    for target in targets:
      entries = classpath_products.get_internal_classpath_entries_for_targets([target])
      for conf, entry in entries:
        if ClasspathUtil.is_dir(entry.path):
          classpath_products.remove_for_target(target, [(conf, entry.path)])

After Change


  def consolidate_classpath(self, targets, classpath_products):
    Convert loose directories in classpath_products into jars. 

    with self.invalidated(targets=targets, invalidate_dependents=True) as invalidation:
      for vt in invalidation.all_vts:
        entries = classpath_products.get_internal_classpath_entries_for_targets([vt.target])
        for index, (conf, entry) in enumerate(entries):
          if ClasspathUtil.is_dir(entry.path):
            // regenerate artifact for invalid vts
            if not vt.valid:
              JAR.create(entry.path, vt.results_dir, "output-{}".format(index))

            // replace directory classpath entry with its jarpath
            jarpath = os.path.join(vt.results_dir, "output-{}.jar".format(index))
            classpath_products.remove_for_target(vt.target, [(conf, entry.path)])
            classpath_products.add_for_target(vt.target, [(conf, jarpath)])

  def find_consolidate_classpath_candidates(self, classpath_products, targets):
    targets_with_directory_in_classpath = []
    for target in targets:
      entries = classpath_products.get_internal_classpath_entries_for_targets([target])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: 136206c62ff375644ac5f0b76f619d049ecd34e0
Time: 2016-01-08
Author: wangpeiyu@gmail.com
File Name: src/python/pants/backend/jvm/tasks/bundle_create.py
Class Name: BundleCreate
Method Name: consolidate_classpath


Project Name: pantsbuild/pants
Commit Name: 85f718d2be727a9b720b7d0910a0601607b0f196
Time: 2012-08-20
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/java_compile.py
Class Name: JavaCompile
Method Name: execute


Project Name: pantsbuild/pants
Commit Name: 85f718d2be727a9b720b7d0910a0601607b0f196
Time: 2012-08-20
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/scala_compile.py
Class Name: ScalaCompile
Method Name: execute