Merge "Implement multitree lunch" am: 9d1b28ed10 am: 1080b9f3f6 am: 9ebe2e2729

Original change: https://android-review.googlesource.com/c/platform/build/+/2060107

Change-Id: Iec70a4739c1b93050b3d4827b409c554da0dd2d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2022-04-09 03:13:22 +00:00
committed by Automerger Merge Worker
23 changed files with 593 additions and 0 deletions

View File

@@ -425,6 +425,61 @@ function addcompletions()
complete -F _complete_android_module_names m
}
function multitree_lunch_help()
{
echo "usage: lunch PRODUCT-VARIANT" 1>&2
echo " Set up android build environment based on a product short name and variant" 1>&2
echo 1>&2
echo "lunch COMBO_FILE VARIANT" 1>&2
echo " Set up android build environment based on a specific lunch combo file" 1>&2
echo " and variant." 1>&2
echo 1>&2
echo "lunch --print [CONFIG]" 1>&2
echo " Print the contents of a configuration. If CONFIG is supplied, that config" 1>&2
echo " will be flattened and printed. If CONFIG is not supplied, the currently" 1>&2
echo " selected config will be printed. Returns 0 on success or nonzero on error." 1>&2
echo 1>&2
echo "lunch --list" 1>&2
echo " List all possible combo files available in the current tree" 1>&2
echo 1>&2
echo "lunch --help" 1>&2
echo "lunch -h" 1>&2
echo " Prints this message." 1>&2
}
function multitree_lunch()
{
local code
local results
if $(echo "$1" | grep -q '^-') ; then
# Calls starting with a -- argument are passed directly and the function
# returns with the lunch.py exit code.
build/make/orchestrator/core/lunch.py "$@"
code=$?
if [[ $code -eq 2 ]] ; then
echo 1>&2
multitree_lunch_help
return $code
elif [[ $code -ne 0 ]] ; then
return $code
fi
else
# All other calls go through the --lunch variant of lunch.py
results=($(build/make/orchestrator/core/lunch.py --lunch "$@"))
code=$?
if [[ $code -eq 2 ]] ; then
echo 1>&2
multitree_lunch_help
return $code
elif [[ $code -ne 0 ]] ; then
return $code
fi
export TARGET_BUILD_COMBO=${results[0]}
export TARGET_BUILD_VARIANT=${results[1]}
fi
}
function choosetype()
{
echo "Build type choices are:"