From 365a139716436bed8e6a178f4539e4a3d31099c4 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 27 Nov 2017 18:02:53 +0100 Subject: Use rustup.rs instead of custom bootstrap Fixes #11361, closes #18874 --- python/servo/build_commands.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'python/servo/build_commands.py') diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 28451aac2cc..22e716a29a1 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -233,6 +233,13 @@ class MachCommands(CommandBase): target = self.config["android"]["target"] if target: + if self.config["tools"]["use-rustup"]: + # '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.toolchain(), target]) + opts += ["--target", target] if not android: android = self.handle_android_target(target) @@ -340,10 +347,7 @@ class MachCommands(CommandBase): os.makedirs(aar_out_dir) env["AAR_OUT_DIR"] = aar_out_dir - cargo_binary = "cargo" + BIN_SUFFIX - - status = call( - [cargo_binary, "build"] + opts, env=env, verbose=verbose) + status = self.call_rustup_run(["cargo", "build"] + opts, env=env, verbose=verbose) elapsed = time() - build_start # Do some additional things if the build succeeded @@ -430,9 +434,9 @@ class MachCommands(CommandBase): # Unlike RUSTFLAGS, these are only passed in the final rustc invocation # so that `./mach build` followed by `./mach build-cef` both build # common dependencies with the same flags. - opts += ["--", "-C", "link-args=-Xlinker -undefined -Xlinker dynamic_lookup"] + opts += ["--", "-Clink-args=-Xlinker -undefined -Xlinker dynamic_lookup"] - ret = call(["cargo", "rustc"] + opts, env=env, verbose=verbose) + ret = self.call_rustup_run(["cargo", "rustc"] + opts, env=env, verbose=verbose) elapsed = time() - build_start # Generate Desktop Notification if elapsed-time > some threshold value @@ -455,7 +459,7 @@ class MachCommands(CommandBase): action='store_true', help='Build in release mode') def build_geckolib(self, jobs=None, verbose=False, release=False): - self.set_use_stable_rust() + self.set_use_geckolib_toolchain() self.ensure_bootstrapped() self.ensure_clobbered() @@ -475,7 +479,7 @@ class MachCommands(CommandBase): opts += ["--features", ' '.join(features)] build_start = time() - ret = call(["cargo", "build"] + opts, env=env, verbose=verbose) + ret = self.call_rustup_run(["cargo", "build"] + opts, env=env, verbose=verbose) elapsed = time() - build_start # Generate Desktop Notification if elapsed-time > some threshold value -- cgit v1.2.3