b2202480258b6f2f5f4e020e86cde975088c7792,src/python/pants/backend/jvm/tasks/jar_create.py,JarCreate,execute,#JarCreate#,70

Before Change


    safe_mkdir(self.workdir)

    with self.context.new_workunit(name="jar-create", labels=[WorkUnit.MULTITOOL]):
      for target in self.context.targets(is_jvm_library):
        jar_name = jarname(target)
        jar_path = os.path.join(self.workdir, jar_name)
        with self.create_jar(target, jar_path) as jarfile:
          with self.create_jar_builder(jarfile) as jar_builder:
            if target in jar_builder.add_target(target):
              self.context.products.get("jars").add(target, self.workdir).append(jar_name)

  @contextmanager
  def create_jar(self, target, path):
    existing = self._jars.setdefault(path, target)
    if target != existing:

After Change


    return True

  def execute(self):
    with self.invalidated(self.context.targets(is_jvm_library)) as invalidation_check:
      with self.context.new_workunit(name="jar-create", labels=[WorkUnit.MULTITOOL]):
        jar_mapping = self.context.products.get("jars")

        for vt in invalidation_check.all_vts:
          jar_name = vt.target.name + ".jar"
          jar_path = os.path.join(vt.results_dir, jar_name)

          def add_jar_to_products():
            jar_mapping.add(vt.target, vt.results_dir).append(jar_name)

          if vt.valid:
            if os.path.exists(jar_path):
              add_jar_to_products()
          else:
            with self.create_jar(vt.target, jar_path) as jarfile:
              with self.create_jar_builder(jarfile) as jar_builder:
                if vt.target in jar_builder.add_target(vt.target):
                  add_jar_to_products()

  @contextmanager
  def create_jar(self, target, path):
    existing = self._jars.setdefault(path, target)
    if target != existing:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


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


Project Name: pantsbuild/pants
Commit Name: 43df0378febb1fc8366243d321e01ef833c3265f
Time: 2015-08-18
Author: garrett.malmquist@gmail.com
File Name: src/python/pants/backend/jvm/tasks/jvm_platform_analysis.py
Class Name: JvmPlatformValidate
Method Name: validate_platform_dependencies


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: ed0a8b99a9497a179611e0dd772fde31a3129c93
Time: 2015-02-12
Author: nhoward@twopensource.com
File Name: src/python/pants/backend/codegen/tasks/thrift_linter.py
Class Name: ThriftLinter
Method Name: execute