mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
bootstrap-android: use predictable paths for SDK and NDK
… independent of the version number
This commit is contained in:
parent
0e2e9cb019
commit
aa1c3cea2f
1 changed files with 14 additions and 10 deletions
|
@ -77,8 +77,8 @@ class MachCommands(CommandBase):
|
||||||
if not path.isdir(toolchains):
|
if not path.isdir(toolchains):
|
||||||
os.makedirs(toolchains)
|
os.makedirs(toolchains)
|
||||||
|
|
||||||
def download(name):
|
def download(name, target_dir, flatten=False):
|
||||||
final = path.join(toolchains, name)
|
final = path.join(toolchains, target_dir)
|
||||||
if path.isdir(final):
|
if path.isdir(final):
|
||||||
return final
|
return final
|
||||||
|
|
||||||
|
@ -90,15 +90,23 @@ class MachCommands(CommandBase):
|
||||||
if not path.isfile(archive):
|
if not path.isfile(archive):
|
||||||
download_file(filename, url, archive)
|
download_file(filename, url, archive)
|
||||||
print("Extracting " + filename)
|
print("Extracting " + filename)
|
||||||
remove = True # Set to False to avoid repeated downloads while debugging this script
|
remove = False # Set to False to avoid repeated downloads while debugging this script
|
||||||
|
if flatten:
|
||||||
|
extracted = final + "_"
|
||||||
|
extract(archive, extracted, remove=remove)
|
||||||
|
contents = os.listdir(extracted)
|
||||||
|
assert len(contents) == 1
|
||||||
|
os.rename(path.join(extracted, contents[0]), final)
|
||||||
|
os.rmdir(extracted)
|
||||||
|
else:
|
||||||
extract(archive, final, remove=remove)
|
extract(archive, final, remove=remove)
|
||||||
return final
|
return final
|
||||||
|
|
||||||
system = platform.system().lower()
|
system = platform.system().lower()
|
||||||
machine = platform.machine().lower()
|
machine = platform.machine().lower()
|
||||||
arch = {"i386": "x86"}.get(machine, machine)
|
arch = {"i386": "x86"}.get(machine, machine)
|
||||||
ndk_path = download(ndk.format(system=system, arch=arch))
|
ndk_path = download(ndk.format(system=system, arch=arch), "ndk", flatten=True)
|
||||||
tools_path = download(tools.format(system=system))
|
tools_path = download(tools.format(system=system), "sdk")
|
||||||
|
|
||||||
if update or not path.isdir(path.join(tools_path, "platform-tools")):
|
if update or not path.isdir(path.join(tools_path, "platform-tools")):
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
|
@ -141,10 +149,6 @@ class MachCommands(CommandBase):
|
||||||
with open(path.join(toolchains, "avd", avd_name, "config.ini"), "a") as f:
|
with open(path.join(toolchains, "avd", avd_name, "config.ini"), "a") as f:
|
||||||
f.write("disk.dataPartition.size=1G\n")
|
f.write("disk.dataPartition.size=1G\n")
|
||||||
|
|
||||||
contents = os.listdir(ndk_path)
|
|
||||||
assert len(contents) == 1
|
|
||||||
ndk_path = path.join(ndk_path, contents[0])
|
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
print("export ANDROID_SDK=\"%s\"" % tools_path)
|
print("export ANDROID_SDK=\"%s\"" % tools_path)
|
||||||
print("export ANDROID_NDK=\"%s\"" % ndk_path)
|
print("export ANDROID_NDK=\"%s\"" % ndk_path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue