envsetup.sh编译过程
source bulid/envsetup.sh
加载命令,以下是envsetup.sh的部分文件,封装了命令的脚本文件
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch <product_name>-<build_variant>
Selects <product_name> as the product to build, and <build_variant> as the variant to
build, and stores those selections in the environment to be read by subsequent
invocations of 'm' etc.
- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|arm64|x86_64|mips64] [eng|userdebug|user]
- croot: Changes directory to the top of the tree, or a subdirectory thereof.
- 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.
- provision: Flash device with all required partitions. Options will be passed on to fastboot.
- 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.
- mgrep: Greps on all local Makefiles files.
- sepgrep: Greps on all local sepolicy files.
- sgrep: Greps on all local source files.
- godir: Go to the directory containing a file.
- allmod: List all modules.
- gomod: Go to the directory containing a module.
- pathmod: Get the directory containing a module.
- refreshmod: Refresh list of modules for allmod/gomod.
Environment options:
- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
ASAN_OPTIONS=detect_leaks=0 will be set by default until the
build is leak-check clean.
- ANDROID_QUIET_BUILD: set to 'true' to display only the essential messages.
lunch
选择分支,得到这些基本信息
============================================
PLATFORM_VERSION_CODENAME=REL //平台版本代号
PLATFORM_VERSION=10 //Android版本
TARGET_PRODUCT=aosp_x86_64 //生成的目标
TARGET_BUILD_VARIANT=eng //构建版本
TARGET_BUILD_TYPE=release //构建类型
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64 //工具链
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64 //架构
HOST_OS=darwin //编译服务器
HOST_OS_EXTRA=Darwin-19.4.0-x86_64-10.15.4
HOST_BUILD_TYPE=release
BUILD_ID=QQ2A.200405.005
OUT_DIR=out //输出目录
============================================
export
得到详细的信息
lanjiabindeMBP:AOSP lanjiabin$ export
declare -x ANDROID_BUILD_PATHS="/Volumes/lanjiabin/AOSP/out/soong/host/darwin-x86/bin:/Volumes/lanjiabin/AOSP/out/host/darwin-x86/bin:/Volumes/lanjiabin/AOSP/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9/bin:/Volumes/lanjiabin/AOSP/development/scripts:/Volumes/lanjiabin/AOSP/prebuilts/devtools/tools:/Volumes/lanjiabin/AOSP/external/selinux/prebuilts/bin:/Volumes/lanjiabin/AOSP/prebuilts/android-emulator/darwin-x86_64:/Volumes/lanjiabin/AOSP/prebuilts/asuite/acloud/darwin-x86:/Volumes/lanjiabin/AOSP/prebuilts/asuite/aidegen/darwin-x86:/Volumes/lanjiabin/AOSP/prebuilts/asuite/atest/darwin-x86:"
declare -x ANDROID_BUILD_TOP="/Volumes/lanjiabin/AOSP"
declare -x ANDROID_DEV_SCRIPTS="/Volumes/lanjiabin/AOSP/development/scripts:/Volumes/lanjiabin/AOSP/prebuilts/devtools/tools:/Volumes/lanjiabin/AOSP/external/selinux/prebuilts/bin"
declare -x ANDROID_EMULATOR_PREBUILTS="/Volumes/lanjiabin/AOSP/prebuilts/android-emulator/darwin-x86_64"
declare -x ANDROID_HOST_OUT="/Volumes/lanjiabin/AOSP/out/host/darwin-x86"
declare -x ANDROID_HOST_OUT_TESTCASES="/Volumes/lanjiabin/AOSP/out/host/darwin-x86/testcases"
declare -x ANDROID_JAVA_HOME="/Volumes/lanjiabin/AOSP/prebuilts/jdk/jdk9/darwin-x86"
declare -x ANDROID_JAVA_TOOLCHAIN="/Volumes/lanjiabin/AOSP/prebuilts/jdk/jdk9/darwin-x86/bin"
declare -x ANDROID_PRE_BUILD_PATHS="/Volumes/lanjiabin/AOSP/prebuilts/jdk/jdk9/darwin-x86/bin:"
declare -x ANDROID_PRODUCT_OUT="/Volumes/lanjiabin/AOSP/out/target/product/generic_x86_64"
declare -x ANDROID_PYTHONPATH="/Volumes/lanjiabin/AOSP/development/python-packages:"
declare -x ANDROID_TARGET_OUT_TESTCASES="/Volumes/lanjiabin/AOSP/out/target/product/generic_x86_64/testcases"
declare -x ANDROID_TOOLCHAIN="/Volumes/lanjiabin/AOSP/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9/bin"
declare -x ANDROID_TOOLCHAIN_2ND_ARCH=""
declare -x ASAN_OPTIONS="detect_leaks=0"
declare -x BUILD_ENV_SEQUENCE_NUMBER="13"
declare -x GCC_COLORS="error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"
declare -x HOME="/Users/lanjiabin"
declare -x HOMEBREW_NO_AUTO_UPDATE="true"
declare -x JAVA8_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home"
declare -x JAVA_HOME="/Volumes/lanjiabin/AOSP/prebuilts/jdk/jdk9/darwin-x86"
declare -x LANG="zh_CN.UTF-8"
declare -x LOGNAME="lanjiabin"
declare -x M2_HOME="/Users/lanjiabin/lanjiabin/Maven"
declare -x OLDPWD="/Volumes/lanjiabin/AOSP/build"
declare -x OUT="/Volumes/lanjiabin/AOSP/out/target/product/generic_x86_64"
declare -x PATH="/Volumes/lanjiabin/AOSP/prebuilts/jdk/jdk9/darwin-x86/bin:/Volumes/lanjiabin/AOSP/out/soong/host/darwin-x86/bin:/Volumes/lanjiabin/AOSP/out/host/darwin-x86/bin:/Volumes/lanjiabin/AOSP/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9/bin:/Volumes/lanjiabin/AOSP/development/scripts:/Volumes/lanjiabin/AOSP/prebuilts/devtools/tools:/Volumes/lanjiabin/AOSP/external/selinux/prebuilts/bin:/Volumes/lanjiabin/AOSP/prebuilts/android-emulator/darwin-x86_64:/Volumes/lanjiabin/AOSP/prebuilts/asuite/acloud/darwin-x86:/Volumes/lanjiabin/AOSP/prebuilts/asuite/aidegen/darwin-x86:/Volumes/lanjiabin/AOSP/prebuilts/asuite/atest/darwin-x86:/opt/local/bin:/opt/local/sbin:/opt/local/sbin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/aria2/bin:/Library/Apple/usr/bin:/Users/lanjiabin/lanjiabin/Maven/bin"
declare -x PWD="/Volumes/lanjiabin/AOSP"
declare -x PYTHONPATH="/Volumes/lanjiabin/AOSP/development/python-packages:"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.xAJWJn9M1j/Listeners"
declare -x TARGET_BUILD_APPS=""
declare -x TARGET_BUILD_TYPE="release"
declare -x TARGET_BUILD_VARIANT="eng"
declare -x TARGET_GCC_VERSION="4.9"
declare -x TARGET_PRODUCT="aosp_x86_64"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="433"
declare -x TERM_SESSION_ID="2A78A8CE-2D67-46C6-AE56-6AA3E7288E84"
declare -x TMPDIR="/var/folders/hp/gv0fjq5j5n72fppcl_fw21br0000gn/T/"
declare -x USER="lanjiabin"
declare -x XPC_FLAGS="0x0"
declare -x XPC_SERVICE_NAME="0"
lanjiabindeMBP:AOSP lanjiabin$
编程中我们会遇到多少挫折?表放弃,沙漠尽头必是绿洲。