IWYU: process a list of files
for easy integration with git diff-tree --no-commit-id --name-only -r HEAD which gets the list of files in a commit BUG=webrtc:42226242 Change-Id: I6e80d0f13e4f182d7c0c9c8ea971f6e48fbaae76 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370461 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <phancke@meta.com> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43589}
This commit is contained in:
parent
0dec0897f1
commit
588dbe6fa7
@ -55,8 +55,8 @@ error() {
|
||||
WORKDIR=out/Default
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [-r] file.cc"
|
||||
echo "Runs the include-cleaner tool on a file"
|
||||
echo "Usage: $0 [-r] file.cc [file2.cc ...]"
|
||||
echo "Runs the include-cleaner tool on a list of files"
|
||||
echo "Arguments:"
|
||||
echo " -n : Just print changes, don't do them"
|
||||
echo " -c : Just return non-zero exit code if there are changes, don't do them"
|
||||
@ -95,13 +95,18 @@ if [[ -z "$COMPILE_COMMANDS" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
FILE="$1"
|
||||
|
||||
# To get a list of files in a commit: git diff-tree --no-commit-id --name-only -r HEAD
|
||||
for FILE in "$@"
|
||||
do
|
||||
if [ -z $FILE ] || [ ! -f $FILE ]; then
|
||||
usage
|
||||
error "File $FILE is not found"
|
||||
fi
|
||||
done
|
||||
|
||||
HAS_OUTPUT=false
|
||||
for FILE in "$@"
|
||||
do
|
||||
# Run the command in $WORKDIR because of this reported issue:
|
||||
# https://github.com/llvm/llvm-project/issues/110843
|
||||
cd $WORKDIR
|
||||
@ -128,6 +133,9 @@ for INCLUDE in "gtest" "gmock"; do
|
||||
done
|
||||
|
||||
echo "${OUTPUT}"
|
||||
HAS_OUTPUT=$HAS_OUTPUT || [[ ! -z $OUTPUT ]]
|
||||
done
|
||||
|
||||
echo "Finished. Check diff, compile, gn gen --check and git cl format"
|
||||
echo "before uploading."
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user