Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: build/android/envsetup.sh

Issue 222933004: android envsetup: Stop exporting CHROME_SRC, CURRENT_DIR (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: diff Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Sets up environment for building Chromium on Android. 6 # Sets up environment for building Chromium on Android.
7 7
8 # Make sure we're being sourced (possibly by another script). Check for bash 8 # Make sure we're being sourced (possibly by another script). Check for bash
9 # since zsh sets $0 when sourcing. 9 # since zsh sets $0 when sourcing.
10 if [[ -n "$BASH_VERSION" && "${BASH_SOURCE:-$0}" == "$0" ]]; then 10 if [[ -n "$BASH_VERSION" && "${BASH_SOURCE:-$0}" == "$0" ]]; then
11 echo "ERROR: envsetup must be sourced." 11 echo "ERROR: envsetup must be sourced."
12 exit 1 12 exit 1
13 fi 13 fi
14 14
15 SCRIPT_DIR="$(dirname "${BASH_SOURCE:-$0}")" 15 # This only exists to set local variables. Don't call this manually.
16 android_envsetup_main() {
17 local SCRIPT_DIR="$(dirname "${BASH_SOURCE:-$0}")"
16 18
17 CURRENT_DIR="$(readlink -f "${SCRIPT_DIR}/../../")" 19 local CURRENT_DIR="$(readlink -f "${SCRIPT_DIR}/../../")"
18 if [[ -z "${CHROME_SRC}" ]]; then 20 if [[ -z "${CHROME_SRC}" ]]; then
19 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. 21 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC.
20 export CHROME_SRC="${CURRENT_DIR}" 22 local CHROME_SRC="${CURRENT_DIR}"
21 fi 23 fi
22 24
23 if [[ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]]; then 25 if [[ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]]; then
24 # If current directory is not in $CHROME_SRC, it might be set for other 26 # If current directory is not in $CHROME_SRC, it might be set for other
25 # source tree. If $CHROME_SRC was set correctly and we are in the correct 27 # source tree. If $CHROME_SRC was set correctly and we are in the correct
26 # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "". 28 # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "".
27 # Otherwise, it will equal to "${CURRENT_DIR}" 29 # Otherwise, it will equal to "${CURRENT_DIR}"
28 echo "Warning: Current directory is out of CHROME_SRC, it may not be \ 30 echo "Warning: Current directory is out of CHROME_SRC, it may not be \
29 the one you want." 31 the one you want."
30 echo "${CHROME_SRC}" 32 echo "${CHROME_SRC}"
31 fi 33 fi
32 34
33 # Allow the caller to override a few environment variables. If any of them is 35 # Allow the caller to override a few environment variables. If any of them is
34 # unset, we default to a sane value that's known to work. This allows for 36 # unset, we default to a sane value that's known to work. This allows for
35 # experimentation with a custom SDK. 37 # experimentation with a custom SDK.
36 if [[ -z "${ANDROID_SDK_ROOT}" || ! -d "${ANDROID_SDK_ROOT}" ]]; then 38 if [[ -z "${ANDROID_SDK_ROOT}" || ! -d "${ANDROID_SDK_ROOT}" ]]; then
37 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" 39 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/"
38 fi 40 fi
39 41
40 # Add Android SDK tools to system path. 42 # Add Android SDK tools to system path.
41 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools 43 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools
42 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools 44 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools
43 45
44 # Add Chromium Android development scripts to system path. 46 # Add Chromium Android development scripts to system path.
45 # Must be after CHROME_SRC is set. 47 # Must be after CHROME_SRC is set.
46 export PATH=$PATH:${CHROME_SRC}/build/android 48 export PATH=$PATH:${CHROME_SRC}/build/android
49 }
50 android_envsetup_main
47 51
48 android_gyp() { 52 android_gyp() {
49 echo "Please call build/gyp_chromium instead. android_gyp is going away." 53 echo "Please call build/gyp_chromium instead. android_gyp is going away."
50 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" 54 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@"
51 } 55 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698