From cdf21d7d109c074f71f0c876c41f5b6e1c29a5af Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Thu, 29 Oct 2015 11:45:15 +0100 Subject: [PATCH] [script] generate cscope and ctags for android --- scripts/generate_cscopefile.sh | 38 ++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/scripts/generate_cscopefile.sh b/scripts/generate_cscopefile.sh index e4088b4..24d3193 100755 --- a/scripts/generate_cscopefile.sh +++ b/scripts/generate_cscopefile.sh @@ -1,7 +1,38 @@ -DIR="dalvik device frameworks hardware libnativehelper system " +DIR="bionic dalvik device frameworks hardware libnativehelper system packages" TMP=$(mktemp /tmp/XXXXX-cscope.files) -echo "$TMP" +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" @@ -11,4 +42,7 @@ done echo "generate cscope" cscope -bkq -i $TMP +echo "generate ctags" +ctags --c-kinds=+px --c++-kinds=+px --fields=+iaS --extra=+q -L $TMP + rm $TMP