mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
bin/clippy and bin/fmt were missing license blurbs at the top, so update them to include the license blurbs. BUG=None TEST=None Change-Id: Ic6bb5af3885d3735dcad42614aff7ac3dd33d638 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1646736 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Jakub Staroń <jstaron@google.com> Reviewed-by: Stephen Barber <smbarber@chromium.org>
44 lines
1 KiB
Bash
Executable file
44 lines
1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# 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.
|
|
|
|
# Run `cargo fmt` on all Rust code contained in crosvm. This is different from
|
|
# `cargo fmt --all` which formats multiple crates but a single workspace only.
|
|
# Crosvm consists of multiple workspaces.
|
|
#
|
|
# Usage:
|
|
#
|
|
# $ bin/fmt
|
|
#
|
|
# To print a diff and exit 1 if code is not formatted, but without changing any
|
|
# files, use:
|
|
#
|
|
# $ bin/fmt --check
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
# Change into directory of script, which is crosvm/bin.
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
# Jump up to root directory of crosvm repo.
|
|
cd ..
|
|
|
|
# Keep track of whether any cargo fmt invocation exited with error.
|
|
EXIT=0
|
|
|
|
FIND_CARGO_TOMLS="$(find "$PWD" -name Cargo.toml)"
|
|
|
|
while read path_to_cargo_toml; do
|
|
cd "$(dirname "$path_to_cargo_toml")"
|
|
|
|
if grep --quiet '\[workspace\]' Cargo.toml; then
|
|
if ! cargo fmt --all -- "$@"; then
|
|
EXIT=1
|
|
fi
|
|
fi
|
|
done <<< "$FIND_CARGO_TOMLS"
|
|
|
|
exit $EXIT
|