Created
April 28, 2018 18:06
-
-
Save dketov/bc5dfdcd7062f7d202fd4e19cfe07b1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
[ -z $1 ] && { echo "out?"; exit 1; } | |
[ -z $2 ] && { echo "author?"; exit 1; } | |
filter() { | |
while read e | |
do | |
$1 $e | |
done | |
} | |
join() { | |
quote() { | |
echo -en '"'$e'"\n' | |
} | |
filter quote | paste -sd$1 | |
} | |
exists() { | |
[ -f $1 ] && echo $1 | |
} | |
targets() { | |
gn ls $1 | | |
grep '^//[^/]*:[^/]*tests$' | | |
join , | |
} | |
files() { | |
git log --author "$1" --name-only --format= | | |
grep -E '(cc|h)$' | | |
filter exists | tee files.log | | |
xargs -I% echo //% | | |
join , | |
} | |
json() { | |
cat <<EOF | |
{ | |
"files": [ $(files $2) ], | |
"test_targets": [ $(targets $1) ], | |
"additional_compile_targets": [] | |
} | |
EOF | |
} | |
gn analyze $1 <(json $1 $2) /dev/stdout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment