码迷,mamicode.com
首页 > 其他好文 > 详细

envsetup.sh解析

时间:2016-08-05 17:39:47      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

 1 function hmm() {
 2   # 打印帮助信息
 3   cat <<EOF
 4   Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
 5   - lunch:   lunch <product_name>-<build_variant>
 6   - tapas:   tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
 7   - croot:   Changes directory to the top of the tree.
 8   - m:       Makes from the top of the tree.
 9   - mm:      Builds all of the modules in the current directory, but not their dependencies.
10  - mmm:     Builds all of the modules in the supplied directories, but not their dependencies.
11             To limit the modules being built use the syntax: mmm dir/:target1,target2.
12  - mma:     Builds all of the modules in the current directory, and their dependencies.
13  - mmma:    Builds all of the modules in the supplied directories, and their dependencies.
14  - cgrep:   Greps on all local C/C++ files.
15  - ggrep:   Greps on all local Gradle files.
16  - jgrep:   Greps on all local Java files.
17  - resgrep: Greps on all local res/*.xml files.
18  - sgrep:   Greps on all local source files.
19  - godir:   Go to the directory containing a file.
20  
21  Look at the source to view more functions. The complete list is:
22  EOF
23  # gettop是脚本内函数,功能:返回当前android代码树的顶层路径。前提是当前路径位于android代码树中
24      T=$(gettop)
25  # A变量 局部变量化
26      local A
27      A=""
28  # 查看envsetup.sh内容,且行首开始空格、制表符任意次,替换function为匹配的子串(函数名),按字符排升序、去掉重复
29      for i in `cat $T/build/envsetup.sh | sed -n "/^[ \t]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
30  # 替换出来的函数名 追加在A后 并打印
31        A="$A $i"
32      done
33      echo $A
34  }

envsetup.sh使用方法:

book@book-virtual-machine:/work/android-5.0.2$ source build/envsetup.sh 
including device/asus/deb/vendorsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/friendly-arm/tiny4412/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including sdk/bash_completion/adb.bash
book@book-virtual-machine:/work/android-5.0.2$ get_abs_build_var TARGET_PRODUCT
/work/android-5.0.2/full

 

envsetup.sh解析

标签:

原文地址:http://www.cnblogs.com/pokerface/p/5742088.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!