blob: 315db296a7ab44217b8ef8f7dad50bb202511432 [file] [log] [blame]
[email protected]b0be3f12013-02-16 11:33:111#!/bin/bash
Avi Drissman73a09d12022-09-08 20:33:382# Copyright 2012 The Chromium Authors
[email protected]ec5dcded2011-09-26 21:40:383# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Nico Weber24dfd302017-07-20 19:03:086# Adds Android SDK tools and related helpers to PATH, useful for development.
Andrew Grieveb747e712017-11-23 16:58:317# Not used on bots, nor required for any commands to succeed.
8# Use like: source build/android/envsetup.sh
[email protected]ec5dcded2011-09-26 21:40:389
Nico Weber24dfd302017-07-20 19:03:0810# Make sure we're being sourced.
[email protected]5ae15032013-10-23 03:43:2511if [[ -n "$BASH_VERSION" && "${BASH_SOURCE:-$0}" == "$0" ]]; then
12 echo "ERROR: envsetup must be sourced."
13 exit 1
14fi
[email protected]b0be3f12013-02-16 11:33:1115
[email protected]d9584322014-04-08 03:53:5116# This only exists to set local variables. Don't call this manually.
17android_envsetup_main() {
[email protected]94370ac2014-06-13 05:15:4818 local SCRIPT_PATH="$1"
19 local SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
Nico Weber6585ea32017-07-20 18:00:5520 local CHROME_SRC="$(readlink -f "${SCRIPT_DIR}/../../")"
[email protected]cf323802014-02-20 18:44:0621
Nate Fischer709672042019-06-26 03:37:4722 # Some tools expect these environmental variables.
23 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_sdk/public"
24 # ANDROID_HOME is deprecated, but generally means the same thing as
25 # ANDROID_SDK_ROOT and shouldn't hurt to set it.
26 export ANDROID_HOME="$ANDROID_SDK_ROOT"
27
28 # Set up PATH to point to SDK-provided (and other) tools, such as 'adb'.
Carlos Knippschilddedee28f2020-04-28 22:37:5029 export PATH=${CHROME_SRC}/build/android:$PATH
30 export PATH=${ANDROID_SDK_ROOT}/tools/:$PATH
31 export PATH=${ANDROID_SDK_ROOT}/platform-tools:$PATH
[email protected]d9584322014-04-08 03:53:5132}
[email protected]94370ac2014-06-13 05:15:4833# In zsh, $0 is the name of the file being sourced.
34android_envsetup_main "${BASH_SOURCE:-$0}"
35unset -f android_envsetup_main