crosvm/tools/cargo-doc
Dennis Kempin 3164f92428 power_monitor: Enable feature in all-linux
To enable this feature, we copy the required proto file from
ChromeOS. Not a great solution, but better than leaving the
code uncompiled in upstream.

We could consider downloading the file from gitilies with
a fixed sha that is manually upreved. But unfortunately
downloading things in build.rs is not trivial without adding
a ton of dependencies for the reqwest crate.

BUG=b:244619797
TEST=presubmit

Change-Id: I401917134471909be80a281454bc64dd27799afe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907373
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-20 21:06:47 +00:00

49 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -ex
# Build cargo-doc
# $ ./tools/cargo-doc --target-dir /path/to/dir
echo "start cargo-doc"
MANIFEST_PATH=$(dirname "$0")/../Cargo.toml
echo "manifest = ${MANIFEST_PATH}"
DISABLED_FEATURES=(
audio_cras
chromeos
crash-report
libvda
video-decoder
video-encoder
)
ALL_FEATURES=$(
cargo metadata --manifest-path "${MANIFEST_PATH}" | \
jq -r '.packages[] |
select(.name == "crosvm") |
.features |
keys[]')
features=""
for f in $ALL_FEATURES; do
if [[ ! "${DISABLED_FEATURES[*]}" =~ $f ]]; then
features+=",${f}"
fi
done
# Set an environment variable 'CARGO_DOC' here so that each build.rs can skip
# building unnecessary dependencies to generate documentations.
CARGO_DOC="true" cargo doc \
--manifest-path="${MANIFEST_PATH}" \
--workspace \
--no-deps \
--exclude crosvm-fuzz \
--features="${features}" "$@" \
--document-private-items