blob: 05aed9737a66f9babc459c4408b348235160a3aa [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Recipe for checking docs are properly formatted.
Requires topaz source to be present in the manifest.
"""
from recipe_engine.recipe_api import Property
DEPS = [
'fuchsia/build',
'fuchsia/checkout',
'recipe_engine/buildbucket',
'recipe_engine/context',
'recipe_engine/file',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
'recipe_engine/step',
]
PROPERTIES = {
'project':
Property(kind=str, help='Jiri remote manifest project', default=None),
'manifest':
Property(kind=str, help='Jiri manifest to use. Should include //topaz'),
'remote':
Property(kind=str, help='Remote manifest repository'),
}
def RunSteps(api, project, remote, manifest):
checkout_root_dir = api.path['start_dir']
checkout = api.checkout.fuchsia_with_options(
path=checkout_root_dir,
build=api.buildbucket.build,
manifest=manifest,
remote=remote,
project=project,
)
fuchsia_build_dir = checkout_root_dir.join('out', 'default')
doc_checker_output_path = 'host_x64/dart-tools/doc_checker'
with api.step.nest('build'):
gn_results = api.build.gen(
checkout_root=checkout_root_dir,
fuchsia_build_dir=fuchsia_build_dir,
# Target doesn't matter since it's a host-side target
target='x64',
build_type='debug',
packages=['//topaz/packages/tools:doc_checker'],
# Product doesn't matter; bringup.gni is faster that core.gni
product='products/bringup.gni',
)
api.build.ninja(
checkout_root=checkout_root_dir,
gn_results=gn_results,
targets=[doc_checker_output_path],
# Skip building zircon since it is unnecessary
build_zircon=False,
)
doc_checker_path = fuchsia_build_dir.join(doc_checker_output_path)
with api.context(cwd=checkout.root_dir):
api.step('doc_check', [doc_checker_path, '--local-links-only'])
def GenTests(api):
yield (api.test('default_ci') + api.buildbucket.ci_build(
git_repo='https://fuchsia.googlesource.com/topaz') + api.properties(
manifest='fuchsia',
remote='https://fuchsia.googlesource.com/manifest',
))
yield (api.test('default_cq') + api.buildbucket.try_build(
git_repo='https://fuchsia.googlesource.com/topaz') + api.properties(
manifest='fuchsia',
remote='https://fuchsia.googlesource.com/manifest',
))