Joe Onorato | 344e404 | 2022-12-05 15:15:36 -0800 | [diff] [blame] | 1 | # Copyright (C) 2022 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | # gettop is duplicated here and in shell_utils.mk, because it's difficult |
| 16 | # to find shell_utils.make without it for all the novel ways this file can be |
| 17 | # sourced. Other common functions should only be in one place or the other. |
| 18 | function _gettop_once |
| 19 | { |
| 20 | local TOPFILE=build/make/core/envsetup.mk |
| 21 | if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then |
| 22 | # The following circumlocution ensures we remove symlinks from TOP. |
| 23 | (cd "$TOP"; PWD= /bin/pwd) |
| 24 | else |
| 25 | if [ -f $TOPFILE ] ; then |
| 26 | # The following circumlocution (repeated below as well) ensures |
| 27 | # that we record the true directory name and not one that is |
| 28 | # faked up with symlink names. |
| 29 | PWD= /bin/pwd |
| 30 | else |
| 31 | local HERE=$PWD |
| 32 | local T= |
| 33 | while [ \( ! \( -f $TOPFILE \) \) -a \( "$PWD" != "/" \) ]; do |
| 34 | \cd .. |
| 35 | T=`PWD= /bin/pwd -P` |
| 36 | done |
| 37 | \cd "$HERE" |
| 38 | if [ -f "$T/$TOPFILE" ]; then |
| 39 | echo "$T" |
| 40 | fi |
| 41 | fi |
| 42 | fi |
| 43 | } |
| 44 | T=$(_gettop_once) |
| 45 | if [ ! "$T" ]; then |
| 46 | echo "Couldn't locate the top of the tree. Always source build/envsetup.sh from the root of the tree." >&2 |
| 47 | return 1 |
| 48 | fi |
| 49 | IMPORTING_ENVSETUP=true source $T/build/make/shell_utils.sh |
| 50 | |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 51 | # Get all the build variables needed by this script in a single call to the build system. |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 52 | function build_build_var_cache() |
| 53 | { |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 54 | local T=$(gettop) |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 55 | # Grep out the variable names from the script. |
Michael Bestas | 3a8fb88 | 2016-08-26 00:37:02 +0300 | [diff] [blame] | 56 | cached_vars=(`cat $T/build/envsetup.sh $T/vendor/lineage/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/_get_build_var_cached/) print $(i+1)}' | sort -u | tr '\n' ' '`) |
| 57 | cached_abs_vars=(`cat $T/build/envsetup.sh $T/vendor/lineage/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/_get_abs_build_var_cached/) print $(i+1)}' | sort -u | tr '\n' ' '`) |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 58 | # Call the build system to dump the "<val>=<value>" pairs as a shell script. |
Steven Moreland | 0540296 | 2018-01-05 12:13:11 -0800 | [diff] [blame] | 59 | build_dicts_script=`\builtin cd $T; build/soong/soong_ui.bash --dumpvars-mode \ |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 60 | --vars="${cached_vars[*]}" \ |
| 61 | --abs-vars="${cached_abs_vars[*]}" \ |
Dan Willemsen | af88c41 | 2017-07-14 11:29:44 -0700 | [diff] [blame] | 62 | --var-prefix=var_cache_ \ |
| 63 | --abs-var-prefix=abs_var_cache_` |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 64 | local ret=$? |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 65 | if [ $ret -ne 0 ] |
| 66 | then |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 67 | unset build_dicts_script |
| 68 | return $ret |
| 69 | fi |
Dan Willemsen | af88c41 | 2017-07-14 11:29:44 -0700 | [diff] [blame] | 70 | # Execute the script to store the "<val>=<value>" pairs as shell variables. |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 71 | eval "$build_dicts_script" |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 72 | ret=$? |
Ying Wang | f0cb397 | 2016-03-04 13:56:23 -0800 | [diff] [blame] | 73 | unset build_dicts_script |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 74 | if [ $ret -ne 0 ] |
| 75 | then |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 76 | return $ret |
| 77 | fi |
| 78 | BUILD_VAR_CACHE_READY="true" |
| 79 | } |
| 80 | |
Ying Wang | f0cb397 | 2016-03-04 13:56:23 -0800 | [diff] [blame] | 81 | # Delete the build var cache, so that we can still call into the build system |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 82 | # to get build variables not listed in this script. |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 83 | function destroy_build_var_cache() |
| 84 | { |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 85 | unset BUILD_VAR_CACHE_READY |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 86 | local v |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 87 | for v in $cached_vars; do |
| 88 | unset var_cache_$v |
| 89 | done |
| 90 | unset cached_vars |
| 91 | for v in $cached_abs_vars; do |
| 92 | unset abs_var_cache_$v |
| 93 | done |
| 94 | unset cached_abs_vars |
| 95 | } |
| 96 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 97 | # Get the value of a build variable as an absolute path. |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 98 | function _get_abs_build_var_cached() |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 99 | { |
| 100 | if [ "$BUILD_VAR_CACHE_READY" = "true" ] |
| 101 | then |
Vishwath Mohan | 7d35f00 | 2016-03-11 10:00:40 -0800 | [diff] [blame] | 102 | eval "echo \"\${abs_var_cache_$1}\"" |
Timi | 0469c3f | 2021-04-15 16:41:18 +0200 | [diff] [blame] | 103 | return |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 104 | fi |
| 105 | |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 106 | local T=$(gettop) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 107 | if [ ! "$T" ]; then |
| 108 | echo "Couldn't locate the top of the tree. Try setting TOP." >&2 |
| 109 | return |
| 110 | fi |
Dan Willemsen | af88c41 | 2017-07-14 11:29:44 -0700 | [diff] [blame] | 111 | (\cd $T; build/soong/soong_ui.bash --dumpvar-mode --abs $1) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | # Get the exact value of a build variable. |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 115 | function _get_build_var_cached() |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 116 | { |
| 117 | if [ "$BUILD_VAR_CACHE_READY" = "true" ] |
| 118 | then |
Vishwath Mohan | 7d35f00 | 2016-03-11 10:00:40 -0800 | [diff] [blame] | 119 | eval "echo \"\${var_cache_$1}\"" |
Roland Levillain | 23c46cf | 2020-03-31 16:11:05 +0100 | [diff] [blame] | 120 | return 0 |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 121 | fi |
| 122 | |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 123 | local T=$(gettop) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 124 | if [ ! "$T" ]; then |
| 125 | echo "Couldn't locate the top of the tree. Try setting TOP." >&2 |
Roland Levillain | 23c46cf | 2020-03-31 16:11:05 +0100 | [diff] [blame] | 126 | return 1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 127 | fi |
Dan Willemsen | af88c41 | 2017-07-14 11:29:44 -0700 | [diff] [blame] | 128 | (\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1) |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 129 | } |
| 130 | |
Joe Onorato | 32b2aa3 | 2024-05-14 13:54:13 -0700 | [diff] [blame] | 131 | # This logic matches envsetup.mk |
| 132 | function get_host_prebuilt_prefix |
| 133 | { |
| 134 | local un=$(uname) |
| 135 | if [[ $un == "Linux" ]] ; then |
| 136 | echo linux-x86 |
| 137 | elif [[ $un == "Darwin" ]] ; then |
| 138 | echo darwin-x86 |
| 139 | else |
| 140 | echo "Error: Invalid host operating system: $un" 1>&2 |
| 141 | fi |
| 142 | } |
| 143 | |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 144 | # Add directories to PATH that are dependent on the lunch target. |
| 145 | # For directories that are not lunch-specific, add them in set_global_paths |
| 146 | function set_lunch_paths() |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 147 | { |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 148 | local T=$(gettop) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 149 | if [ ! "$T" ]; then |
| 150 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 151 | return |
| 152 | fi |
| 153 | |
| 154 | ################################################################## |
| 155 | # # |
| 156 | # Read me before you modify this code # |
| 157 | # # |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 158 | # This function sets ANDROID_LUNCH_BUILD_PATHS to what it is # |
| 159 | # adding to PATH, and the next time it is run, it removes that # |
| 160 | # from PATH. This is required so lunch can be run more than # |
| 161 | # once and still have working paths. # |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 162 | # # |
| 163 | ################################################################## |
| 164 | |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 165 | # Note: on windows/cygwin, ANDROID_LUNCH_BUILD_PATHS will contain spaces |
Raphael Moll | c639c78 | 2011-06-20 17:25:01 -0700 | [diff] [blame] | 166 | # due to "C:\Program Files" being in the path. |
| 167 | |
Kevin Dagostino | 185109b | 2024-01-11 17:39:02 +0000 | [diff] [blame] | 168 | # Handle compat with the old ANDROID_BUILD_PATHS variable. |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 169 | # TODO: Remove this after we think everyone has lunched again. |
| 170 | if [ -z "$ANDROID_LUNCH_BUILD_PATHS" -a -n "$ANDROID_BUILD_PATHS" ] ; then |
| 171 | ANDROID_LUNCH_BUILD_PATHS="$ANDROID_BUILD_PATHS" |
| 172 | ANDROID_BUILD_PATHS= |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 173 | fi |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 174 | if [ -n "$ANDROID_PRE_BUILD_PATHS" ] ; then |
Doug Zongker | 2903498 | 2011-04-22 08:16:56 -0700 | [diff] [blame] | 175 | export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/} |
Ying Wang | aa1c9b5 | 2012-11-26 20:51:59 -0800 | [diff] [blame] | 176 | # strip leading ':', if any |
| 177 | export PATH=${PATH/:%/} |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 178 | ANDROID_PRE_BUILD_PATHS= |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 179 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 180 | |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 181 | # Out with the old... |
| 182 | if [ -n "$ANDROID_LUNCH_BUILD_PATHS" ] ; then |
| 183 | export PATH=${PATH/$ANDROID_LUNCH_BUILD_PATHS/} |
| 184 | fi |
Ben Cheng | fba67bf | 2014-02-25 10:27:07 -0800 | [diff] [blame] | 185 | |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 186 | # And in with the new... |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 187 | ANDROID_LUNCH_BUILD_PATHS=$(_get_abs_build_var_cached SOONG_HOST_OUT_EXECUTABLES) |
| 188 | ANDROID_LUNCH_BUILD_PATHS+=:$(_get_abs_build_var_cached HOST_OUT_EXECUTABLES) |
Yueyao Zhu | efc786a | 2017-04-07 14:11:54 -0700 | [diff] [blame] | 189 | |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 190 | # Append llvm binutils prebuilts path to ANDROID_LUNCH_BUILD_PATHS. |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 191 | local ANDROID_LLVM_BINUTILS=$(_get_abs_build_var_cached ANDROID_CLANG_PREBUILTS)/llvm-binutils-stable |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 192 | ANDROID_LUNCH_BUILD_PATHS+=:$ANDROID_LLVM_BINUTILS |
David 'Digit' Turner | 94d16e5 | 2014-05-05 16:13:50 +0200 | [diff] [blame] | 193 | |
Stephen Hines | aa8d72c | 2020-02-04 09:15:18 -0800 | [diff] [blame] | 194 | # Set up ASAN_SYMBOLIZER_PATH for SANITIZE_HOST=address builds. |
| 195 | export ASAN_SYMBOLIZER_PATH=$ANDROID_LLVM_BINUTILS/llvm-symbolizer |
| 196 | |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 197 | # Append asuite prebuilts path to ANDROID_LUNCH_BUILD_PATHS. |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 198 | local os_arch=$(_get_build_var_cached HOST_PREBUILT_TAG) |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 199 | ANDROID_LUNCH_BUILD_PATHS+=:$T/prebuilts/asuite/acloud/$os_arch |
| 200 | ANDROID_LUNCH_BUILD_PATHS+=:$T/prebuilts/asuite/aidegen/$os_arch |
| 201 | ANDROID_LUNCH_BUILD_PATHS+=:$T/prebuilts/asuite/atest/$os_arch |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 202 | |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 203 | export ANDROID_JAVA_HOME=$(_get_abs_build_var_cached ANDROID_JAVA_HOME) |
Colin Cross | e97e693 | 2017-06-30 16:01:45 -0700 | [diff] [blame] | 204 | export JAVA_HOME=$ANDROID_JAVA_HOME |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 205 | export ANDROID_JAVA_TOOLCHAIN=$(_get_abs_build_var_cached ANDROID_JAVA_TOOLCHAIN) |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 206 | ANDROID_LUNCH_BUILD_PATHS+=:$ANDROID_JAVA_TOOLCHAIN |
| 207 | |
| 208 | # Fix up PYTHONPATH |
| 209 | if [ -n $ANDROID_PYTHONPATH ]; then |
| 210 | export PYTHONPATH=${PYTHONPATH//$ANDROID_PYTHONPATH/} |
| 211 | fi |
Dan Albert | 0d6d359 | 2023-01-26 00:07:03 +0000 | [diff] [blame] | 212 | # //development/python-packages contains both a pseudo-PYTHONPATH which |
| 213 | # mimics an already assembled venv, but also contains real Python packages |
| 214 | # that are not in that layout until they are installed. We can fake it for |
| 215 | # the latter type by adding the package source directories to the PYTHONPATH |
| 216 | # directly. For the former group, we only need to add the python-packages |
| 217 | # directory itself. |
| 218 | # |
| 219 | # This could be cleaned up by converting the remaining packages that are in |
| 220 | # the first category into a typical python source layout (that is, another |
| 221 | # layer of directory nesting) and automatically adding all subdirectories of |
| 222 | # python-packages to the PYTHONPATH instead of manually curating this. We |
| 223 | # can't convert the packages like adb to the other style because doing so |
| 224 | # would prevent exporting type info from those packages. |
| 225 | # |
| 226 | # http://b/266688086 |
Dan Albert | 426ac69 | 2023-05-16 22:59:55 +0000 | [diff] [blame] | 227 | export ANDROID_PYTHONPATH=$T/development/python-packages/adb:$T/development/python-packages/gdbrunner:$T/development/python-packages: |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 228 | if [ -n $VENDOR_PYTHONPATH ]; then |
| 229 | ANDROID_PYTHONPATH=$ANDROID_PYTHONPATH$VENDOR_PYTHONPATH |
| 230 | fi |
| 231 | export PYTHONPATH=$ANDROID_PYTHONPATH$PYTHONPATH |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 232 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 233 | unset ANDROID_PRODUCT_OUT |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 234 | export ANDROID_PRODUCT_OUT=$(_get_abs_build_var_cached PRODUCT_OUT) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 235 | export OUT=$ANDROID_PRODUCT_OUT |
| 236 | |
Jeff Brown | 8fd5cce | 2011-03-24 17:03:06 -0700 | [diff] [blame] | 237 | unset ANDROID_HOST_OUT |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 238 | export ANDROID_HOST_OUT=$(_get_abs_build_var_cached HOST_OUT) |
Jeff Brown | 8fd5cce | 2011-03-24 17:03:06 -0700 | [diff] [blame] | 239 | |
Jiyong Park | c02b1c4 | 2020-11-03 11:06:39 +0900 | [diff] [blame] | 240 | unset ANDROID_SOONG_HOST_OUT |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 241 | export ANDROID_SOONG_HOST_OUT=$(_get_abs_build_var_cached SOONG_HOST_OUT) |
Jiyong Park | c02b1c4 | 2020-11-03 11:06:39 +0900 | [diff] [blame] | 242 | |
Simran Basi | dd050ed | 2017-02-13 13:46:48 -0800 | [diff] [blame] | 243 | unset ANDROID_HOST_OUT_TESTCASES |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 244 | export ANDROID_HOST_OUT_TESTCASES=$(_get_abs_build_var_cached HOST_OUT_TESTCASES) |
Simran Basi | dd050ed | 2017-02-13 13:46:48 -0800 | [diff] [blame] | 245 | |
| 246 | unset ANDROID_TARGET_OUT_TESTCASES |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 247 | export ANDROID_TARGET_OUT_TESTCASES=$(_get_abs_build_var_cached TARGET_OUT_TESTCASES) |
Simran Basi | dd050ed | 2017-02-13 13:46:48 -0800 | [diff] [blame] | 248 | |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 249 | # Finally, set PATH |
Joe Onorato | 1cb9e15 | 2022-12-05 16:56:15 -0800 | [diff] [blame] | 250 | export PATH=$ANDROID_LUNCH_BUILD_PATHS:$PATH |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | # Add directories to PATH that are NOT dependent on the lunch target. |
| 254 | # For directories that are lunch-specific, add them in set_lunch_paths |
| 255 | function set_global_paths() |
| 256 | { |
| 257 | local T=$(gettop) |
| 258 | if [ ! "$T" ]; then |
| 259 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 260 | return |
| 261 | fi |
| 262 | |
| 263 | ################################################################## |
| 264 | # # |
| 265 | # Read me before you modify this code # |
| 266 | # # |
| 267 | # This function sets ANDROID_GLOBAL_BUILD_PATHS to what it is # |
| 268 | # adding to PATH, and the next time it is run, it removes that # |
| 269 | # from PATH. This is required so envsetup.sh can be sourced # |
| 270 | # more than once and still have working paths. # |
| 271 | # # |
| 272 | ################################################################## |
| 273 | |
| 274 | # Out with the old... |
| 275 | if [ -n "$ANDROID_GLOBAL_BUILD_PATHS" ] ; then |
| 276 | export PATH=${PATH/$ANDROID_GLOBAL_BUILD_PATHS/} |
| 277 | fi |
| 278 | |
| 279 | # And in with the new... |
Joe Onorato | 84e61d0 | 2024-02-02 22:53:39 -0800 | [diff] [blame] | 280 | ANDROID_GLOBAL_BUILD_PATHS=$T/build/soong/bin |
LaMont Jones | e8a3be2 | 2024-02-12 09:55:41 -0800 | [diff] [blame] | 281 | ANDROID_GLOBAL_BUILD_PATHS+=:$T/build/bazel/bin |
Joe Onorato | 1cb9e15 | 2022-12-05 16:56:15 -0800 | [diff] [blame] | 282 | ANDROID_GLOBAL_BUILD_PATHS+=:$T/development/scripts |
| 283 | ANDROID_GLOBAL_BUILD_PATHS+=:$T/prebuilts/devtools/tools |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 284 | |
| 285 | # add kernel specific binaries |
| 286 | if [ $(uname -s) = Linux ] ; then |
| 287 | ANDROID_GLOBAL_BUILD_PATHS+=:$T/prebuilts/misc/linux-x86/dtc |
| 288 | ANDROID_GLOBAL_BUILD_PATHS+=:$T/prebuilts/misc/linux-x86/libufdt |
| 289 | fi |
| 290 | |
| 291 | # If prebuilts/android-emulator/<system>/ exists, prepend it to our PATH |
| 292 | # to ensure that the corresponding 'emulator' binaries are used. |
| 293 | case $(uname -s) in |
| 294 | Darwin) |
| 295 | ANDROID_EMULATOR_PREBUILTS=$T/prebuilts/android-emulator/darwin-x86_64 |
| 296 | ;; |
| 297 | Linux) |
| 298 | ANDROID_EMULATOR_PREBUILTS=$T/prebuilts/android-emulator/linux-x86_64 |
| 299 | ;; |
| 300 | *) |
| 301 | ANDROID_EMULATOR_PREBUILTS= |
| 302 | ;; |
| 303 | esac |
| 304 | if [ -n "$ANDROID_EMULATOR_PREBUILTS" -a -d "$ANDROID_EMULATOR_PREBUILTS" ]; then |
| 305 | ANDROID_GLOBAL_BUILD_PATHS+=:$ANDROID_EMULATOR_PREBUILTS |
| 306 | export ANDROID_EMULATOR_PREBUILTS |
| 307 | fi |
| 308 | |
| 309 | # Finally, set PATH |
Joe Onorato | 1cb9e15 | 2022-12-05 16:56:15 -0800 | [diff] [blame] | 310 | export PATH=$ANDROID_GLOBAL_BUILD_PATHS:$PATH |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 311 | } |
| 312 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 313 | function printconfig() |
| 314 | { |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 315 | local T=$(gettop) |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 316 | if [ ! "$T" ]; then |
| 317 | echo "Couldn't locate the top of the tree. Try setting TOP." >&2 |
| 318 | return |
| 319 | fi |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 320 | _get_build_var_cached report_config |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 321 | } |
| 322 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 323 | function set_stuff_for_environment() |
| 324 | { |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 325 | set_lunch_paths |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 326 | set_sequence_number |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 327 | } |
| 328 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 329 | function set_sequence_number() |
| 330 | { |
Colin Cross | 8873713 | 2017-03-21 17:41:03 -0700 | [diff] [blame] | 331 | export BUILD_ENV_SEQUENCE_NUMBER=13 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 332 | } |
| 333 | |
Makoto Onuki | da97106 | 2018-06-18 10:15:19 -0700 | [diff] [blame] | 334 | # Takes a command name, and check if it's in ENVSETUP_NO_COMPLETION or not. |
| 335 | function should_add_completion() { |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 336 | local cmd="$(basename $1| sed 's/_completion//' |sed 's/\.\(.*\)*sh$//')" |
Makoto Onuki | da97106 | 2018-06-18 10:15:19 -0700 | [diff] [blame] | 337 | case :"$ENVSETUP_NO_COMPLETION": in |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 338 | *:"$cmd":*) |
| 339 | return 1 |
| 340 | ;; |
Makoto Onuki | da97106 | 2018-06-18 10:15:19 -0700 | [diff] [blame] | 341 | esac |
| 342 | return 0 |
| 343 | } |
| 344 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 345 | function addcompletions() |
| 346 | { |
Ben Taitelbaum | 8c2c9cf | 2020-09-22 16:45:05 -0700 | [diff] [blame] | 347 | local f= |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 348 | |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 349 | # Keep us from trying to run in something that's neither bash nor zsh. |
| 350 | if [ -z "$BASH_VERSION" -a -z "$ZSH_VERSION" ]; then |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 351 | return |
| 352 | fi |
| 353 | |
| 354 | # Keep us from trying to run in bash that's too old. |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 355 | if [ -n "$BASH_VERSION" -a ${BASH_VERSINFO[0]} -lt 3 ]; then |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 356 | return |
| 357 | fi |
| 358 | |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 359 | local completion_files=( |
MÃ¥rten Kongstad | cb5c73f | 2022-05-04 14:08:12 +0000 | [diff] [blame] | 360 | packages/modules/adb/adb.bash |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 361 | system/core/fastboot/fastboot.bash |
Jim Tang | b3fda30 | 2018-12-22 10:24:55 +0800 | [diff] [blame] | 362 | tools/asuite/asuite.sh |
Chris Parsons | a297297 | 2022-08-31 15:04:38 -0400 | [diff] [blame] | 363 | prebuilts/bazel/common/bazel-complete.bash |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 364 | ) |
Makoto Onuki | da97106 | 2018-06-18 10:15:19 -0700 | [diff] [blame] | 365 | # Completion can be disabled selectively to allow users to use non-standard completion. |
| 366 | # e.g. |
| 367 | # ENVSETUP_NO_COMPLETION=adb # -> disable adb completion |
| 368 | # ENVSETUP_NO_COMPLETION=adb:bit # -> disable adb and bit completion |
Usta Shrestha | 1433fb3 | 2022-05-13 14:49:40 -0400 | [diff] [blame] | 369 | local T=$(gettop) |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 370 | for f in ${completion_files[*]}; do |
Usta Shrestha | 1433fb3 | 2022-05-13 14:49:40 -0400 | [diff] [blame] | 371 | f="$T/$f" |
MÃ¥rten Kongstad | cb5c73f | 2022-05-04 14:08:12 +0000 | [diff] [blame] | 372 | if [ ! -f "$f" ]; then |
| 373 | echo "Warning: completion file $f not found" |
| 374 | elif should_add_completion "$f"; then |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 375 | . $f |
Elliott Hughes | ce18dd4 | 2018-04-03 13:49:48 -0700 | [diff] [blame] | 376 | fi |
| 377 | done |
Joe Onorato | 002a6c7 | 2016-10-20 16:39:49 -0700 | [diff] [blame] | 378 | |
Anton Hansson | ece9c48 | 2019-02-04 18:15:39 +0000 | [diff] [blame] | 379 | if [ -z "$ZSH_VERSION" ]; then |
| 380 | # Doesn't work in zsh. |
| 381 | complete -o nospace -F _croot croot |
Chris Parsons | a297297 | 2022-08-31 15:04:38 -0400 | [diff] [blame] | 382 | # TODO(b/244559459): Support b autocompletion for zsh |
| 383 | complete -F _bazel__complete -o nospace b |
Anton Hansson | ece9c48 | 2019-02-04 18:15:39 +0000 | [diff] [blame] | 384 | fi |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 385 | complete -F _lunch lunch |
Joe Onorato | 590ae9f | 2024-05-24 15:38:58 -0700 | [diff] [blame] | 386 | complete -F _lunch_completion lunch2 |
Steven Moreland | 62054a4 | 2018-12-06 10:11:40 -0800 | [diff] [blame] | 387 | |
Cole Faust | 24c36db | 2021-01-23 02:39:37 +0000 | [diff] [blame] | 388 | complete -F _complete_android_module_names pathmod |
dimitry | 73b8481 | 2018-12-11 18:06:00 +0100 | [diff] [blame] | 389 | complete -F _complete_android_module_names gomod |
Cole Faust | 24c36db | 2021-01-23 02:39:37 +0000 | [diff] [blame] | 390 | complete -F _complete_android_module_names outmod |
| 391 | complete -F _complete_android_module_names installmod |
dimitry | 73b8481 | 2018-12-11 18:06:00 +0100 | [diff] [blame] | 392 | complete -F _complete_android_module_names m |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 393 | } |
| 394 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 395 | function add_lunch_combo() |
| 396 | { |
Dan Willemsen | 5436c7e | 2019-02-11 21:31:47 -0800 | [diff] [blame] | 397 | if [ -n "$ZSH_VERSION" ]; then |
| 398 | echo -n "${funcfiletrace[1]}: " |
| 399 | else |
| 400 | echo -n "${BASH_SOURCE[1]}:${BASH_LINENO[0]}: " |
| 401 | fi |
| 402 | echo "add_lunch_combo is obsolete. Use COMMON_LUNCH_CHOICES in your AndroidProducts.mk instead." |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 403 | } |
| 404 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 405 | function print_lunch_menu() |
| 406 | { |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 407 | local uname=$(uname) |
Roland Levillain | 23c46cf | 2020-03-31 16:11:05 +0100 | [diff] [blame] | 408 | local choices |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 409 | choices=$(TARGET_BUILD_APPS= TARGET_PRODUCT= TARGET_RELEASE= TARGET_BUILD_VARIANT= _get_build_var_cached COMMON_LUNCH_CHOICES 2>/dev/null) |
Roland Levillain | 23c46cf | 2020-03-31 16:11:05 +0100 | [diff] [blame] | 410 | local ret=$? |
| 411 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 412 | echo |
| 413 | echo "You're building on" $uname |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 414 | echo |
Roland Levillain | 23c46cf | 2020-03-31 16:11:05 +0100 | [diff] [blame] | 415 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 416 | if [ $ret -ne 0 ] |
| 417 | then |
Roland Levillain | 23c46cf | 2020-03-31 16:11:05 +0100 | [diff] [blame] | 418 | echo "Warning: Cannot display lunch menu." |
| 419 | echo |
| 420 | echo "Note: You can invoke lunch with an explicit target:" |
| 421 | echo |
| 422 | echo " usage: lunch [target]" >&2 |
| 423 | echo |
| 424 | return |
| 425 | fi |
| 426 | |
Will Burr | 4040120 | 2022-02-07 12:12:01 +0000 | [diff] [blame] | 427 | echo "Lunch menu .. Here are the common combinations:" |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 428 | |
| 429 | local i=1 |
| 430 | local choice |
Dan Willemsen | 91763e9 | 2019-10-03 15:13:12 -0700 | [diff] [blame] | 431 | for choice in $(echo $choices) |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 432 | do |
| 433 | echo " $i. $choice" |
| 434 | i=$(($i+1)) |
| 435 | done |
| 436 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 437 | echo |
| 438 | } |
| 439 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 440 | function lunch() |
| 441 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 442 | local answer |
| 443 | |
Steven Moreland | 92793dc | 2020-02-25 18:30:18 -0800 | [diff] [blame] | 444 | if [[ $# -gt 1 ]]; then |
| 445 | echo "usage: lunch [target]" >&2 |
| 446 | return 1 |
| 447 | fi |
| 448 | |
Will Burr | 4040120 | 2022-02-07 12:12:01 +0000 | [diff] [blame] | 449 | local used_lunch_menu=0 |
| 450 | |
Steven Moreland | 92793dc | 2020-02-25 18:30:18 -0800 | [diff] [blame] | 451 | if [ "$1" ]; then |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 452 | answer=$1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 453 | else |
| 454 | print_lunch_menu |
Greg Kaiser | bae4c57 | 2024-01-04 15:57:54 -0700 | [diff] [blame] | 455 | echo "Which would you like? [aosp_cf_x86_64_phone-trunk_staging-eng]" |
Greg Kaiser | 9a5a526 | 2023-11-02 16:54:27 +0000 | [diff] [blame] | 456 | echo -n "Pick from common choices above (e.g. 13) or specify your own (e.g. aosp_barbet-trunk_staging-eng): " |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 457 | read answer |
Will Burr | 4040120 | 2022-02-07 12:12:01 +0000 | [diff] [blame] | 458 | used_lunch_menu=1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 459 | fi |
| 460 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 461 | local selection= |
| 462 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 463 | if [ -z "$answer" ] |
| 464 | then |
Greg Kaiser | bae4c57 | 2024-01-04 15:57:54 -0700 | [diff] [blame] | 465 | selection=aosp_cf_x86_64_phone-trunk_staging-eng |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 466 | elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$") |
| 467 | then |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 468 | local choices=($(TARGET_BUILD_APPS= TARGET_PRODUCT= TARGET_RELEASE= TARGET_BUILD_VARIANT= _get_build_var_cached COMMON_LUNCH_CHOICES 2>/dev/null)) |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 469 | if [ $answer -le ${#choices[@]} ] |
| 470 | then |
Jim Tang | 0e3397b | 2018-10-03 18:25:50 +0800 | [diff] [blame] | 471 | # array in zsh starts from 1 instead of 0. |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 472 | if [ -n "$ZSH_VERSION" ] |
| 473 | then |
Jim Tang | 0e3397b | 2018-10-03 18:25:50 +0800 | [diff] [blame] | 474 | selection=${choices[$(($answer))]} |
| 475 | else |
| 476 | selection=${choices[$(($answer-1))]} |
| 477 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 478 | fi |
Colin Cross | 8873713 | 2017-03-21 17:41:03 -0700 | [diff] [blame] | 479 | else |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 480 | selection=$answer |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 481 | fi |
| 482 | |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 483 | export TARGET_BUILD_APPS= |
| 484 | |
Greg Kaiser | 5e2d339 | 2023-10-27 14:15:48 -0600 | [diff] [blame] | 485 | # This must be <product>-<release>-<variant> |
| 486 | local product release variant |
| 487 | # Split string on the '-' character. |
| 488 | IFS="-" read -r product release variant <<< "$selection" |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 489 | |
Greg Kaiser | 5e2d339 | 2023-10-27 14:15:48 -0600 | [diff] [blame] | 490 | if [[ -z "$product" ]] || [[ -z "$release" ]] || [[ -z "$variant" ]] |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 491 | then |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 492 | echo |
Colin Cross | 8873713 | 2017-03-21 17:41:03 -0700 | [diff] [blame] | 493 | echo "Invalid lunch combo: $selection" |
Greg Kaiser | 5e2d339 | 2023-10-27 14:15:48 -0600 | [diff] [blame] | 494 | echo "Valid combos must be of the form <product>-<release>-<variant>" |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 495 | return 1 |
| 496 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 497 | |
Koushik Dutta | c8113eb | 2017-08-23 16:13:18 +0200 | [diff] [blame] | 498 | if ! check_product $product $release |
| 499 | then |
| 500 | # if we can't find a product, try to grab it off the LineageOS GitHub |
| 501 | T=$(gettop) |
| 502 | cd $T > /dev/null |
| 503 | vendor/lineage/build/tools/roomservice.py $product |
| 504 | cd - > /dev/null |
| 505 | check_product $product $release |
| 506 | else |
| 507 | T=$(gettop) |
| 508 | cd $T > /dev/null |
| 509 | vendor/lineage/build/tools/roomservice.py $product true |
| 510 | cd - > /dev/null |
| 511 | fi |
| 512 | |
Joe Onorato | 590ae9f | 2024-05-24 15:38:58 -0700 | [diff] [blame] | 513 | _lunch_meat $product $release $variant |
| 514 | } |
| 515 | |
| 516 | function _lunch_meat() |
| 517 | { |
| 518 | local product=$1 |
| 519 | local release=$2 |
| 520 | local variant=$3 |
| 521 | |
Colin Cross | 8873713 | 2017-03-21 17:41:03 -0700 | [diff] [blame] | 522 | TARGET_PRODUCT=$product \ |
Jeff Hamilton | a02c747 | 2023-05-08 03:13:29 +0000 | [diff] [blame] | 523 | TARGET_RELEASE=$release \ |
Joe Onorato | 590ae9f | 2024-05-24 15:38:58 -0700 | [diff] [blame] | 524 | TARGET_BUILD_VARIANT=$variant \ |
Colin Cross | 8873713 | 2017-03-21 17:41:03 -0700 | [diff] [blame] | 525 | build_build_var_cache |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 526 | if [ $? -ne 0 ] |
| 527 | then |
Anton Hansson | 32fa7ee | 2021-06-14 17:09:58 +0100 | [diff] [blame] | 528 | if [[ "$product" =~ .*_(eng|user|userdebug) ]] |
| 529 | then |
| 530 | echo "Did you mean -${product/*_/}? (dash instead of underscore)" |
| 531 | fi |
Koushik Dutta | c8113eb | 2017-08-23 16:13:18 +0200 | [diff] [blame] | 532 | echo |
| 533 | echo "** Don't have a product spec for: '$product'" |
| 534 | echo "** Do you have the right repo manifest?" |
| 535 | product= |
| 536 | fi |
| 537 | |
| 538 | if [ -z "$product" -o -z "$variant" ] |
| 539 | then |
| 540 | echo |
Colin Cross | 8873713 | 2017-03-21 17:41:03 -0700 | [diff] [blame] | 541 | return 1 |
| 542 | fi |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 543 | export TARGET_PRODUCT=$(_get_build_var_cached TARGET_PRODUCT) |
| 544 | export TARGET_BUILD_VARIANT=$(_get_build_var_cached TARGET_BUILD_VARIANT) |
Greg Kaiser | 5e2d339 | 2023-10-27 14:15:48 -0600 | [diff] [blame] | 545 | export TARGET_RELEASE=$release |
| 546 | # Note this is the string "release", not the value of the variable. |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 547 | export TARGET_BUILD_TYPE=release |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 548 | |
Mark White | 2c80751 | 2023-10-25 17:27:07 +0000 | [diff] [blame] | 549 | [[ -n "${ANDROID_QUIET_BUILD:-}" ]] || echo |
| 550 | |
Luca Stefani | 05ce70d | 2017-08-17 21:21:23 +0200 | [diff] [blame] | 551 | fixup_common_out_dir |
| 552 | |
Mark White | 2c80751 | 2023-10-25 17:27:07 +0000 | [diff] [blame] | 553 | set_stuff_for_environment |
| 554 | [[ -n "${ANDROID_QUIET_BUILD:-}" ]] || printconfig |
| 555 | |
Chirayu Desai | 635935f | 2024-03-08 02:10:56 +0530 | [diff] [blame] | 556 | if [[ -z "${ANDROID_QUIET_BUILD}" && -z "${LINEAGE_BUILD}" ]]; then |
Joe Onorato | 590ae9f | 2024-05-24 15:38:58 -0700 | [diff] [blame] | 557 | local spam_for_lunch=$(gettop)/build/make/tools/envsetup/spam_for_lunch |
| 558 | if [[ -x $spam_for_lunch ]]; then |
| 559 | $spam_for_lunch |
| 560 | fi |
Will Burr | 4040120 | 2022-02-07 12:12:01 +0000 | [diff] [blame] | 561 | fi |
| 562 | |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 563 | destroy_build_var_cache |
Kousik Kumar | 41dacd1 | 2021-05-11 18:38:38 -0400 | [diff] [blame] | 564 | |
| 565 | if [[ -n "${CHECK_MU_CONFIG:-}" ]]; then |
| 566 | check_mu_config |
| 567 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 568 | } |
| 569 | |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 570 | unset COMMON_LUNCH_CHOICES_CACHE |
Jeff Davidson | 513d7a4 | 2010-08-02 10:00:44 -0700 | [diff] [blame] | 571 | # Tab completion for lunch. |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 572 | function _lunch() |
| 573 | { |
Jeff Davidson | 513d7a4 | 2010-08-02 10:00:44 -0700 | [diff] [blame] | 574 | local cur prev opts |
| 575 | COMPREPLY=() |
| 576 | cur="${COMP_WORDS[COMP_CWORD]}" |
| 577 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 578 | |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 579 | if [ -z "$COMMON_LUNCH_CHOICES_CACHE" ]; then |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 580 | COMMON_LUNCH_CHOICES_CACHE=$(TARGET_BUILD_APPS= _get_build_var_cached COMMON_LUNCH_CHOICES) |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 581 | fi |
| 582 | |
| 583 | COMPREPLY=( $(compgen -W "${COMMON_LUNCH_CHOICES_CACHE}" -- ${cur}) ) |
Jeff Davidson | 513d7a4 | 2010-08-02 10:00:44 -0700 | [diff] [blame] | 584 | return 0 |
| 585 | } |
Jeff Davidson | 513d7a4 | 2010-08-02 10:00:44 -0700 | [diff] [blame] | 586 | |
Joe Onorato | 590ae9f | 2024-05-24 15:38:58 -0700 | [diff] [blame] | 587 | function _lunch_usage() |
| 588 | { |
| 589 | ( |
| 590 | echo "The lunch command selects the configuration to use for subsequent" |
| 591 | echo "Android builds." |
| 592 | echo |
| 593 | echo "Usage: lunch TARGET_PRODUCT [TARGET_RELEASE [TARGET_BUILD_VARIANT]]" |
| 594 | echo |
| 595 | echo " Choose the product, release and variant to use. If not" |
| 596 | echo " supplied, TARGET_RELEASE will be 'trunk_staging' and" |
| 597 | echo " TARGET_BUILD_VARIANT will be 'eng'" |
| 598 | echo |
| 599 | echo |
| 600 | echo "Usage: lunch TARGET_PRODUCT-TARGET_RELEASE-TARGET_BUILD_VARIANT" |
| 601 | echo |
| 602 | echo " Chose the product, release and variant to use. This" |
| 603 | echo " legacy format is maintained for compatibility." |
| 604 | echo |
| 605 | echo |
| 606 | echo "Note that the previous interactive menu and list of hard-coded" |
| 607 | echo "list of curated targets has been removed. If you would like the" |
| 608 | echo "list of products, release configs for a particular product, or" |
| 609 | echo "variants, run list_products, list_release_configs, list_variants" |
| 610 | echo "respectively." |
| 611 | echo |
| 612 | ) 1>&2 |
| 613 | } |
| 614 | |
| 615 | function lunch2() |
| 616 | { |
| 617 | if [[ $# -eq 1 && $1 = "--help" ]]; then |
| 618 | _lunch_usage |
| 619 | return 0 |
| 620 | fi |
| 621 | if [[ $# -eq 0 ]]; then |
| 622 | echo "No target specified. See lunch --help" 1>&2 |
| 623 | return 1 |
| 624 | fi |
| 625 | if [[ $# -gt 3 ]]; then |
| 626 | echo "Too many parameters given. See lunch --help" 1>&2 |
| 627 | return 1 |
| 628 | fi |
| 629 | |
| 630 | local product release variant |
| 631 | |
| 632 | # Handle the legacy format |
| 633 | local legacy=$(echo $1 | grep "-") |
| 634 | if [[ $# -eq 1 && -n $legacy ]]; then |
| 635 | IFS="-" read -r product release variant <<< "$1" |
| 636 | if [[ -z "$product" ]] || [[ -z "$release" ]] || [[ -z "$variant" ]]; then |
| 637 | echo "Invalid lunch combo: $1" 1>&2 |
| 638 | echo "Valid combos must be of the form <product>-<release>-<variant> when using" 1>&2 |
| 639 | echo "the legacy format. Run 'lunch --help' for usage." 1>&2 |
| 640 | return 1 |
| 641 | fi |
| 642 | fi |
| 643 | |
| 644 | # Handle the new format. |
| 645 | if [[ -z $legacy ]]; then |
| 646 | product=$1 |
| 647 | release=$2 |
| 648 | if [[ -z $release ]]; then |
| 649 | release=trunk_staging |
| 650 | fi |
| 651 | variant=$3 |
| 652 | if [[ -z $variant ]]; then |
| 653 | variant=eng |
| 654 | fi |
| 655 | fi |
| 656 | |
| 657 | # Validate the selection and set all the environment stuff |
| 658 | _lunch_meat $product $release $variant |
| 659 | } |
| 660 | |
| 661 | unset ANDROID_LUNCH_COMPLETION_PRODUCT_CACHE |
| 662 | unset ANDROID_LUNCH_COMPLETION_CHOSEN_PRODUCT |
| 663 | unset ANDROID_LUNCH_COMPLETION_RELEASE_CACHE |
| 664 | # Tab completion for lunch. |
| 665 | function _lunch_completion() |
| 666 | { |
| 667 | # Available products |
| 668 | if [[ $COMP_CWORD -eq 1 ]] ; then |
| 669 | if [[ -z $ANDROID_LUNCH_COMPLETION_PRODUCT_CACHE ]]; then |
| 670 | ANDROID_LUNCH_COMPLETION_PRODUCT_CACHE=$(list_products) |
| 671 | fi |
| 672 | COMPREPLY=( $(compgen -W "${ANDROID_LUNCH_COMPLETION_PRODUCT_CACHE}" -- "${COMP_WORDS[COMP_CWORD]}") ) |
| 673 | fi |
| 674 | |
| 675 | # Available release configs |
| 676 | if [[ $COMP_CWORD -eq 2 ]] ; then |
| 677 | if [[ -z $ANDROID_LUNCH_COMPLETION_RELEASE_CACHE || $ANDROID_LUNCH_COMPLETION_CHOSEN_PRODUCT != ${COMP_WORDS[1]} ]] ; then |
| 678 | ANDROID_LUNCH_COMPLETION_RELEASE_CACHE=$(list_releases ${COMP_WORDS[1]}) |
| 679 | ANDROID_LUNCH_COMPLETION_CHOSEN_PRODUCT=${COMP_WORDS[1]} |
| 680 | fi |
| 681 | COMPREPLY=( $(compgen -W "${ANDROID_LUNCH_COMPLETION_RELEASE_CACHE}" -- "${COMP_WORDS[COMP_CWORD]}") ) |
| 682 | fi |
| 683 | |
| 684 | # Available variants |
| 685 | if [[ $COMP_CWORD -eq 3 ]] ; then |
| 686 | COMPREPLY=(user userdebug eng) |
| 687 | fi |
| 688 | |
| 689 | return 0 |
| 690 | } |
| 691 | |
| 692 | |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 693 | # Configures the build to build unbundled apps. |
Doug Zongker | 0d8179e | 2014-04-16 11:34:34 -0700 | [diff] [blame] | 694 | # Run tapas with one or more app names (from LOCAL_PACKAGE_NAME) |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 695 | function tapas() |
| 696 | { |
Jeff Gaston | 9fb05d8 | 2017-08-21 18:27:00 -0700 | [diff] [blame] | 697 | local showHelp="$(echo $* | xargs -n 1 echo | \grep -E '^(help)$' | xargs)" |
Elliott Hughes | f71c05a | 2020-03-06 16:46:59 -0800 | [diff] [blame] | 698 | local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|arm64|x86_64)$' | xargs)" |
Greg Kaiser | 83ed159 | 2023-10-26 18:37:40 +0000 | [diff] [blame] | 699 | # TODO(b/307975293): Expand tapas to take release arguments (and update hmm() usage). |
| 700 | local release="trunk_staging" |
Doug Zongker | 0d8179e | 2014-04-16 11:34:34 -0700 | [diff] [blame] | 701 | local variant="$(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$' | xargs)" |
Jeff Hamilton | 5069bd6 | 2014-09-04 21:28:00 -0700 | [diff] [blame] | 702 | local density="$(echo $* | xargs -n 1 echo | \grep -E '^(ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)" |
Colin Cross | 7f49a67 | 2022-01-27 18:15:53 -0800 | [diff] [blame] | 703 | local keys="$(echo $* | xargs -n 1 echo | \grep -E '^(devkeys)$' | xargs)" |
| 704 | local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|arm64|x86_64|ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi|devkeys)$' | xargs)" |
| 705 | |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 706 | |
Jeff Gaston | 9fb05d8 | 2017-08-21 18:27:00 -0700 | [diff] [blame] | 707 | if [ "$showHelp" != "" ]; then |
| 708 | $(gettop)/build/make/tapasHelp.sh |
| 709 | return |
| 710 | fi |
| 711 | |
Ying Wang | 67f0292 | 2012-08-22 10:25:20 -0700 | [diff] [blame] | 712 | if [ $(echo $arch | wc -w) -gt 1 ]; then |
| 713 | echo "tapas: Error: Multiple build archs supplied: $arch" |
| 714 | return |
| 715 | fi |
Greg Kaiser | 83ed159 | 2023-10-26 18:37:40 +0000 | [diff] [blame] | 716 | if [ $(echo $release | wc -w) -gt 1 ]; then |
| 717 | echo "tapas: Error: Multiple build releases supplied: $release" |
| 718 | return |
| 719 | fi |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 720 | if [ $(echo $variant | wc -w) -gt 1 ]; then |
| 721 | echo "tapas: Error: Multiple build variants supplied: $variant" |
| 722 | return |
| 723 | fi |
Jeff Hamilton | 5069bd6 | 2014-09-04 21:28:00 -0700 | [diff] [blame] | 724 | if [ $(echo $density | wc -w) -gt 1 ]; then |
| 725 | echo "tapas: Error: Multiple densities supplied: $density" |
| 726 | return |
| 727 | fi |
Colin Cross | 7f49a67 | 2022-01-27 18:15:53 -0800 | [diff] [blame] | 728 | if [ $(echo $keys | wc -w) -gt 1 ]; then |
| 729 | echo "tapas: Error: Multiple keys supplied: $keys" |
| 730 | return |
| 731 | fi |
Ying Wang | 67f0292 | 2012-08-22 10:25:20 -0700 | [diff] [blame] | 732 | |
Ying Wang | 0a76df5 | 2015-06-08 11:57:26 -0700 | [diff] [blame] | 733 | local product=aosp_arm |
Ying Wang | 67f0292 | 2012-08-22 10:25:20 -0700 | [diff] [blame] | 734 | case $arch in |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 735 | x86) product=aosp_x86;; |
| 736 | arm64) product=aosp_arm64;; |
| 737 | x86_64) product=aosp_x86_64;; |
Ying Wang | 67f0292 | 2012-08-22 10:25:20 -0700 | [diff] [blame] | 738 | esac |
Colin Cross | 7f49a67 | 2022-01-27 18:15:53 -0800 | [diff] [blame] | 739 | if [ -n "$keys" ]; then |
| 740 | product=${product/aosp_/aosp_${keys}_} |
| 741 | fi; |
| 742 | |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 743 | if [ -z "$variant" ]; then |
| 744 | variant=eng |
| 745 | fi |
Ying Wang | c048c9b | 2010-06-24 15:08:33 -0700 | [diff] [blame] | 746 | if [ -z "$apps" ]; then |
| 747 | apps=all |
| 748 | fi |
Justin Morey | 29d225c | 2014-11-04 13:35:51 -0600 | [diff] [blame] | 749 | if [ -z "$density" ]; then |
| 750 | density=alldpi |
| 751 | fi |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 752 | |
Ying Wang | 67f0292 | 2012-08-22 10:25:20 -0700 | [diff] [blame] | 753 | export TARGET_PRODUCT=$product |
Greg Kaiser | 83ed159 | 2023-10-26 18:37:40 +0000 | [diff] [blame] | 754 | export TARGET_RELEASE=$release |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 755 | export TARGET_BUILD_VARIANT=$variant |
Jeff Hamilton | 5069bd6 | 2014-09-04 21:28:00 -0700 | [diff] [blame] | 756 | export TARGET_BUILD_DENSITY=$density |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 757 | export TARGET_BUILD_TYPE=release |
| 758 | export TARGET_BUILD_APPS=$apps |
| 759 | |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 760 | build_build_var_cache |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 761 | set_stuff_for_environment |
| 762 | printconfig |
Ying Wang | 08800fd | 2016-03-03 20:57:21 -0800 | [diff] [blame] | 763 | destroy_build_var_cache |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 764 | } |
| 765 | |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 766 | # Configures the build to build unbundled Android modules (APEXes). |
| 767 | # Run banchan with one or more module names (from apex{} modules). |
| 768 | function banchan() |
| 769 | { |
| 770 | local showHelp="$(echo $* | xargs -n 1 echo | \grep -E '^(help)$' | xargs)" |
Ulya Trafimovich | 08c381b | 2023-06-12 15:33:09 +0100 | [diff] [blame] | 771 | local product="$(echo $* | xargs -n 1 echo | \grep -E '^(.*_)?(arm|x86|arm64|riscv64|x86_64|arm64only|x86_64only)$' | xargs)" |
Greg Kaiser | d35095e | 2023-10-27 16:04:30 -0600 | [diff] [blame] | 772 | # TODO: Expand banchan to take release arguments (and update hmm() usage). |
| 773 | local release="trunk_staging" |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 774 | local variant="$(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$' | xargs)" |
Ulya Trafimovich | 08c381b | 2023-06-12 15:33:09 +0100 | [diff] [blame] | 775 | local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|(.*_)?(arm|x86|arm64|riscv64|x86_64))$' | xargs)" |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 776 | |
| 777 | if [ "$showHelp" != "" ]; then |
| 778 | $(gettop)/build/make/banchanHelp.sh |
| 779 | return |
| 780 | fi |
| 781 | |
Martin Stjernholm | 2b8d923 | 2021-04-16 20:45:03 +0100 | [diff] [blame] | 782 | if [ -z "$product" ]; then |
Anton Hansson | 0328e32 | 2022-05-24 15:47:40 +0000 | [diff] [blame] | 783 | product=arm64 |
Martin Stjernholm | 2b8d923 | 2021-04-16 20:45:03 +0100 | [diff] [blame] | 784 | elif [ $(echo $product | wc -w) -gt 1 ]; then |
| 785 | echo "banchan: Error: Multiple build archs or products supplied: $products" |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 786 | return |
| 787 | fi |
Greg Kaiser | d35095e | 2023-10-27 16:04:30 -0600 | [diff] [blame] | 788 | if [ $(echo $release | wc -w) -gt 1 ]; then |
| 789 | echo "banchan: Error: Multiple build releases supplied: $release" |
| 790 | return |
| 791 | fi |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 792 | if [ $(echo $variant | wc -w) -gt 1 ]; then |
| 793 | echo "banchan: Error: Multiple build variants supplied: $variant" |
| 794 | return |
| 795 | fi |
| 796 | if [ -z "$apps" ]; then |
| 797 | echo "banchan: Error: No modules supplied" |
| 798 | return |
| 799 | fi |
| 800 | |
Martin Stjernholm | 2b8d923 | 2021-04-16 20:45:03 +0100 | [diff] [blame] | 801 | case $product in |
| 802 | arm) product=module_arm;; |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 803 | x86) product=module_x86;; |
| 804 | arm64) product=module_arm64;; |
Ulya Trafimovich | 08c381b | 2023-06-12 15:33:09 +0100 | [diff] [blame] | 805 | riscv64) product=module_riscv64;; |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 806 | x86_64) product=module_x86_64;; |
Anton Hansson | 90ac61c | 2022-09-06 14:36:00 +0000 | [diff] [blame] | 807 | arm64only) product=module_arm64only;; |
| 808 | x86_64only) product=module_x86_64only;; |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 809 | esac |
| 810 | if [ -z "$variant" ]; then |
| 811 | variant=eng |
| 812 | fi |
| 813 | |
| 814 | export TARGET_PRODUCT=$product |
Greg Kaiser | d35095e | 2023-10-27 16:04:30 -0600 | [diff] [blame] | 815 | export TARGET_RELEASE=$release |
Martin Stjernholm | f692c75 | 2021-04-12 00:01:10 +0100 | [diff] [blame] | 816 | export TARGET_BUILD_VARIANT=$variant |
| 817 | export TARGET_BUILD_DENSITY=alldpi |
| 818 | export TARGET_BUILD_TYPE=release |
| 819 | |
| 820 | # This setup currently uses TARGET_BUILD_APPS just like tapas, but the use |
| 821 | # case is different and it may diverge in the future. |
| 822 | export TARGET_BUILD_APPS=$apps |
| 823 | |
| 824 | build_build_var_cache |
| 825 | set_stuff_for_environment |
| 826 | printconfig |
| 827 | destroy_build_var_cache |
| 828 | } |
| 829 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 830 | function croot() |
| 831 | { |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 832 | local T=$(gettop) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 833 | if [ "$T" ]; then |
Marie Janssen | 32ec50a | 2016-04-21 16:53:39 -0700 | [diff] [blame] | 834 | if [ "$1" ]; then |
| 835 | \cd $(gettop)/$1 |
| 836 | else |
| 837 | \cd $(gettop) |
| 838 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 839 | else |
| 840 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 841 | fi |
| 842 | } |
| 843 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 844 | function _croot() |
| 845 | { |
Anton Hansson | ece9c48 | 2019-02-04 18:15:39 +0000 | [diff] [blame] | 846 | local T=$(gettop) |
| 847 | if [ "$T" ]; then |
| 848 | local cur="${COMP_WORDS[COMP_CWORD]}" |
| 849 | k=0 |
| 850 | for c in $(compgen -d ${T}/${cur}); do |
| 851 | COMPREPLY[k++]=${c#${T}/}/ |
| 852 | done |
| 853 | fi |
| 854 | } |
| 855 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 856 | function cproj() |
| 857 | { |
Colin Cross | 6cdc5d2 | 2017-10-20 11:37:33 -0700 | [diff] [blame] | 858 | local TOPFILE=build/make/core/envsetup.mk |
Joe Onorato | 2a5d4d8 | 2009-07-30 10:23:21 -0700 | [diff] [blame] | 859 | local HERE=$PWD |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 860 | local T= |
Joe Onorato | 2a5d4d8 | 2009-07-30 10:23:21 -0700 | [diff] [blame] | 861 | while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do |
| 862 | T=$PWD |
| 863 | if [ -f "$T/Android.mk" ]; then |
Ying Wang | 9cd1764 | 2012-12-13 10:52:07 -0800 | [diff] [blame] | 864 | \cd $T |
Joe Onorato | 2a5d4d8 | 2009-07-30 10:23:21 -0700 | [diff] [blame] | 865 | return |
| 866 | fi |
Ying Wang | 9cd1764 | 2012-12-13 10:52:07 -0800 | [diff] [blame] | 867 | \cd .. |
Joe Onorato | 2a5d4d8 | 2009-07-30 10:23:21 -0700 | [diff] [blame] | 868 | done |
Ying Wang | 9cd1764 | 2012-12-13 10:52:07 -0800 | [diff] [blame] | 869 | \cd $HERE |
Joe Onorato | 2a5d4d8 | 2009-07-30 10:23:21 -0700 | [diff] [blame] | 870 | echo "can't find Android.mk" |
| 871 | } |
| 872 | |
Elliott Hughes | 86e9917 | 2024-03-21 16:55:08 +0000 | [diff] [blame] | 873 | # Ensure that we're always using the adb in the tree. This works around the fact |
| 874 | # that bash caches $PATH lookups, so if you use adb before lunching/building the |
| 875 | # one in your tree, you'll continue to get /usr/bin/adb or whatever even after |
| 876 | # you have the one from your current tree on your path. Historically this would |
| 877 | # cause confusion because glinux had adb in /usr/bin/ by default, though that |
| 878 | # doesn't appear to be the case on my rodete hosts; it is however still the case |
| 879 | # that my Mac has /usr/local/bin/adb installed by default and on the default |
| 880 | # path. |
Shaju Mathew | 2143900 | 2023-07-10 00:53:22 +0000 | [diff] [blame] | 881 | function adb() { |
Elliott Hughes | 57c47b7 | 2024-03-22 15:46:59 +0000 | [diff] [blame] | 882 | # We need `command which` because zsh has a built-in `which` that's more |
| 883 | # like `type`. |
| 884 | local ADB=$(command which adb) |
Elliott Hughes | 7e7ff75 | 2024-03-20 17:23:40 -0700 | [diff] [blame] | 885 | if [ -z "$ADB" ]; then |
| 886 | echo "Command adb not found; try lunch (and building) first?" |
| 887 | return 1 |
| 888 | fi |
Zhuoyao Zhang | 60dd9dd | 2024-04-19 00:07:59 +0000 | [diff] [blame] | 889 | run_tool_with_logging "ADB" $ADB "${@}" |
Shaju Mathew | 2143900 | 2023-07-10 00:53:22 +0000 | [diff] [blame] | 890 | } |
| 891 | |
Zhuoyao Zhang | f02aadf | 2024-06-10 18:28:25 +0000 | [diff] [blame] | 892 | function fastboot() { |
| 893 | local FASTBOOT=$(command which fastboot) |
| 894 | if [ -z "$FASTBOOT" ]; then |
| 895 | echo "Command fastboot not found; try lunch (and building) first?" |
| 896 | return 1 |
| 897 | fi |
| 898 | # Support tool event logging for fastboot command. |
| 899 | run_tool_with_logging "FASTBOOT" $FASTBOOT "${@}" |
| 900 | } |
| 901 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 902 | # communicate with a running device or emulator, set up necessary state, |
| 903 | # and run the hat command. |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 904 | function runhat() |
| 905 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 906 | # process standard adb options |
| 907 | local adbTarget="" |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 908 | if [ "$1" = "-d" -o "$1" = "-e" ]; then |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 909 | adbTarget=$1 |
| 910 | shift 1 |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 911 | elif [ "$1" = "-s" ]; then |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 912 | adbTarget="$1 $2" |
| 913 | shift 2 |
| 914 | fi |
| 915 | local adbOptions=${adbTarget} |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 916 | #echo adbOptions = ${adbOptions} |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 917 | |
| 918 | # runhat options |
| 919 | local targetPid=$1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 920 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 921 | if [ "$targetPid" = "" ]; then |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 922 | echo "Usage: runhat [ -d | -e | -s serial ] target-pid" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 923 | return |
| 924 | fi |
| 925 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 926 | # confirm hat is available |
| 927 | if [ -z $(which hat) ]; then |
| 928 | echo "hat is not available in this configuration." |
| 929 | return |
| 930 | fi |
| 931 | |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 932 | # issue "am" command to cause the hprof dump |
Nick Kralevich | 9948b1e | 2014-07-18 15:45:38 -0700 | [diff] [blame] | 933 | local devFile=/data/local/tmp/hprof-$targetPid |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 934 | echo "Poking $targetPid and waiting for data..." |
Dianne Hackborn | 6b9549f | 2012-09-26 15:00:59 -0700 | [diff] [blame] | 935 | echo "Storing data at $devFile" |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 936 | adb ${adbOptions} shell am dumpheap $targetPid $devFile |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 937 | echo "Press enter when logcat shows \"hprof: heap dump completed\"" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 938 | echo -n "> " |
| 939 | read |
| 940 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 941 | local localFile=/tmp/$$-hprof |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 942 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 943 | echo "Retrieving file $devFile..." |
| 944 | adb ${adbOptions} pull $devFile $localFile |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 945 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 946 | adb ${adbOptions} shell rm $devFile |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 947 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 948 | echo "Running hat on $localFile" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 949 | echo "View the output by pointing your browser at http://localhost:7000/" |
| 950 | echo "" |
Dianne Hackborn | 6e4e1bb | 2011-11-10 15:19:51 -0800 | [diff] [blame] | 951 | hat -JXmx512m $localFile |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 952 | } |
| 953 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 954 | function godir () { |
| 955 | if [[ -z "$1" ]]; then |
| 956 | echo "Usage: godir <regex>" |
| 957 | return |
| 958 | fi |
Christopher Ferris | 55257d2 | 2017-03-23 11:08:58 -0700 | [diff] [blame] | 959 | local T=$(gettop) |
| 960 | local FILELIST |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 961 | if [ ! "$OUT_DIR" = "" ]; then |
Brian Carlstrom | f225742 | 2015-09-30 20:28:54 -0700 | [diff] [blame] | 962 | mkdir -p $OUT_DIR |
| 963 | FILELIST=$OUT_DIR/filelist |
| 964 | else |
| 965 | FILELIST=$T/filelist |
| 966 | fi |
| 967 | if [[ ! -f $FILELIST ]]; then |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 968 | echo -n "Creating index..." |
Brian Carlstrom | f225742 | 2015-09-30 20:28:54 -0700 | [diff] [blame] | 969 | (\cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > $FILELIST) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 970 | echo " Done" |
| 971 | echo "" |
| 972 | fi |
| 973 | local lines |
Brian Carlstrom | f225742 | 2015-09-30 20:28:54 -0700 | [diff] [blame] | 974 | lines=($(\grep "$1" $FILELIST | sed -e 's/\/[^/]*$//' | sort | uniq)) |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 975 | if [[ ${#lines[@]} = 0 ]]; then |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 976 | echo "Not found" |
| 977 | return |
| 978 | fi |
| 979 | local pathname |
| 980 | local choice |
| 981 | if [[ ${#lines[@]} > 1 ]]; then |
| 982 | while [[ -z "$pathname" ]]; do |
| 983 | local index=1 |
| 984 | local line |
| 985 | for line in ${lines[@]}; do |
| 986 | printf "%6s %s\n" "[$index]" $line |
Doug Zongker | 2903498 | 2011-04-22 08:16:56 -0700 | [diff] [blame] | 987 | index=$(($index + 1)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 988 | done |
| 989 | echo |
| 990 | echo -n "Select one: " |
| 991 | unset choice |
| 992 | read choice |
| 993 | if [[ $choice -gt ${#lines[@]} || $choice -lt 1 ]]; then |
| 994 | echo "Invalid choice" |
| 995 | continue |
| 996 | fi |
Guillaume Chelfi | ce000fd | 2019-10-03 12:02:46 +0200 | [diff] [blame] | 997 | pathname=${lines[@]:$(($choice-1)):1} |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 998 | done |
| 999 | else |
Guillaume Chelfi | ce000fd | 2019-10-03 12:02:46 +0200 | [diff] [blame] | 1000 | pathname=${lines[@]:0:1} |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1001 | fi |
Ying Wang | 9cd1764 | 2012-12-13 10:52:07 -0800 | [diff] [blame] | 1002 | \cd $T/$pathname |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1003 | } |
| 1004 | |
Rett Berg | 78d1c93 | 2019-01-24 14:34:23 -0800 | [diff] [blame] | 1005 | # Go to a specific module in the android tree, as cached in module-info.json. If any build change |
| 1006 | # is made, and it should be reflected in the output, you should run 'refreshmod' first. |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1007 | # Note: This function is in envsetup because changing the directory needs to happen in the current |
| 1008 | # shell. All other functions that use module-info.json should be in build/soong/bin. |
Rett Berg | 78d1c93 | 2019-01-24 14:34:23 -0800 | [diff] [blame] | 1009 | function gomod() { |
| 1010 | if [[ $# -ne 1 ]]; then |
| 1011 | echo "usage: gomod <module>" >&2 |
| 1012 | return 1 |
| 1013 | fi |
| 1014 | |
| 1015 | local path="$(pathmod $@)" |
| 1016 | if [ -z "$path" ]; then |
| 1017 | return 1 |
| 1018 | fi |
| 1019 | cd $path |
| 1020 | } |
| 1021 | |
dimitry | 73b8481 | 2018-12-11 18:06:00 +0100 | [diff] [blame] | 1022 | function _complete_android_module_names() { |
Steven Moreland | 62054a4 | 2018-12-06 10:11:40 -0800 | [diff] [blame] | 1023 | local word=${COMP_WORDS[COMP_CWORD]} |
Cole Faust | 5d825b7 | 2022-10-26 18:16:44 -0700 | [diff] [blame] | 1024 | COMPREPLY=( $(allmod | grep -E "^$word") ) |
Steven Moreland | 62054a4 | 2018-12-06 10:11:40 -0800 | [diff] [blame] | 1025 | } |
| 1026 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 1027 | function get_make_command() |
| 1028 | { |
Dan Willemsen | d41ec5a | 2017-07-12 16:14:50 -0700 | [diff] [blame] | 1029 | # If we're in the top of an Android tree, use soong_ui.bash instead of make |
| 1030 | if [ -f build/soong/soong_ui.bash ]; then |
Dan Willemsen | e984224 | 2017-07-28 13:00:13 -0700 | [diff] [blame] | 1031 | # Always use the real make if -C is passed in |
| 1032 | for arg in "$@"; do |
| 1033 | if [[ $arg == -C* ]]; then |
| 1034 | echo command make |
| 1035 | return |
| 1036 | fi |
| 1037 | done |
Dan Willemsen | d41ec5a | 2017-07-12 16:14:50 -0700 | [diff] [blame] | 1038 | echo build/soong/soong_ui.bash --make-mode |
| 1039 | else |
| 1040 | echo command make |
| 1041 | fi |
Ying Wang | ed21d4c | 2014-08-24 22:14:19 -0700 | [diff] [blame] | 1042 | } |
| 1043 | |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 1044 | function make() |
| 1045 | { |
Dan Willemsen | e984224 | 2017-07-28 13:00:13 -0700 | [diff] [blame] | 1046 | _wrap_build $(get_make_command "$@") "$@" |
Dan Willemsen | d41ec5a | 2017-07-12 16:14:50 -0700 | [diff] [blame] | 1047 | } |
| 1048 | |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1049 | # Zsh needs bashcompinit called to support bash-style completion. |
Patrik Fimml | df248e6 | 2018-10-15 18:15:12 +0200 | [diff] [blame] | 1050 | function enable_zsh_completion() { |
| 1051 | # Don't override user's options if bash-style completion is already enabled. |
| 1052 | if ! declare -f complete >/dev/null; then |
| 1053 | autoload -U compinit && compinit |
| 1054 | autoload -U bashcompinit && bashcompinit |
| 1055 | fi |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1056 | } |
| 1057 | |
| 1058 | function validate_current_shell() { |
| 1059 | local current_sh="$(ps -o command -p $$)" |
| 1060 | case "$current_sh" in |
Raphael Moll | 70a86b0 | 2011-06-20 16:03:14 -0700 | [diff] [blame] | 1061 | *bash*) |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1062 | function check_type() { type -t "$1"; } |
Raphael Moll | 70a86b0 | 2011-06-20 16:03:14 -0700 | [diff] [blame] | 1063 | ;; |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1064 | *zsh*) |
| 1065 | function check_type() { type "$1"; } |
Matt Alexander | d9c5656 | 2020-05-21 10:49:17 +0000 | [diff] [blame] | 1066 | enable_zsh_completion ;; |
Raphael Moll | 70a86b0 | 2011-06-20 16:03:14 -0700 | [diff] [blame] | 1067 | *) |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1068 | echo -e "WARNING: Only bash and zsh are supported.\nUse of other shell would lead to erroneous results." |
Raphael Moll | 70a86b0 | 2011-06-20 16:03:14 -0700 | [diff] [blame] | 1069 | ;; |
| 1070 | esac |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1071 | } |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 1072 | |
| 1073 | # Execute the contents of any vendorsetup.sh files we can find. |
Dan Willemsen | d855a72 | 2019-02-12 15:52:36 -0800 | [diff] [blame] | 1074 | # Unless we find an allowed-vendorsetup_sh-files file, in which case we'll only |
| 1075 | # load those. |
| 1076 | # |
| 1077 | # This allows loading only approved vendorsetup.sh files |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1078 | function source_vendorsetup() { |
Jim Tang | c4dba1d | 2019-07-25 16:54:27 +0800 | [diff] [blame] | 1079 | unset VENDOR_PYTHONPATH |
Patrice Arruda | aa4b824 | 2020-10-12 21:29:14 +0000 | [diff] [blame] | 1080 | local T="$(gettop)" |
Dan Willemsen | d855a72 | 2019-02-12 15:52:36 -0800 | [diff] [blame] | 1081 | allowed= |
Patrice Arruda | aa4b824 | 2020-10-12 21:29:14 +0000 | [diff] [blame] | 1082 | for f in $(cd "$T" && find -L device vendor product -maxdepth 4 -name 'allowed-vendorsetup_sh-files' 2>/dev/null | sort); do |
Dan Willemsen | d855a72 | 2019-02-12 15:52:36 -0800 | [diff] [blame] | 1083 | if [ -n "$allowed" ]; then |
| 1084 | echo "More than one 'allowed_vendorsetup_sh-files' file found, not including any vendorsetup.sh files:" |
| 1085 | echo " $allowed" |
| 1086 | echo " $f" |
| 1087 | return |
| 1088 | fi |
Patrice Arruda | aa4b824 | 2020-10-12 21:29:14 +0000 | [diff] [blame] | 1089 | allowed="$T/$f" |
Dan Willemsen | d855a72 | 2019-02-12 15:52:36 -0800 | [diff] [blame] | 1090 | done |
| 1091 | |
| 1092 | allowed_files= |
| 1093 | [ -n "$allowed" ] && allowed_files=$(cat "$allowed") |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1094 | for dir in device vendor product; do |
Patrice Arruda | aa4b824 | 2020-10-12 21:29:14 +0000 | [diff] [blame] | 1095 | for f in $(cd "$T" && test -d $dir && \ |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1096 | find -L $dir -maxdepth 4 -name 'vendorsetup.sh' 2>/dev/null | sort); do |
Dan Willemsen | d855a72 | 2019-02-12 15:52:36 -0800 | [diff] [blame] | 1097 | |
| 1098 | if [[ -z "$allowed" || "$allowed_files" =~ $f ]]; then |
Patrice Arruda | aa4b824 | 2020-10-12 21:29:14 +0000 | [diff] [blame] | 1099 | echo "including $f"; . "$T/$f" |
Dan Willemsen | d855a72 | 2019-02-12 15:52:36 -0800 | [diff] [blame] | 1100 | else |
| 1101 | echo "ignoring $f, not in $allowed" |
| 1102 | fi |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1103 | done |
| 1104 | done |
Kousik Kumar | ec5416c | 2023-09-14 17:11:45 +0000 | [diff] [blame] | 1105 | |
| 1106 | if [[ "${PWD}" == /google/cog/* ]]; then |
| 1107 | f="build/make/cogsetup.sh" |
| 1108 | echo "including $f"; . "$T/$f" |
| 1109 | fi |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1110 | } |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 1111 | |
Dan Albert | bab814f | 2020-08-26 15:34:53 -0700 | [diff] [blame] | 1112 | function showcommands() { |
| 1113 | local T=$(gettop) |
| 1114 | if [[ -z "$TARGET_PRODUCT" ]]; then |
| 1115 | >&2 echo "TARGET_PRODUCT not set. Run lunch." |
| 1116 | return |
| 1117 | fi |
| 1118 | case $(uname -s) in |
| 1119 | Darwin) |
| 1120 | PREBUILT_NAME=darwin-x86 |
| 1121 | ;; |
| 1122 | Linux) |
| 1123 | PREBUILT_NAME=linux-x86 |
| 1124 | ;; |
| 1125 | *) |
| 1126 | >&2 echo Unknown host $(uname -s) |
| 1127 | return |
| 1128 | ;; |
| 1129 | esac |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 1130 | OUT_DIR="$(_get_abs_build_var_cached OUT_DIR)" |
Dan Albert | bab814f | 2020-08-26 15:34:53 -0700 | [diff] [blame] | 1131 | if [[ "$1" == "--regenerate" ]]; then |
| 1132 | shift 1 |
| 1133 | NINJA_ARGS="-t commands $@" m |
| 1134 | else |
| 1135 | (cd $T && prebuilts/build-tools/$PREBUILT_NAME/bin/ninja \ |
| 1136 | -f $OUT_DIR/combined-${TARGET_PRODUCT}.ninja \ |
| 1137 | -t commands "$@") |
| 1138 | fi |
| 1139 | } |
| 1140 | |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1141 | # These functions used to be here but are now standalone scripts |
| 1142 | # in build/soong/bin. Unset these for the time being so the real |
| 1143 | # script is picked up. |
Joe Onorato | 2312475 | 2024-05-14 15:06:48 -0700 | [diff] [blame] | 1144 | # TODO: Remove this some time after a suitable delay (maybe 2025?) |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1145 | unset allmod |
Joe Onorato | 2312475 | 2024-05-14 15:06:48 -0700 | [diff] [blame] | 1146 | unset aninja |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1147 | unset cgrep |
Joe Onorato | 3acb308 | 2024-05-24 14:14:46 -0700 | [diff] [blame] | 1148 | unset core |
| 1149 | unset coredump_enable |
| 1150 | unset coredump_setup |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1151 | unset dirmods |
Joe Onorato | 0e68f70 | 2024-05-24 14:19:21 -0700 | [diff] [blame] | 1152 | unset get_build_var |
| 1153 | unset get_abs_build_var |
Joe Onorato | 3acb308 | 2024-05-24 14:14:46 -0700 | [diff] [blame] | 1154 | unset getlastscreenshot |
| 1155 | unset getprebuilt |
| 1156 | unset getscreenshotpath |
| 1157 | unset getsdcardpath |
| 1158 | unset gettargetarch |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1159 | unset ggrep |
| 1160 | unset gogrep |
Joe Onorato | 3acb308 | 2024-05-24 14:14:46 -0700 | [diff] [blame] | 1161 | unset hmm |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1162 | unset installmod |
Joe Onorato | 3acb308 | 2024-05-24 14:14:46 -0700 | [diff] [blame] | 1163 | unset is64bit |
| 1164 | unset isviewserverstarted |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1165 | unset jgrep |
| 1166 | unset jsongrep |
Joe Onorato | 3acb308 | 2024-05-24 14:14:46 -0700 | [diff] [blame] | 1167 | unset key_back |
| 1168 | unset key_home |
| 1169 | unset key_menu |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1170 | unset ktgrep |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1171 | unset m |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1172 | unset mangrep |
| 1173 | unset mgrep |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1174 | unset mm |
| 1175 | unset mma |
| 1176 | unset mmm |
| 1177 | unset mmma |
| 1178 | unset outmod |
| 1179 | unset overrideflags |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1180 | unset owngrep |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1181 | unset pathmod |
Joe Onorato | ff277c5 | 2024-05-23 12:52:07 -0700 | [diff] [blame] | 1182 | unset pez |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1183 | unset pygrep |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1184 | unset qpid |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1185 | unset rcgrep |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1186 | unset refreshmod |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1187 | unset resgrep |
| 1188 | unset rsgrep |
Zhuoyao Zhang | 1698d49 | 2024-05-21 23:55:27 +0000 | [diff] [blame] | 1189 | unset run_tool_with_logging |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1190 | unset sepgrep |
| 1191 | unset sgrep |
Joe Onorato | 3acb308 | 2024-05-24 14:14:46 -0700 | [diff] [blame] | 1192 | unset startviewserver |
| 1193 | unset stopviewserver |
| 1194 | unset systemstack |
Joe Onorato | 6b54383 | 2024-05-23 12:26:50 -0700 | [diff] [blame] | 1195 | unset syswrite |
Joe Onorato | 1b9ab29 | 2024-05-17 12:16:43 -0700 | [diff] [blame] | 1196 | unset tomlgrep |
| 1197 | unset treegrep |
Cole Faust | 45844ab | 2022-08-30 13:59:07 -0700 | [diff] [blame] | 1198 | |
Colin Cross | 7131972 | 2023-10-24 10:58:46 -0700 | [diff] [blame] | 1199 | |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1200 | validate_current_shell |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 1201 | set_global_paths |
Jim Tang | a881a25 | 2018-06-19 16:34:41 +0800 | [diff] [blame] | 1202 | source_vendorsetup |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 1203 | addcompletions |
Joe Onorato | 7c3a77f | 2022-12-05 13:05:14 -0800 | [diff] [blame] | 1204 | |
Chirayu Desai | f17e310 | 2013-03-19 17:50:37 +0530 | [diff] [blame] | 1205 | export ANDROID_BUILD_TOP=$(gettop) |
Michael Bestas | 3a8fb88 | 2016-08-26 00:37:02 +0300 | [diff] [blame] | 1206 | |
| 1207 | . $ANDROID_BUILD_TOP/vendor/lineage/build/envsetup.sh |