diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-08 03:53:51 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-08 03:53:51 +0000 |
commit | d95843237674c50fd9769d6377769f80f438bbb1 (patch) | |
tree | 8c1d8c8156a5a687286075be8435bb0be0061092 /build/android/envsetup.sh | |
parent | 3ac5894f4b2dd1789f6b47b8244166af65cac4be (diff) | |
download | chromium_src-d95843237674c50fd9769d6377769f80f438bbb1.zip chromium_src-d95843237674c50fd9769d6377769f80f438bbb1.tar.gz chromium_src-d95843237674c50fd9769d6377769f80f438bbb1.tar.bz2 |
android envsetup: Stop exporting CHROME_SRC, CURRENT_DIR, SCRIPT_DIR.
CHROME_SRC is only used inside of envsetup, there's no need to export it.
Depends on https://chrome-internal-review.googlesource.com/159331/
It looks like CURRENT_DIR and SCRIPT_DIR weren't exported intentionally.
Use "local" (which requires putting most of the code in this script in a
function) to make sure they don't make it into the environment that
envsetup is sourced from.
BUG=330631
NOTRY=true
R=yfriedman@chromium.org
Review URL: https://codereview.chromium.org/222933004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262292 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/envsetup.sh')
-rwxr-xr-x | build/android/envsetup.sh | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/build/android/envsetup.sh b/build/android/envsetup.sh index 74a5738..f5394f8 100755 --- a/build/android/envsetup.sh +++ b/build/android/envsetup.sh @@ -12,38 +12,42 @@ if [[ -n "$BASH_VERSION" && "${BASH_SOURCE:-$0}" == "$0" ]]; then exit 1 fi -SCRIPT_DIR="$(dirname "${BASH_SOURCE:-$0}")" - -CURRENT_DIR="$(readlink -f "${SCRIPT_DIR}/../../")" -if [[ -z "${CHROME_SRC}" ]]; then - # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. - export CHROME_SRC="${CURRENT_DIR}" -fi - -if [[ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]]; then - # If current directory is not in $CHROME_SRC, it might be set for other - # source tree. If $CHROME_SRC was set correctly and we are in the correct - # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "". - # Otherwise, it will equal to "${CURRENT_DIR}" - echo "Warning: Current directory is out of CHROME_SRC, it may not be \ -the one you want." - echo "${CHROME_SRC}" -fi - -# Allow the caller to override a few environment variables. If any of them is -# unset, we default to a sane value that's known to work. This allows for -# experimentation with a custom SDK. -if [[ -z "${ANDROID_SDK_ROOT}" || ! -d "${ANDROID_SDK_ROOT}" ]]; then - export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" -fi - -# Add Android SDK tools to system path. -export PATH=$PATH:${ANDROID_SDK_ROOT}/tools -export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools - -# Add Chromium Android development scripts to system path. -# Must be after CHROME_SRC is set. -export PATH=$PATH:${CHROME_SRC}/build/android +# This only exists to set local variables. Don't call this manually. +android_envsetup_main() { + local SCRIPT_DIR="$(dirname "${BASH_SOURCE:-$0}")" + + local CURRENT_DIR="$(readlink -f "${SCRIPT_DIR}/../../")" + if [[ -z "${CHROME_SRC}" ]]; then + # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. + local CHROME_SRC="${CURRENT_DIR}" + fi + + if [[ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]]; then + # If current directory is not in $CHROME_SRC, it might be set for other + # source tree. If $CHROME_SRC was set correctly and we are in the correct + # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "". + # Otherwise, it will equal to "${CURRENT_DIR}" + echo "Warning: Current directory is out of CHROME_SRC, it may not be \ + the one you want." + echo "${CHROME_SRC}" + fi + + # Allow the caller to override a few environment variables. If any of them is + # unset, we default to a sane value that's known to work. This allows for + # experimentation with a custom SDK. + if [[ -z "${ANDROID_SDK_ROOT}" || ! -d "${ANDROID_SDK_ROOT}" ]]; then + export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" + fi + + # Add Android SDK tools to system path. + export PATH=$PATH:${ANDROID_SDK_ROOT}/tools + export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools + + # Add Chromium Android development scripts to system path. + # Must be after CHROME_SRC is set. + export PATH=$PATH:${CHROME_SRC}/build/android +} +android_envsetup_main android_gyp() { echo "Please call build/gyp_chromium instead. android_gyp is going away." |