461bb39fbdd9f49ff21a6be038ffbd2e7ae622b0,src/python/pants/backend/android/tasks/dx_compile.py,DxCompile,execute,#DxCompile#,79

Before Change



  def execute(self):
    with self.context.new_workunit(name="dx-compile", labels=[WorkUnit.MULTITOOL]):
      targets = self.context.targets(self.is_dextarget)
      with self.invalidated(targets) as invalidation_check:
        invalid_targets = []
        for vt in invalidation_check.invalid_vts:
          invalid_targets.extend(vt.targets)
        for target in invalid_targets:
          outdir = self.dx_out(target)
          safe_mkdir(outdir)
          classes_by_target = self.context.products.get_data("classes_by_target")
          classes = []

          def add_to_dex(tgt):
            target_classes = classes_by_target.get(tgt)
            if target_classes:

              def add_classes(target_products):
                for _, products in target_products.abs_paths():
                  for prod in products:
                    classes.append(prod)

              add_classes(target_classes)

          target.walk(add_to_dex)
          if not classes:
            raise TaskError("No classes were found for {0!r}.".format(target))
          args = self._render_args(outdir, classes)
          self._compile_dex(args, target.build_tools_version)
      for target in targets:
        self.context.products.get("dex").add(target, self.dx_out(target)).append(self.DEX_NAME)

  def dx_jar_tool(self, build_tools_version):
    Return the appropriate dx.jar.

    :param string build_tools_version: The Android build-tools version number (e.g. "19.1.0").

After Change



    with self.invalidated(targets) as invalidation_check:
      for vt in invalidation_check.all_vts:
        if not vt.valid:
          classes = self._gather_classes(vt.target)
          if not classes:
            raise self.EmptyDexError("No classes were found for {}.".format(vt.target))

          args = self._render_args(vt.results_dir, classes)
          self._compile_dex(args, vt.target.build_tools_version)
        self.context.products.get("dex").add(vt.target, vt.results_dir).append(self.DEX_NAME)

  def dx_jar_tool(self, build_tools_version):
    Return the appropriate dx.jar.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: 461bb39fbdd9f49ff21a6be038ffbd2e7ae622b0
Time: 2015-07-30
Author: mateorod9@gmail.com
File Name: src/python/pants/backend/android/tasks/dx_compile.py
Class Name: DxCompile
Method Name: execute


Project Name: pantsbuild/pants
Commit Name: 45e4e6bb334e4b82b61c126f84c5d13e04dcbbf5
Time: 2016-10-24
Author: wisechengyi@gmail.com
File Name: src/python/pants/backend/python/tasks/python_isort.py
Class Name: IsortPythonTask
Method Name: execute


Project Name: pantsbuild/pants
Commit Name: 5b7fd99d9997020ec688bb1ad4b3bbbb34c51d76
Time: 2016-01-11
Author: wangpeiyu@gmail.com
File Name: src/python/pants/backend/jvm/tasks/bundle_create.py
Class Name: BundleCreate
Method Name: execute


Project Name: pantsbuild/pants
Commit Name: 5019e219ed146a1fb3afc91a8e9fb351a5b61115
Time: 2014-06-18
Author: benjy@foursquare.com
File Name: src/python/pants/backend/jvm/tasks/scala_repl.py
Class Name: ScalaRepl
Method Name: execute