diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index b9d2a90ad79..2aa70862fd6 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -30,7 +30,7 @@ from mach.decorators import ( from mach.registrar import Registrar from mach_bootstrap import _get_exec_path -from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env, gstreamer_root +from servo.command_base import CommandBase, cd, call, check_call, append_to_path_env, gstreamer_root from servo.util import host_triple @@ -237,14 +237,6 @@ class MachCommands(CommandBase): if very_verbose: opts += ["-vv"] - if target: - if self.config["tools"]["use-rustup"] and not uwp: - # 'rustup target add' fails if the toolchain is not installed at all. - self.call_rustup_run(["rustc", "--version"]) - - check_call(["rustup" + BIN_SUFFIX, "target", "add", - "--toolchain", self.rust_toolchain(), target]) - env = self.build_env(target=target, is_build=True, uwp=uwp, features=features) self.ensure_bootstrapped(target=target) self.ensure_clobbered() diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 43e993f0907..e1edecd957a 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -1016,6 +1016,15 @@ install them, let us know by filing a bug!") if "msvc" in target_platform: Registrar.dispatch("bootstrap", context=self.context) + if target: + if self.config["tools"]["use-rustup"] and not "uwp" in target: + # 'rustup target add' fails if the toolchain is not installed at all. + self.call_rustup_run(["rustc", "--version"]) + + check_call(["rustup" + BIN_SUFFIX, "target", "add", + "--toolchain", self.rust_toolchain(), target]) + + self.context.bootstrapped = True def ensure_clobbered(self, target_dir=None): diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index 45a3f946f38..658ef547f21 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -49,7 +49,7 @@ class MachCommands(CommandBase): features += self.pick_media_stack(media_stack, target) - self.ensure_bootstrapped() + self.ensure_bootstrapped(target=target) self.ensure_clobbered() env = self.build_env() diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index 18b43a1afe0..941999fdc0b 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -241,13 +241,13 @@ class PostBuildCommands(CommandBase): @CommandBase.build_like_command_arguments def doc(self, params, features, target=None, android=False, magicleap=False, media_stack=None, **kwargs): + self.ensure_bootstrapped() rustc_path = check_output( ["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"]) assert path.basename(path.dirname(rustc_path)) == "bin" toolchain_path = path.dirname(path.dirname(rustc_path)) rust_docs = path.join(toolchain_path, "share", "doc", "rust", "html") - self.ensure_bootstrapped() docs = path.join(self.get_target_dir(), "doc") if not path.exists(docs): os.makedirs(docs)