diff options
Diffstat (limited to 'python/servo')
-rw-r--r-- | python/servo/bootstrap_commands.py | 22 | ||||
-rw-r--r-- | python/servo/build_commands.py | 4 | ||||
-rw-r--r-- | python/servo/command_base.py | 10 |
3 files changed, 18 insertions, 18 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 2e7791d00c1..7fa91825a02 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -77,10 +77,10 @@ class MachCommands(CommandBase): if not path.isdir(toolchains): os.makedirs(toolchains) - def download(name, target_dir, flatten=False): + def download(target_dir, name, flatten=False): final = path.join(toolchains, target_dir) if path.isdir(final): - return final + return base_url = "https://dl.google.com/android/repository/" filename = name + ".zip" @@ -100,16 +100,15 @@ class MachCommands(CommandBase): os.rmdir(extracted) else: extract(archive, final, remove=remove) - return final system = platform.system().lower() machine = platform.machine().lower() arch = {"i386": "x86"}.get(machine, machine) - ndk_path = download(ndk.format(system=system, arch=arch), "ndk", flatten=True) - tools_path = download(tools.format(system=system), "sdk") + download("ndk", ndk.format(system=system, arch=arch), flatten=True) + download("sdk", tools.format(system=system)) subprocess.check_call([ - path.join(tools_path, "tools", "bin", "sdkmanager"), + path.join(toolchains, "sdk", "tools", "bin", "sdkmanager"), "platform-tools", "build-tools;" + sdk_build_tools, "emulator", @@ -123,7 +122,7 @@ class MachCommands(CommandBase): ]) 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"), + path.join(toolchains, "sdk", "tools", "bin", "avdmanager"), "create", "avd", "--path", path.join(toolchains, "avd", avd_name), "--name", avd_name, @@ -148,15 +147,6 @@ class MachCommands(CommandBase): 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) - print("export ANDROID_NDK=\"%s\"" % ndk_path) - print("export PATH=\"%s:$PATH\"" % path.join(tools_path, "platform-tools")) - print("") - # https://developer.android.com/studio/run/emulator-acceleration#command-gpu - print(path.join(tools_path, "tools", "emulator") + - " @servo-armv7 -gpu swiftshader_indirect [ -no-window ]") - @Command('update-hsts-preload', description='Download the HSTS preload list', category='bootstrap') diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index d48730252b2..02d71eee8bd 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -260,10 +260,10 @@ class MachCommands(CommandBase): env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C debug_assertions" if android: - if "ANDROID_NDK" not in os.environ: + if "ANDROID_NDK" not in env: print("Please set the ANDROID_NDK environment variable.") sys.exit(1) - if "ANDROID_SDK" not in os.environ: + if "ANDROID_SDK" not in env: print("Please set the ANDROID_SDK environment variable.") sys.exit(1) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 8e7a9f4b2dc..70f19203ec6 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -525,6 +525,16 @@ class CommandBase(object): if self.config["android"]["platform"]: env["ANDROID_PLATFORM"] = self.config["android"]["platform"] + toolchains = path.join(self.context.topdir, "android-toolchains") + for kind in ["sdk", "ndk"]: + default = os.path.join(toolchains, kind) + if os.path.isdir(default): + env.setdefault("ANDROID_" + kind.upper(), default) + + tools = os.path.join(toolchains, "sdk", "platform-tools") + if os.path.isdir(tools): + env["PATH"] = "%s%s%s" % (tools, os.pathsep, env["PATH"]) + # These are set because they are the variable names that build-apk # expects. However, other submodules have makefiles that reference # the env var names above. Once glutin is enabled and set as the |