crosvm/infra/recipes/build_docs.py
Dennis Kempin 1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00

68 lines
2 KiB
Python

# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine.post_process import Filter
PYTHON_VERSION_COMPATIBILITY = "PY3"
DEPS = [
"crosvm",
"recipe_engine/file",
"recipe_engine/buildbucket",
"recipe_engine/context",
"recipe_engine/step",
"depot_tools/gsutil",
]
BOOK_URL = "gs://crosvm-dot-dev/book"
DOCS_URL = "gs://crosvm-dot-dev/doc"
def RunSteps(api):
"""
Builds crosvm mdbook and api docs, then uploads them to GCS.
This recipe requires ambient luci authentication. To test locally run:
$ luci-auth context ./infra/recipes.py run build_docs
"""
with api.crosvm.container_build_context():
api.crosvm.step_in_container(
"Build mdbook", ["mdbook", "build", "docs/book/", "--dest-dir", "../target"]
)
api.crosvm.step_in_container(
"Run cargo docs",
["./tools/cargo-doc", "--target-dir", "docs/target"],
)
# Container generated files are root-owned, we need to make sure they will be readable by
# gsutil (which has to run outside the container to run with proper authentication).
api.crosvm.step_in_container(
"Make docs readable by gsutil",
["chmod", "-R", "o+r", "docs/target"],
)
api.gsutil(
["rsync", "-r", "-d", "./docs/target/html", BOOK_URL],
name="Upload book",
multithreaded=True,
)
# TODO(b/239255064): Generate the redirect HTML so we can use cleanly mirror here too.
api.gsutil(
["rsync", "-r", "./docs/target/doc", DOCS_URL],
name="Upload docs",
multithreaded=True,
)
def GenTests(api):
filter_steps = Filter(
"Build mdbook", "Run cargo docs", "gsutil Upload book", "gsutil Upload docs"
)
yield (
api.test(
"build_docs",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.post_process(filter_steps)
)