def _AddBuildTargetsDeprecated(target, roots, result):
  """Recurses through all targets that depend on |target|, adding all targets
  that need to be built (and are in |roots|) to |result|.
  roots: set of root targets.
  result: targets that need to be built are added here."""
  if target.visited:
    return

  target.visited = True
  target.in_roots = target in roots

  for back_dep_target in target.back_deps:
    _AddBuildTargetsDeprecated(back_dep_target, roots, result)
    target.added_to_compile_targets |= back_dep_target.added_to_compile_targets
    target.in_roots |= back_dep_target.in_roots
    target.is_or_has_linked_ancestor |= (
      back_dep_target.is_or_has_linked_ancestor)

  # Always add 'executable' targets. Even though they may be built by other
  # targets that depend upon them it makes detection of what is going to be
  # built easier.
  # And always add static_libraries that have no dependencies on them from
  # linkables. This is necessary as the other dependencies on them may be
  # static libraries themselves, which are not compile time dependencies.
  if target.in_roots and \
        (target.is_executable or
         (not target.added_to_compile_targets and target.requires_build) or
         (target.is_static_library and not target.is_or_has_linked_ancestor)):
    print '\t\tadding to build targets', target.name, 'executable', \
           target.is_executable, 'added_to_compile_targets', \
           target.added_to_compile_targets, 'requires_build', \
           target.requires_build, 'is_static_library', \
           target.is_static_library, 'is_or_has_linked_ancestor', \
           target.is_or_has_linked_ancestor
    result.add(target)
    target.added_to_compile_targets = True
dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/generator/analyzer.py/_AddBuildTargetsDeprecated/original