mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 13:23:08 +00:00
ee56b2ddec
Consolidates the utility scripts from bin/ into tools/. Adds a 'presubmit' utility script to run a set of checks and tests. This won't be a git hook, but can be manually used to verify changes before uploading. BUG=b:199951064 TEST=./tools/presubmit --quick ./tools/dev_container ./tools/presubmit Change-Id: Iac7c11fca0beaa6d4f214319149ef385fa5ced70 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3225139 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dennis Kempin <denniskempin@google.com>
31 lines
798 B
Bash
Executable file
31 lines
798 B
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 `rustfmt` 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 ..
|
|
|
|
find . -name '*.rs' -print0 \
|
|
| grep -vz '^./target/' \
|
|
| xargs -0 rustfmt --edition=2018 "$@" --
|