Add tool to generate cscope file for aosp

This commit is contained in:
Mathieu Maret 2015-07-08 16:21:49 +02:00
parent 37f34f8a03
commit 871a68ac86
1 changed files with 45 additions and 0 deletions

45
tools/aosp_cscope Executable file
View File

@ -0,0 +1,45 @@
DIR="dalvik device frameworks hardware libnativehelper system packages"
TMP=$(mktemp /tmp/XXXXX-cscope.files)
gettop ()
{
local TOPFILE=build/core/envsetup.mk;
if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ]; then
echo $TOP;
else
if [ -f $TOPFILE ]; then
PWD= /bin/pwd;
else
local HERE=$PWD;
T=;
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
\cd ..;
T=`PWD= /bin/pwd`;
done;
\cd $HERE;
if [ -f "$T/$TOPFILE" ]; then
echo $T;
fi;
fi;
fi
}
T=$(gettop);
if [ "$T" ]; then
\cd $(gettop);
else
echo "Couldn't locate the top of the tree. Try setting TOP.";
exit
fi
for dir in $DIR;
do
echo "Looking for files in $dir"
find $PWD/$dir -name .git -prune -o -type f \( -iname '*.c' -o -iname '*.cc' -o -iname '*.cpp' -o -iname '*.h' -o -iname '*.hpp' -o -iname "*.mk" -o -iname "*.java" -o -iname "*.aidl" \) | egrep -v "/\.git$" >> $TMP
done
echo "generate cscope"
cscope -bkq -i $TMP
rm $TMP