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

Before Change


        jarpath = JAR.create(root, destdir, "output")
      return jarpath

    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):

After Change


    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: 3

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: 5e6868b272957c21483d0a0a39d88f1b29d80d94
Time: 2014-04-23
Author: zundel@squareup.com
File Name: src/python/pants/tasks/protobuf_gen.py
Class Name: ProtobufGen
Method Name: genlang


Project Name: pantsbuild/pants
Commit Name: b2202480258b6f2f5f4e020e86cde975088c7792
Time: 2015-07-11
Author: codyhgibb@gmail.com
File Name: src/python/pants/backend/jvm/tasks/jar_create.py
Class Name: JarCreate
Method Name: execute