xref: /aosp_15_r20/external/crosvm/tools/cargo-doc (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1#!/usr/bin/env python3
2# Copyright 2021 The ChromiumOS Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6from typing import Optional
7
8from impl.common import CROSVM_ROOT, chdir, cmd, quoted, run_main
9
10# Build cargo-doc
11# $ ./tools/cargo-doc --target-dir /path/to/dir
12
13cargo = cmd("cargo").with_color_flag()
14
15
16def main(target_dir: Optional[str] = None, *extra_args: str):
17    chdir(CROSVM_ROOT)
18    cargo(
19        "doc",
20        "--workspace",
21        "--no-deps",
22        "--exclude=crosvm-fuzz",
23        "--features=all-x86_64",
24        "--document-private-items",
25        quoted(f"--target-dir={target_dir}") if target_dir else None,
26        *extra_args,
27    ).fg()
28
29
30if __name__ == "__main__":
31    run_main(main)
32