433f58d04f6318903ada530948a47848b6a772e5,src/python/twitter/pants/tasks/task.py,Task,ivy_resolve,#Task#Any#Any#Any#Any#Any#Any#Any#,300

Before Change


        if not os.path.exists(target_classpath_file_tmp):
          raise TaskError("Ivy failed to create classpath file at %s" % target_classpath_file_tmp)
        shutil.move(target_classpath_file_tmp, target_classpath_file)
        if self.get_artifact_cache() and self.context.options.write_to_artifact_cache:
          self.update_artifact_cache([(global_vts, [target_classpath_file])])

    with IvyUtils.cachepath(target_classpath_file) as classpath:

After Change


      items_to_report_element([t.address.reference() for t in targets], "target"),
      suffix)

  def ivy_resolve(self, targets, java_runner=None, ivy_args=None, symlink_ivyxml=False, silent=False,
                  workunit_name=None, workunit_labels=None):
    java_runner = java_runner or runjava_indivisible

    ivy_args = ivy_args or []

    targets = set(targets)

    if not targets:
      return []
    
    work_dir = self.context.config.get("ivy-resolve", "workdir")
    confs = self.context.config.getlist("ivy-resolve", "confs")

    with self.invalidated(targets,
                          only_buildfiles=True,
                          invalidate_dependents=True,
                          silent=silent) as invalidation_check:
      global_vts = VersionedTargetSet.from_versioned_targets(invalidation_check.all_vts)
      target_workdir = os.path.join(work_dir, global_vts.cache_key.hash)
      target_classpath_file = os.path.join(target_workdir, "classpath")
      target_classpath_file_tmp = target_classpath_file + ".tmp"
      // Note that it"s possible for all targets to be valid but for no classpath file to exist at
      // target_classpath_file, e.g., if we previously built a superset of targets.
      if invalidation_check.invalid_vts or not os.path.exists(target_classpath_file):
        ivy_utils = IvyUtils(config=self.context.config,
                             options=self.context.options,
                             log=self.context.log)
        args = (["-cachepath", target_classpath_file_tmp] +
                ["-confs"] + confs +
                ivy_args)

        def exec_ivy():
          ivy_utils.exec_ivy(
            target_workdir=target_workdir,
            targets=targets,
            args=args,
            runjava=java_runner,
            workunit_name="ivy",
            workunit_factory=self.context.new_workunit,
            symlink_ivyxml=symlink_ivyxml,
          )

        if workunit_name:
          with self.context.new_workunit(name=workunit_name, labels=workunit_labels or []):
            exec_ivy()
        else:
          exec_ivy()

        if not os.path.exists(target_classpath_file_tmp):
          raise TaskError("Ivy failed to create classpath file at %s" % target_classpath_file_tmp)
        shutil.move(target_classpath_file_tmp, target_classpath_file)
        if self.artifact_cache_writes_enabled():
          self.update_artifact_cache([(global_vts, [target_classpath_file])])

    with IvyUtils.cachepath(target_classpath_file) as classpath:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: pantsbuild/pants
Commit Name: 433f58d04f6318903ada530948a47848b6a772e5
Time: 2013-12-05
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/task.py
Class Name: Task
Method Name: ivy_resolve


Project Name: pantsbuild/pants
Commit Name: 433f58d04f6318903ada530948a47848b6a772e5
Time: 2013-12-05
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/code_gen.py
Class Name: CodeGen
Method Name: execute


Project Name: pantsbuild/pants
Commit Name: 433f58d04f6318903ada530948a47848b6a772e5
Time: 2013-12-05
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: 433f58d04f6318903ada530948a47848b6a772e5
Time: 2013-12-05
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/scala_compile.py
Class Name: ScalaCompile
Method Name: execute