mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
27ecaad405
We are replacing most of our bash tools with python versions so we can support cross-platform development. To facilitate writing shell-like scripts in Python, this CL adds a common.py file to share common utilities. It curretly contains tools to simplify shell-like command execution and argument parsing. BUG=b:218559770 TEST=./tools/clippy && ./tools/fmt && ./tools/impl/common.py Change-Id: I7f8b3523394973ed5c741b926fdc41e52133189f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3461240 Reviewed-by: Maciek Swiech <drmasquatch@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dennis Kempin <denniskempin@google.com>
36 lines
964 B
Python
Executable file
36 lines
964 B
Python
Executable file
#!/usr/bin/env python3
|
|
# Copyright 2019 The Chromium OS Authors. All rights reserved.
|
|
# 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 impl.common import CROSVM_ROOT, cwd, run_main, cmd, chdir
|
|
|
|
clippy = cmd("cargo clippy")
|
|
|
|
|
|
def main(fix: bool = False):
|
|
chdir(CROSVM_ROOT)
|
|
|
|
# Note: Clippy checks are configured in .cargo/config.toml
|
|
clippy_args = [
|
|
"--fix" if fix else None,
|
|
"--all-targets",
|
|
"--",
|
|
"-Dwarnings",
|
|
]
|
|
print("Clippy crosvm workspace")
|
|
clippy("--workspace", "--features=all-linux", *clippy_args).fg()
|
|
|
|
for crate in CROSVM_ROOT.glob("common/*/Cargo.toml"):
|
|
print("Clippy", crate.parent.relative_to(CROSVM_ROOT))
|
|
with cwd(crate.parent):
|
|
clippy("--all-features", *clippy_args).fg()
|
|
|
|
|
|
run_main(main)
|