def _discover_manifests(api, root, dirs):
  """Returns a list with paths to all manifests we need to build.

  Args:
    api: recipes API.
    root: gclient solution root.
    dirs: list of path relative to the solution root to scan.

  Returns:
    [Path].
  """
  paths = []
  for d in dirs:
    found = api.file.listdir(
        'list %s' % d, root.join(d),
        recursive=True,
        test_data=['target.yaml', 'something_else.md'])
    paths.extend(f for f in found if api.path.splitext(f)[1] == '.yaml')
  return paths