def _gather_dex_entries(self, target):
    classpath_products = self.context.products.get_data('runtime_classpath')
    unpacked_archives = self.context.products.get('unpacked_libraries')

    gathered_entries = OrderedSet()
    class_files = {}

    def get_entries(tgt):
      # We gather just internal classpath elements here.  Unpacked external dependency classpath
      # elements are gathered just below.
      cp_entries = ClasspathUtil.internal_classpath((tgt,), classpath_products)
      gathered_entries.update(cp_entries)

      # Gather classes from the contents of unpacked libraries.
      unpacked = unpacked_archives.get(tgt)
      if unpacked:
        # If there are unpacked_archives then we know this target is an AndroidLibrary.
        for archives in unpacked.values():
          for unpacked_dir in archives:
            try:
              gathered_entries.update(self._filter_unpacked_dir(tgt, unpacked_dir, class_files))
            except TaskError as e:
              raise self.DuplicateClassFileException(
                  "Attempted to add duplicate class files from separate libraries into dex file! "
                  "This likely indicates a version conflict in the target's dependencies.\n"
                  "\nTarget:\n{}\n{}".format(target, e))

    target.walk(get_entries)
    return gathered_entries
Gather relevant dex inputs from a walk of AndroidBinary's dependency graph.
dataset/ETHPy150Open pantsbuild/pants/contrib/android/src/python/pants/contrib/android/tasks/dx_compile.py/DxCompile._gather_dex_entries