From b3fda301c2c07c35cc28f37e7c1a2adce4898b55 Mon Sep 17 00:00:00 2001 From: Jim Tang Date: Sat, 22 Dec 2018 10:24:55 +0800 Subject: [PATCH] Add Asuite prebuilds in PATH and remove functions. Remove atest/acloud/aidegen functions and append prebuilt path in PATH. Use local built by default; if there is no local built, use the prebuilt one instead. Bug: Test: $ source build/envsetup.sh; lunch $ echo $PATH|sed 's/:/\n/g' | egrep "out|asuite" # will see out/host prioritises prebuilts/asuite. Change-Id: I1e5869bcb81cf7058cf8971f480a47d2c8f8b6f0 --- envsetup.sh | 60 +++++++---------------------------------------------- 1 file changed, 8 insertions(+), 52 deletions(-) diff --git a/envsetup.sh b/envsetup.sh index a03f02de58..d6b6bb4faa 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -267,6 +267,13 @@ function setpaths() export ANDROID_EMULATOR_PREBUILTS fi + # Append asuite prebuilts path to ANDROID_BUILD_PATHS. + local os_arch=$(get_build_var HOST_PREBUILT_TAG) + local ACLOUD_PATH="$T/prebuilts/asuite/acloud/$os_arch:" + local AIDEGEN_PATH="$T/prebuilts/asuite/aidegen/$os_arch:" + local ATEST_PATH="$T/prebuilts/asuite/atest/$os_arch:" + export ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS$ACLOUD_PATH$AIDEGEN_PATH$ATEST_PATH + export PATH=$ANDROID_BUILD_PATHS$PATH # out with the duplicate old @@ -355,7 +362,7 @@ function addcompletions() local completion_files=( system/core/adb/adb.bash system/core/fastboot/fastboot.bash - tools/tradefederation/core/atest/atest_completion.sh + tools/asuite/asuite.sh ) # Completion can be disabled selectively to allow users to use non-standard completion. # e.g. @@ -1678,23 +1685,6 @@ function provision() "$ANDROID_PRODUCT_OUT/provision-device" "$@" } -function atest() -{ - # Let's use the built version over the prebuilt, then source code. - local os_arch=$(get_build_var HOST_PREBUILT_TAG) - local built_atest=${ANDROID_HOST_OUT}/bin/atest - local prebuilt_atest="$(gettop)"/prebuilts/asuite/atest/$os_arch/atest - if [[ -x $built_atest ]]; then - $built_atest "$@" - elif [[ -x $prebuilt_atest ]]; then - $prebuilt_atest "$@" - else - # TODO: once prebuilt atest released, remove the source code section - # and change the location of atest_completion.sh in addcompletions(). - "$(gettop)"/tools/tradefederation/core/atest/atest.py "$@" - fi -} - # Zsh needs bashcompinit called to support bash-style completion. function enable_zsh_completion() { # Don't override user's options if bash-style completion is already enabled. @@ -1719,40 +1709,6 @@ function validate_current_shell() { esac } -function acloud() -{ - # Let's use the built version over the prebuilt. - local built_acloud=${ANDROID_HOST_OUT}/bin/acloud - if [ -f $built_acloud ]; then - $built_acloud "$@" - return $? - fi - - local host_os_arch=$(get_build_var HOST_PREBUILT_TAG) - case $host_os_arch in - linux-x86) "$(gettop)"/prebuilts/asuite/acloud/linux-x86/acloud "$@" - ;; - darwin-x86) "$(gettop)"/prebuilts/asuite/acloud/darwin-x86/acloud "$@" - ;; - *) - echo "acloud is not supported on your host arch: $host_os_arch" - ;; - esac -} - -function aidegen() -{ - # Always use the prebuilt version. - local host_os_arch=$(get_build_var HOST_PREBUILT_TAG) - case $host_os_arch in - linux-x86) "$(gettop)"/prebuilts/asuite/aidegen/linux-x86/aidegen "$@" - ;; - *) - echo "aidegen is not supported on your host arch: $host_os_arch" - ;; - esac -} - # Execute the contents of any vendorsetup.sh files we can find. function source_vendorsetup() { for dir in device vendor product; do