envsetup.sh that came with AOSP provide lots handy command when browse android source tree.
By default, it will require envsetup.sh reside at $TOP/build, so we could modify it to remove this requirement :
neomacbookair:home neo$ diff envsetup.sh nenvsetup.sh
18c18
< for i in `cat $T/build/envsetup.sh | sed -n "/^function /s/function \([a-z_]*\).*/\1/p" | sort`; do
---
> for i in `cat ~/Dropbox/home/nenvsetup.sh | sed -n "/^function /s/function \([a-z_]*\).*/\1/p" | sort`; do
555,556c555,556
< local TOPFILE=build/core/envsetup.mk
< if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
---
> local TOPFILE=~/Dropbox/home/nenvsetup.sh
> if [ -n "$TOP" -a -f "$TOPFILE" ] ; then
I rename envsetup.sh into nenvsetup.sh, and placed in ~/Dropbox/home folder. In my source tree, I could simply type :
neomacbookair:mp007 neo$ export TOP=`pwd`
neomacbookair:mp007 neo$ . ~/Dropbox/home/nenvsetup.sh
Then you could use it's utility to travel your source tree :
neomacbookair:mp007 neo$ godir Config.java
Creating index... Done
[1] ./gen/com/wong/mprj/mp007
[2] ./src/com/wong/mprj/mp007
Select one: 2
neomacbookair:mp007 neo$ ls -l Config.java
-rw-r--r-- 1 neo staff 906 8 27 14:13 Config.java
neomacbookair:mp007 neo$ godir mprj-jni.cpp
[1] ./jni/libmprj
[2] ./jni/libtest
Select one: 2
neomacbookair:libtest neo$ ls -l mprj-jni.cpp
-rw-r--r-- 1 neo staff 1808 8 18 23:10 mprj-jni.cpp
neomacbookair:libtest neo$ croot
neomacbookair:mp007 neo$
Of course you may use cgrep, jgrep too, for those m, mm utility it may require more hack before you can use, but I am fine with croot, godir, that's enough for me.
No comments:
Post a Comment