def run_build(cwd, parsed_args):
  """Runs a build with the given arguments.
  Assumes that add_common_args and add_common_build_args was called on the
  ArgumentParser.

  Args:
    cwd: Current working directory.
    parsed_args: Argument namespace from an ArgumentParser.

  Returns:
    (success, a list of all target output paths)
  """
  if not len(parsed_args.targets):
    return (True, [])

  build_env = BuildEnvironment(root_path=cwd)

  module_resolver = FileModuleResolver(cwd)
  project = Project(module_resolver=module_resolver)

  # -j/--jobs switch to change execution mode
  #task_executor = None
  if parsed_args.jobs is None:
    # Default to -j1 on Windows only.
    # TODO(benvanik): figure out why this fails so catastrophically
    if (sys.platform == 'cygwin' or
        sys.platform == 'win32'):
      parsed_args.jobs = 1
  if parsed_args.jobs == 1:
    task_executor = InProcessTaskExecutor()
  else:
    task_executor = MultiProcessTaskExecutor(worker_count=parsed_args.jobs)

  # TODO(benvanik): good logging/info - resolve rules in project and print
  #     info?
  print (parsed_args.targets) % 'building %s'

  # Setup cache
  if not parsed_args.force:
    cache_path = os.getcwd()
    rule_cache = FileRuleCache(cache_path)
  else:
    rule_cache = RuleCache()

  # TODO(benvanik): take additional args from command line
  all_target_outputs = set([])
  with BuildContext(build_env, project,
                    rule_cache=rule_cache,
                    task_executor=task_executor,
                    force=parsed_args.force,
                    stop_on_error=parsed_args.stop_on_error,
                    raise_on_error=False) as build_ctx:
    result = build_ctx.execute_sync(parsed_args.targets)
    if result:
      for target in parsed_args.targets:
        (state, target_outputs) = build_ctx.get_rule_results(target)
        all_target_outputs.update(target_outputs)

  return (result == True, all_target_outputs)
dataset/ETHPy150Open google/anvil-build/anvil/commands/util.py/run_build/swapped operands of `%`