| # 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.""" |
| |
| # TODO(fxb/55379): Remove. |
| |
| from recipe_engine.recipe_api import Property |
| |
| DEPS = [ |
| "fuchsia/build", |
| "fuchsia/checkout", |
| "recipe_engine/buildbucket", |
| "recipe_engine/context", |
| "recipe_engine/path", |
| "recipe_engine/properties", |
| "recipe_engine/step", |
| ] |
| |
| PROPERTIES = { |
| "manifest": Property(kind=str, help="Jiri manifest to use. Should include //topaz"), |
| "remote": Property(kind=str, help="Remote manifest repository"), |
| } |
| |
| |
| def RunSteps(api, remote, manifest): |
| checkout_root = api.path["start_dir"].join("fuchsia") |
| checkout = api.checkout.fuchsia_with_options( |
| path=checkout_root, |
| build=api.buildbucket.build, |
| manifest=manifest, |
| remote=remote, |
| ) |
| |
| fuchsia_build_dir = checkout.root_dir.join("out", "default") |
| with api.step.nest("build"): |
| gn_results = api.build.gen( |
| checkout=checkout, |
| fuchsia_build_dir=fuchsia_build_dir, |
| # Target doesn't matter since it's a host-side target |
| target="x64", |
| build_type="debug", |
| packages=["//tools/doc_checker"], |
| # Product doesn't matter; bringup.gni is faster that core.gni |
| product="products/bringup.gni", |
| ) |
| doc_checker_path = gn_results.tool("doc-checker") |
| |
| api.build.ninja( |
| gn_results=gn_results, |
| targets=[api.path.relpath(doc_checker_path, fuchsia_build_dir)], |
| # Skip building zircon since it is unnecessary |
| build_zircon=False, |
| ) |
| |
| 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/fuchsia") |
| + 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/fuchsia") |
| + api.properties( |
| manifest="fuchsia", remote="https://fuchsia.googlesource.com/manifest", |
| ) |
| ) |