Require lunch targets to be product-release-variant

Instead of supporting both product-variant and
product-release-variant, we now require the release
type to be given to use.

Bug: 307946156
Test: 'lunch aosp_mokey-userdebug' (now) fails; 'lunch aosp_mokey-trunk_staging-userdebug' (still) works
Change-Id: Ica87b3969f950a57232615f33bfe5f4012a743d6
This commit is contained in:
Greg Kaiser
2023-10-27 14:15:48 -06:00
parent 3006f169b5
commit 5e2d3399d3

View File

@@ -56,7 +56,7 @@ cat <<EOF
Run "m help" for help with the build system itself.
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch: lunch <product_name>-<build_variant>
- lunch: lunch <product_name>-<release_type>-<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.
@@ -486,7 +486,7 @@ function addcompletions()
function multitree_lunch_help()
{
echo "usage: lunch PRODUCT-VARIANT" 1>&2
echo "usage: lunch PRODUCT-RELEASE-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
@@ -804,26 +804,16 @@ function lunch()
export TARGET_BUILD_APPS=
# Support either <product>-<variant> or <product>-<release>-<variant>
local product release_and_variant release variant
product=${selection%%-*} # Trim everything after first dash
release_and_variant=${selection#*-} # Trim everything up to first dash
if [ "$release_and_variant" != "$selection" ]; then
local first=${release_and_variant%%-*} # Trim everything after first dash
if [ "$first" != "$release_and_variant" ]; then
# There is a 2nd dash, split into release-variant
release=$first # Everything up to the dash
variant=${release_and_variant#*-} # Trim everything up to dash
else
# There is not a 2nd dash, default to variant as the second param
variant=$first
fi
fi
# This must be <product>-<release>-<variant>
local product release variant
# Split string on the '-' character.
IFS="-" read -r product release variant <<< "$selection"
if [ -z "$product" ]
if [[ -z "$product" ]] || [[ -z "$release" ]] || [[ -z "$variant" ]]
then
echo
echo "Invalid lunch combo: $selection"
echo "Valid combos must be of the form <product>-<release>-<variant>"
return 1
fi
@@ -841,11 +831,8 @@ function lunch()
fi
export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)
if [ -n "$release" ]; then
export TARGET_RELEASE=$release
else
unset TARGET_RELEASE
fi
export TARGET_RELEASE=$release
# Note this is the string "release", not the value of the variable.
export TARGET_BUILD_TYPE=release
if [ $used_lunch_menu -eq 1 ]; then