diff options
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/envsetup.sh b/envsetup.sh index 7a22840f5f..cc808d282c 100644 --- a/envsetup.sh +++ b/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 @@ -774,8 +775,8 @@ function lunch() answer=$1 else print_lunch_menu - echo "Which would you like? [aosp_arm-eng]" - echo -n "Pick from common choices above (e.g. 13) or specify your own (e.g. aosp_barbet-eng): " + echo "Which would you like? [aosp_arm-trunk_staging-eng]" + echo -n "Pick from common choices above (e.g. 13) or specify your own (e.g. aosp_barbet-trunk_staging-eng): " read answer used_lunch_menu=1 fi @@ -784,7 +785,7 @@ function lunch() if [ -z "$answer" ] then - selection=aosp_arm-eng + selection=aosp_arm-trunk_staging-eng elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$") then local choices=($(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES)) @@ -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 [[ -n "${ANDROID_QUIET_BUILD:-}" ]] || echo @@ -893,6 +881,8 @@ function tapas() { local showHelp="$(echo $* | xargs -n 1 echo | \grep -E '^(help)$' | xargs)" local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|arm64|x86_64)$' | xargs)" + # TODO(b/307975293): Expand tapas 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 density="$(echo $* | xargs -n 1 echo | \grep -E '^(ldpi|mdpi|tvdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|alldpi)$' | xargs)" local keys="$(echo $* | xargs -n 1 echo | \grep -E '^(devkeys)$' | xargs)" @@ -908,6 +898,10 @@ function tapas() echo "tapas: Error: Multiple build archs supplied: $arch" return fi + if [ $(echo $release | wc -w) -gt 1 ]; then + echo "tapas: Error: Multiple build releases supplied: $release" + return + fi if [ $(echo $variant | wc -w) -gt 1 ]; then echo "tapas: Error: Multiple build variants supplied: $variant" return @@ -942,6 +936,7 @@ function tapas() fi export TARGET_PRODUCT=$product + export TARGET_RELEASE=$release export TARGET_BUILD_VARIANT=$variant export TARGET_BUILD_DENSITY=$density export TARGET_BUILD_TYPE=release @@ -959,6 +954,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)" @@ -973,6 +970,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 @@ -996,6 +997,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 |