diff options
author | Dan Willemsen | 2018-04-04 17:41:41 -0500 |
---|---|---|
committer | Dan Willemsen | 2018-04-04 19:14:47 -0500 |
commit | af2e1f84870525c64e6071ded0903c721e43a232 (patch) | |
tree | ee4118b8340865e02357607b5367c3773590f484 /envsetup.sh | |
parent | 946b5c5e7f5cec48724c4bf3762289be2a29a666 (diff) | |
download | platform-build-af2e1f84870525c64e6071ded0903c721e43a232.tar.gz platform-build-af2e1f84870525c64e6071ded0903c721e43a232.tar.xz platform-build-af2e1f84870525c64e6071ded0903c721e43a232.zip |
Start moving add_lunch_combo to Make
Start deprecating add_lunch_combo, preferring a list of common choices
in each AndroidProducts.mk file.
This list will be validated so that we don't have typos:
https://android-review.git.corp.google.com/c/device/generic/car/+/619533
Or targets that no longer exist.
Bug: 77599627
Test: lunch
Test: lunch 34
Test: lunch aosp_x86_64-eng
Test: lunch aosp_<tab>
Change-Id: Ie0ddaa94cbd6cee26584f56f1706a8ec1333f87e
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/envsetup.sh b/envsetup.sh index 906f5e5b5..518225368 100644 --- a/envsetup.sh +++ b/envsetup.sh | |||
@@ -543,14 +543,6 @@ function add_lunch_combo() | |||
543 | LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo) | 543 | LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo) |
544 | } | 544 | } |
545 | 545 | ||
546 | # add the default one here | ||
547 | add_lunch_combo aosp_arm-eng | ||
548 | add_lunch_combo aosp_arm64-eng | ||
549 | add_lunch_combo aosp_mips-eng | ||
550 | add_lunch_combo aosp_mips64-eng | ||
551 | add_lunch_combo aosp_x86-eng | ||
552 | add_lunch_combo aosp_x86_64-eng | ||
553 | |||
554 | function print_lunch_menu() | 546 | function print_lunch_menu() |
555 | { | 547 | { |
556 | local uname=$(uname) | 548 | local uname=$(uname) |
@@ -561,7 +553,7 @@ function print_lunch_menu() | |||
561 | 553 | ||
562 | local i=1 | 554 | local i=1 |
563 | local choice | 555 | local choice |
564 | for choice in ${LUNCH_MENU_CHOICES[@]} | 556 | for choice in $(TARGET_BUILD_APPS= LUNCH_MENU_CHOICES="${LUNCH_MENU_CHOICES[@]}" get_build_var COMMON_LUNCH_CHOICES) |
565 | do | 557 | do |
566 | echo " $i. $choice" | 558 | echo " $i. $choice" |
567 | i=$(($i+1)) | 559 | i=$(($i+1)) |
@@ -589,9 +581,10 @@ function lunch() | |||
589 | selection=aosp_arm-eng | 581 | selection=aosp_arm-eng |
590 | elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$") | 582 | elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$") |
591 | then | 583 | then |
592 | if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ] | 584 | local choices=($(TARGET_BUILD_APPS= LUNCH_MENU_CHOICES="${LUNCH_MENU_CHOICES[@]}" get_build_var COMMON_LUNCH_CHOICES)) |
585 | if [ $answer -le ${#choices[@]} ] | ||
593 | then | 586 | then |
594 | selection=${LUNCH_MENU_CHOICES[$(($answer-1))]} | 587 | selection=${choices[$(($answer-1))]} |
595 | fi | 588 | fi |
596 | else | 589 | else |
597 | selection=$answer | 590 | selection=$answer |
@@ -642,6 +635,7 @@ function lunch() | |||
642 | destroy_build_var_cache | 635 | destroy_build_var_cache |
643 | } | 636 | } |
644 | 637 | ||
638 | unset COMMON_LUNCH_CHOICES_CACHE | ||
645 | # Tab completion for lunch. | 639 | # Tab completion for lunch. |
646 | function _lunch() | 640 | function _lunch() |
647 | { | 641 | { |
@@ -650,7 +644,11 @@ function _lunch() | |||
650 | cur="${COMP_WORDS[COMP_CWORD]}" | 644 | cur="${COMP_WORDS[COMP_CWORD]}" |
651 | prev="${COMP_WORDS[COMP_CWORD-1]}" | 645 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
652 | 646 | ||
653 | COMPREPLY=( $(compgen -W "${LUNCH_MENU_CHOICES[*]}" -- ${cur}) ) | 647 | if [ -z "$COMMON_LUNCH_CHOICES_CACHE" ]; then |
648 | COMMON_LUNCH_CHOICES_CACHE=$(TARGET_BUILD_APPS= LUNCH_MENU_CHOICES="${LUNCH_MENU_CHOICES[@]}" get_build_var COMMON_LUNCH_CHOICES) | ||
649 | fi | ||
650 | |||
651 | COMPREPLY=( $(compgen -W "${COMMON_LUNCH_CHOICES_CACHE}" -- ${cur}) ) | ||
654 | return 0 | 652 | return 0 |
655 | } | 653 | } |
656 | complete -F _lunch lunch | 654 | complete -F _lunch lunch |