diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2018-06-28 16:22:15 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2018-07-02 13:25:44 +0200 |
commit | 65122b10d3d303ec44c5182d48fecea483ce9b5e (patch) | |
tree | 0ba4c3adf035c70582ba7329d54733fbbd1edbb1 /python/servo/bootstrap_commands.py | |
parent | aa1c3cea2fbf8c0907bda54ac4183d7fc878b33e (diff) | |
download | servo-65122b10d3d303ec44c5182d48fecea483ce9b5e.tar.gz servo-65122b10d3d303ec44c5182d48fecea483ce9b5e.zip |
bootstrap-android: always run sdkmanager
It is quick when already up to date
Diffstat (limited to 'python/servo/bootstrap_commands.py')
-rw-r--r-- | python/servo/bootstrap_commands.py | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index da887830a98..2e7791d00c1 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -108,46 +108,45 @@ class MachCommands(CommandBase): ndk_path = download(ndk.format(system=system, arch=arch), "ndk", flatten=True) tools_path = download(tools.format(system=system), "sdk") - if update or not path.isdir(path.join(tools_path, "platform-tools")): - subprocess.check_call([ - path.join(tools_path, "tools", "bin", "sdkmanager"), - "platform-tools", - "build-tools;" + sdk_build_tools, - "emulator", - ] + [ - arg - for avd_name, api_level, system_image in emulator_images - for arg in [ - "platforms;android-" + api_level, - "system-images;android-%s;%s" % (api_level, system_image), - ] + subprocess.check_call([ + path.join(tools_path, "tools", "bin", "sdkmanager"), + "platform-tools", + "build-tools;" + sdk_build_tools, + "emulator", + ] + [ + arg + for avd_name, api_level, system_image in emulator_images + for arg in [ + "platforms;android-" + api_level, + "system-images;android-%s;%s" % (api_level, system_image), + ] + ]) + for avd_name, api_level, system_image in emulator_images: + process = subprocess.Popen(stdin=subprocess.PIPE, stdout=subprocess.PIPE, args=[ + path.join(tools_path, "tools", "bin", "avdmanager"), + "create", "avd", + "--path", path.join(toolchains, "avd", avd_name), + "--name", avd_name, + "--package", "system-images;android-%s;%s" % (api_level, system_image), + "--force", ]) - for avd_name, api_level, system_image in emulator_images: - process = subprocess.Popen(stdin=subprocess.PIPE, stdout=subprocess.PIPE, args=[ - path.join(tools_path, "tools", "bin", "avdmanager"), - "create", "avd", - "--path", path.join(toolchains, "avd", avd_name), - "--name", avd_name, - "--package", "system-images;android-%s;%s" % (api_level, system_image), - "--force", - ]) - output = b"" - while 1: - # Read one byte at a time because in Python: - # * readline() blocks until "\n", which doesn't come before the prompt - # * read() blocks until EOF, which doesn't come before the prompt - # * read(n) keeps reading until it gets n bytes or EOF, - # but we don't know reliably how many bytes to read until the prompt - byte = process.stdout.read(1) - if len(byte) == 0: - break - output += byte - # There seems to be no way to disable this prompt: - if output.endswith(b"Do you wish to create a custom hardware profile? [no]"): - process.stdin.write("no\n") - assert process.wait() == 0 - with open(path.join(toolchains, "avd", avd_name, "config.ini"), "a") as f: - f.write("disk.dataPartition.size=1G\n") + output = b"" + while 1: + # Read one byte at a time because in Python: + # * readline() blocks until "\n", which doesn't come before the prompt + # * read() blocks until EOF, which doesn't come before the prompt + # * read(n) keeps reading until it gets n bytes or EOF, + # but we don't know reliably how many bytes to read until the prompt + byte = process.stdout.read(1) + if len(byte) == 0: + break + output += byte + # There seems to be no way to disable this prompt: + if output.endswith(b"Do you wish to create a custom hardware profile? [no]"): + process.stdin.write("no\n") + assert process.wait() == 0 + with open(path.join(toolchains, "avd", avd_name, "config.ini"), "a") as f: + f.write("disk.dataPartition.size=1G\n") print("") print("export ANDROID_SDK=\"%s\"" % tools_path) |