Add Android emulator support
Add prebuilts and scripts for the Android emulator
and all the required SDK harness.
Also introduces a run_android_emulator script that
sets up the necessary .avd files and starts the
emulator using the configuration files checked in
into //build/android_emulators.
In the next CLs this will be wired up to tests.
Change-Id: I56b7cecaaea48ab5f28682c2f341f443c04b134b
diff --git a/build/install-build-deps b/build/install-build-deps
index 5958ea7..69c7d53 100755
--- a/build/install-build-deps
+++ b/build/install-build-deps
@@ -23,7 +23,10 @@
import urllib
import zipfile
-PREBUILTS = (
+from collections import namedtuple
+
+# Dependencies required to build code on the host or when targeting desktop OS.
+BUILD_DEPS_HOST = [
# GN
('buildtools/mac/gn',
'https://storage.googleapis.com/chromium-gn/c2c934d4dda1f470a6511b1015dda9a9fb1ce50b',
@@ -48,6 +51,39 @@
'linux2'
),
+ # Keep in sync with Android's //external/googletest/README.version.
+ ('buildtools/googletest.zip',
+ 'https://github.com/google/googletest/archive/ff07a5de0e81580547f1685e101194ed1a4fcd56.zip',
+ 'c7edec7d7e6db1fc37a20710de9c4d89e3a3893b',
+ 'all'
+ ),
+
+ # Keep in sync with Android's //external/protobuf/README.version.
+ ('buildtools/protobuf.zip',
+ 'https://github.com/google/protobuf/releases/download/v3.0.0-beta-3/protobuf-cpp-3.0.0-beta-3.zip',
+ '3caec60aa9d8eefc8c3c3201b6b8ca19935edb89',
+ 'all'
+ ),
+
+ # libc++ and libc++abi, for clang msan that require rebuilding the C++ lib
+ # from sources. Keep the SHA1s in sync with Chrome's src/buildtools/DEPS.
+ ('buildtools/libcxx',
+ 'https://chromium.googlesource.com/chromium/llvm-project/libcxx.git',
+ '3a07dd740be63878167a0ea19fe81869954badd7',
+ 'all'
+ ),
+ ('buildtools/libcxxabi',
+ 'https://chromium.googlesource.com/chromium/llvm-project/libcxxabi.git',
+ '4072e8fd76febee37f60aeda76d6d9f5e3791daa',
+ 'all'
+ ),
+]
+
+# Dependencies required to build Android code.
+# URLs and SHA1s taken from:
+# - https://dl.google.com/android/repository/repository-11.xml
+# - https://dl.google.com/android/repository/sys-img/android/sys-img.xml
+BUILD_DEPS_ANDROID = [
# Android NDK
('buildtools/ndk.zip',
'https://dl.google.com/android/repository/android-ndk-r15c-darwin-x86_64.zip',
@@ -59,36 +95,46 @@
'0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2',
'linux2'
),
+]
- # Keep in sync with Android's //external/googletest/README.version .
- ('buildtools/googletest.zip',
- 'https://github.com/google/googletest/archive/ff07a5de0e81580547f1685e101194ed1a4fcd56.zip',
- 'c7edec7d7e6db1fc37a20710de9c4d89e3a3893b',
- 'all'
+# Dependencies required to run Android tests.
+TEST_DEPS_ANDROID = [
+ # tools.zip contains the emulator binaries.
+ ('buildtools/android_sdk/tools.zip',
+ 'https://dl.google.com/android/repository/tools_r25.2.5-macosx.zip',
+ 'd2168d963ac5b616e3d3ddaf21511d084baf3659',
+ 'darwin'
+ ),
+ ('buildtools/android_sdk/tools.zip',
+ 'https://dl.google.com/android/repository/tools_r25.2.5-linux.zip',
+ '72df3aa1988c0a9003ccdfd7a13a7b8bd0f47fc1',
+ 'linux2'
),
- # Keep in sync with Android's //external/protobuf/README.version .
- ('buildtools/protobuf.zip',
- 'https://github.com/google/protobuf/releases/download/v3.0.0-beta-3/protobuf-cpp-3.0.0-beta-3.zip',
- '3caec60aa9d8eefc8c3c3201b6b8ca19935edb89',
- 'all'
+ # platform-tools.zip contains adb binaries.
+ ('buildtools/android_sdk/platform-tools.zip',
+ 'https://dl.google.com/android/repository/platform-tools_r26.0.0-darwin.zip',
+ 'e75b6137dc444f777eb02f44a6d9819b3aabff82',
+ 'darwin'
+ ),
+ ('buildtools/android_sdk/platform-tools.zip',
+ 'https://dl.google.com/android/repository/platform-tools_r26.0.0-linux.zip',
+ '00de8a6631405b617c10f68cd11ff2e1cd528e23',
+ 'linux2'
),
- # libc++ and libc++abi, for clang msan that require rebuilding the C++ lib
- # from sources. Keep the SHA1s in sync with Chrome's src/buildtools/DEPS .
- ('buildtools/libcxx',
- 'https://chromium.googlesource.com/chromium/llvm-project/libcxx.git',
- '3a07dd740be63878167a0ea19fe81869954badd7',
+ # Android emulator images.
+ ('buildtools/android_sdk/system-images/android-24/default/armeabi-v7a.zip',
+ 'https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-24_r07.zip',
+ '3454546b4eed2d6c3dd06d47757d6da9f4176033',
'all'
),
- ('buildtools/libcxxabi',
- 'https://chromium.googlesource.com/chromium/llvm-project/libcxxabi.git',
- '4072e8fd76febee37f60aeda76d6d9f5e3791daa',
+ ('buildtools/android_sdk/system-images/android-24/default/arm64-v8a.zip',
+ 'https://dl.google.com/android/repository/sys-img/android/arm64-v8a-24_r07.zip',
+ 'e8ab2e49e4efe4b064232b33b5eeaded61437d7f',
'all'
),
-
-
-)
+]
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -143,15 +189,14 @@
def Main():
parser = argparse.ArgumentParser()
- parser.add_argument('--skip', action='append', default=[])
+ parser.add_argument('--no-android', action='store_true')
args = parser.parse_args()
- skip_set = set(args.skip)
- for rel_path, url, expected_sha1, platform in PREBUILTS:
+ deps = BUILD_DEPS_HOST
+ if not args.no_android:
+ deps += BUILD_DEPS_ANDROID + TEST_DEPS_ANDROID
+ for rel_path, url, expected_sha1, platform in deps:
if platform != 'all' and platform != sys.platform:
continue
- if os.path.basename(rel_path) in skip_set:
- logging.info('Skipping %s because of --skip cmdline arg', rel_path)
- continue
local_path = os.path.join(ROOT_DIR, rel_path)
if url.endswith('.git'):
CheckoutGitRepo(local_path, url, expected_sha1)