在build/envsetup.sh定义了一些函数供我们直接使用
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch <product_name>-<build_variant>
- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
- croot: Changes directory to the top of the tree.
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory, but not their dependencies.
- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma: Builds all of the modules in the current directory, and their dependencies.
- mmma: Builds all of the modules in the supplied directories, and their dependencies.
- cgrep: Greps on all local C/C++ files.
- ggrep: Greps on all local Gradle files.
- jgrep: Greps on all local Java files.
- resgrep: Greps on all local res/*.xml files.
- mangrep: Greps on all local AndroidManifest.xml files.
- sepgrep: Greps on all local sepolicy files.
- sgrep: Greps on all local source files.
- godir: Go to the directory containing a file.
//......
在AOSP对应的源码目录下执行下面脚本
. build/envsetup.sh
执行完毕之后,就可以使用相应的命令了
gettop 获取WORKING_DIRECTORY目录的完整路径
croot 回到WORKING_DIRECTORY目录
mm 编译当前目录下的模块,比如在package/Calculator目录下执行mm就是编译Calculator.apk
cgrep 执行grep命令,但只匹配C/C++的源文件
jgrep 执行grep命令,但只匹配java源文件
resgrep 执行grep命令,但只匹配路径名为res下的xml资源文件
godir 去某个文件所在的目录