Merge changes If78eacd6,Ie418aee2,Ica87b396 into main
* changes: Set empty TARGET_RELEASE for some commands Fix banchan for trunk stable builds Require lunch targets to be product-release-variant
This commit is contained in:
43
envsetup.sh
43
envsetup.sh
@@ -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.
|
||||
@@ -205,6 +205,7 @@ function check_product()
|
||||
return
|
||||
fi
|
||||
TARGET_PRODUCT=$1 \
|
||||
TARGET_RELEASE= \
|
||||
TARGET_BUILD_VARIANT= \
|
||||
TARGET_BUILD_TYPE= \
|
||||
TARGET_BUILD_APPS= \
|
||||
@@ -486,7 +487,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
|
||||
@@ -728,7 +729,7 @@ function print_lunch_menu()
|
||||
{
|
||||
local uname=$(uname)
|
||||
local choices
|
||||
choices=$(TARGET_BUILD_APPS= TARGET_PRODUCT= TARGET_BUILD_VARIANT= get_build_var COMMON_LUNCH_CHOICES 2>/dev/null)
|
||||
choices=$(TARGET_BUILD_APPS= TARGET_PRODUCT= TARGET_RELEASE= TARGET_BUILD_VARIANT= get_build_var COMMON_LUNCH_CHOICES 2>/dev/null)
|
||||
local ret=$?
|
||||
|
||||
echo
|
||||
@@ -804,26 +805,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 +832,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
|
||||
@@ -960,6 +948,8 @@ function banchan()
|
||||
{
|
||||
local showHelp="$(echo $* | xargs -n 1 echo | \grep -E '^(help)$' | xargs)"
|
||||
local product="$(echo $* | xargs -n 1 echo | \grep -E '^(.*_)?(arm|x86|arm64|riscv64|x86_64|arm64only|x86_64only)$' | xargs)"
|
||||
# TODO: Expand banchan to take release arguments (and update hmm() usage).
|
||||
local release="trunk_staging"
|
||||
local variant="$(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$' | xargs)"
|
||||
local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|(.*_)?(arm|x86|arm64|riscv64|x86_64))$' | xargs)"
|
||||
|
||||
@@ -974,6 +964,10 @@ function banchan()
|
||||
echo "banchan: Error: Multiple build archs or products supplied: $products"
|
||||
return
|
||||
fi
|
||||
if [ $(echo $release | wc -w) -gt 1 ]; then
|
||||
echo "banchan: Error: Multiple build releases supplied: $release"
|
||||
return
|
||||
fi
|
||||
if [ $(echo $variant | wc -w) -gt 1 ]; then
|
||||
echo "banchan: Error: Multiple build variants supplied: $variant"
|
||||
return
|
||||
@@ -997,6 +991,7 @@ function banchan()
|
||||
fi
|
||||
|
||||
export TARGET_PRODUCT=$product
|
||||
export TARGET_RELEASE=$release
|
||||
export TARGET_BUILD_VARIANT=$variant
|
||||
export TARGET_BUILD_DENSITY=alldpi
|
||||
export TARGET_BUILD_TYPE=release
|
||||
|
||||
Reference in New Issue
Block a user