android: Use a separate SDK for the emulator again.
Although sharing the SDK with the one downloaded into src/third_party/android_tools allowed us to avoid having to keep another 660MB SDK around, there were several downsides: o It downloaded ARMv7 and x86 system images into the git repository in src/third_party/android_tools, potentially confusing users who did not have the new directories in their .gitignore. o Messages in avd.py and usage of the emulator could lead users to update the SDK checked into android_tools/, causing build problems and a lot of confusion. o The ARMv7 and x86 system images could end up being out of sync with the SDK in android_tools/. o The SDK in android_tools/ might be older than the one we used to download separately. The new solution is to revert large parts of r222121 and r223003 but not completely: instead of downloading the SDK into a directory that is two levels above the top-level src/ (there is no guarantee it is writable, for example), the emulator SDK is now downloaded into src/android_emulator_sdk/, which has also been added to .gitignore to avoid confusion. Additionally, we build upon r222612 and install a newer version of the SDK that works with version 18 of the Android API. R=peter@chromium.org,navabi@chromium.org,bulach@chromium.org BUG=304129 Review URL: https://codereview.chromium.org/25675010 git-svn-id: http://src.chromium.org/svn/trunk/src/build@227121 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
eafc6b6a19
Коммит
b54edcc69d
|
@ -23,8 +23,7 @@ from pylib.utils import emulator
|
|||
def main(argv):
|
||||
# ANDROID_SDK_ROOT needs to be set to the location of the SDK used to launch
|
||||
# the emulator to find the system images upon launch.
|
||||
emulator_sdk = os.path.join(constants.EMULATOR_SDK_ROOT,
|
||||
'android_tools', 'sdk')
|
||||
emulator_sdk = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk')
|
||||
os.environ['ANDROID_SDK_ROOT'] = emulator_sdk
|
||||
|
||||
opt_parser = optparse.OptionParser(description='AVD script.')
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
"""Installs deps for using SDK emulator for testing.
|
||||
|
||||
The script will download system images, if they are not present, and
|
||||
The script will download the SDK and system images, if they are not present, and
|
||||
install and enable KVM, if virtualization has been enabled in the BIOS.
|
||||
"""
|
||||
|
||||
|
@ -19,8 +19,9 @@ from pylib import cmd_helper
|
|||
from pylib import constants
|
||||
from pylib.utils import run_tests_helper
|
||||
|
||||
# Android ARMv7 system image for the SDK.
|
||||
ARMV7_IMG_URL = 'https://dl-ssl.google.com/android/repository/sysimg_armv7a-18_r01.zip'
|
||||
# From the Android Developer's website.
|
||||
SDK_BASE_URL = 'http://dl.google.com/android/adt'
|
||||
SDK_ZIP = 'adt-bundle-linux-x86_64-20130729.zip'
|
||||
|
||||
# Android x86 system image from the Intel website:
|
||||
# http://software.intel.com/en-us/articles/intel-eula-x86-android-4-2-jelly-bean-bin
|
||||
|
@ -34,32 +35,19 @@ def CheckSDK():
|
|||
"""Check if SDK is already installed.
|
||||
|
||||
Returns:
|
||||
True if android_tools directory exists in current directory.
|
||||
True if the emulator SDK directory (src/android_emulator_sdk/) exists.
|
||||
"""
|
||||
return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT,
|
||||
'android_tools'))
|
||||
|
||||
|
||||
def CheckARMv7Image():
|
||||
"""Check if the ARMv7 system images have been installed.
|
||||
|
||||
Returns:
|
||||
True if the armeabi-v7a directory is present inside the Android SDK
|
||||
checkout directory.
|
||||
"""
|
||||
return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT,
|
||||
'android_tools', 'sdk', 'system-images',
|
||||
API_TARGET, 'armeabi-v7a'))
|
||||
return os.path.exists(constants.EMULATOR_SDK_ROOT)
|
||||
|
||||
|
||||
def CheckX86Image():
|
||||
"""Check if Android system images have been installed.
|
||||
|
||||
Returns:
|
||||
True if android_tools/sdk/system-images directory exists.
|
||||
True if sdk/system-images/<API TARGET>/x86 exists inside EMULATOR_SDK_ROOT.
|
||||
"""
|
||||
return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT,
|
||||
'android_tools', 'sdk', 'system-images',
|
||||
'sdk', 'system-images',
|
||||
API_TARGET, 'x86'))
|
||||
|
||||
|
||||
|
@ -76,6 +64,25 @@ def CheckKVM():
|
|||
return False
|
||||
|
||||
|
||||
def GetSDK():
|
||||
"""Download the SDK and unzip it into EMULATOR_SDK_ROOT."""
|
||||
logging.info('Download Android SDK.')
|
||||
sdk_url = '%s/%s' % (SDK_BASE_URL, SDK_ZIP)
|
||||
try:
|
||||
cmd_helper.RunCmd(['curl', '-o', '/tmp/sdk.zip', sdk_url])
|
||||
print 'curled unzipping...'
|
||||
rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/sdk.zip', '-d', '/tmp/'])
|
||||
if rc:
|
||||
raise Exception('ERROR: could not download/unzip Android SDK.')
|
||||
# Get the name of the sub-directory that everything will be extracted to.
|
||||
dirname, _ = os.path.splitext(SDK_ZIP)
|
||||
zip_dir = '/tmp/%s' % dirname
|
||||
# Move the extracted directory to EMULATOR_SDK_ROOT
|
||||
shutil.move(zip_dir, constants.EMULATOR_SDK_ROOT)
|
||||
finally:
|
||||
os.unlink('/tmp/sdk.zip')
|
||||
|
||||
|
||||
def InstallKVM():
|
||||
"""Installs KVM packages."""
|
||||
rc = cmd_helper.RunCmd(['sudo', 'apt-get', 'install', 'kvm'])
|
||||
|
@ -96,21 +103,6 @@ def InstallKVM():
|
|||
'AMD SVM).')
|
||||
|
||||
|
||||
def GetARMv7Image():
|
||||
"""Download and install the ARMv7 system image."""
|
||||
logging.info('Download ARMv7 system image directory into sdk directory.')
|
||||
try:
|
||||
cmd_helper.RunCmd(['curl', '-o', '/tmp/armv7_img.zip', ARMV7_IMG_URL])
|
||||
rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/armv7_img.zip', '-d', '/tmp/'])
|
||||
if rc:
|
||||
raise Exception('ERROR: Could not download/unzip image zip.')
|
||||
sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk',
|
||||
'system-images', API_TARGET, 'armeabi-v7a')
|
||||
shutil.move('/tmp/armeabi-v7a', sys_imgs)
|
||||
finally:
|
||||
os.unlink('/tmp/armv7_img.zip')
|
||||
|
||||
|
||||
def GetX86Image():
|
||||
"""Download x86 system image from Intel's website."""
|
||||
logging.info('Download x86 system image directory into sdk directory.')
|
||||
|
@ -119,7 +111,7 @@ def GetX86Image():
|
|||
rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/x86_img.zip', '-d', '/tmp/'])
|
||||
if rc:
|
||||
raise Exception('ERROR: Could not download/unzip image zip.')
|
||||
sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk',
|
||||
sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk',
|
||||
'system-images', API_TARGET, 'x86')
|
||||
shutil.move('/tmp/x86', sys_imgs)
|
||||
finally:
|
||||
|
@ -131,22 +123,15 @@ def main(argv):
|
|||
format='# %(asctime)-15s: %(message)s')
|
||||
run_tests_helper.SetLogLevel(verbose_count=1)
|
||||
|
||||
if not CheckSDK():
|
||||
logging.critical(
|
||||
'ERROR: android_tools does not exist. Make sure your .gclient file '
|
||||
'contains the right \'target_os\' entry. See '
|
||||
'https://code.google.com/p/chromium/wiki/AndroidBuildInstructions for '
|
||||
'more information.')
|
||||
return 1
|
||||
|
||||
# Download system images only if needed.
|
||||
if CheckARMv7Image():
|
||||
logging.info('The ARMv7 image is already present.')
|
||||
# Calls below will download emulator SDK and/or system images only if needed.
|
||||
if CheckSDK():
|
||||
logging.info('android_emulator_sdk/ already exists, skipping download.')
|
||||
else:
|
||||
GetARMv7Image()
|
||||
GetSDK()
|
||||
|
||||
# Download the x86 system image only if needed.
|
||||
if CheckX86Image():
|
||||
logging.info('The x86 image is already present.')
|
||||
logging.info('The x86 image is already present, skipping download.')
|
||||
else:
|
||||
GetX86Image()
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ import sys
|
|||
DIR_SOURCE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||
os.pardir, os.pardir, os.pardir))
|
||||
ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir')
|
||||
EMULATOR_SDK_ROOT = os.path.abspath(os.path.join(DIR_SOURCE_ROOT, os.pardir,
|
||||
os.pardir))
|
||||
|
||||
CHROMIUM_TEST_SHELL_HOST_DRIVEN_DIR = os.path.join(
|
||||
DIR_SOURCE_ROOT, 'chrome', 'android')
|
||||
|
@ -120,6 +118,8 @@ ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT,
|
|||
ANDROID_NDK_ROOT = os.path.join(DIR_SOURCE_ROOT,
|
||||
'third_party/android_tools/ndk')
|
||||
|
||||
EMULATOR_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, 'android_emulator_sdk')
|
||||
|
||||
UPSTREAM_FLAKINESS_SERVER = 'test-results.appspot.com'
|
||||
|
||||
|
||||
|
|
|
@ -171,8 +171,7 @@ class Emulator(object):
|
|||
avd_name: name of the AVD to create
|
||||
abi: target platform for emulator being created
|
||||
"""
|
||||
android_sdk_root = os.path.join(constants.EMULATOR_SDK_ROOT,
|
||||
'android_tools', 'sdk')
|
||||
android_sdk_root = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk')
|
||||
self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator')
|
||||
self.android = os.path.join(android_sdk_root, 'tools', 'android')
|
||||
self.popen = None
|
||||
|
|
Загрузка…
Ссылка в новой задаче