crosvm/tools/clippy
Vikram Auradkar 1b32084a56 crosvm: Enable default features on windows.
The patch makes usb feature no-op on windows as USB pass-through is
not supported on windows.

BUG=b:241251677
BUG=b:213149155
TEST=tools/presubmit

Change-Id: Id82d4c732a86e782695d2af698cc08e8e3fd2d35
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4006819
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-11-07 23:03:25 +00:00

53 lines
1.5 KiB
Python
Executable file

#!/usr/bin/env python3
# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# To check for violations:
# $ ./tools/clippy
#
# To fix violations where possible:
# $ ./tools/clippy --fix
from typing import List
from impl.common import CROSVM_ROOT, run_main, cmd, chdir
from impl.test_runner import get_workspace_excludes
from impl.test_target import Triple, SHORTHANDS
clippy = cmd("cargo clippy").with_color_flag()
def main(
fix: bool = False,
json: bool = False,
locked: bool = False,
platform: str = None,
):
try:
triple: Triple = Triple.from_shorthand(platform) if platform else Triple.host_default()
except Exception as e:
raise type(e)(str(e) + f"\nValid platforms are {', '.join(SHORTHANDS.keys())}")
excluded_crates: List[str] = list(get_workspace_excludes(triple))
chdir(CROSVM_ROOT)
# Note: Clippy checks are configured in .cargo/config.toml
common_args = [
"--fix" if fix else None,
"--message-format=json" if json else None,
"--locked" if locked else None,
"--all-targets",
"--",
"-Dwarnings",
]
print("Clippy crosvm workspace")
clippy(
"--workspace",
f"--features={triple.feature_flag}",
*[f"--exclude={crate}" for crate in excluded_crates],
*common_args,
).with_envs(triple.get_cargo_env()).fg()
if __name__ == "__main__":
run_main(main)