diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 7f0be395d731..7382668ce57e 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -27,7 +27,7 @@ ) import servo.bootstrap as bootstrap -from servo.command_base import CommandBase, BIN_SUFFIX, cd +from servo.command_base import CommandBase, BIN_SUFFIX, cd, has_rustc_alt_build from servo.util import delete, download_bytes, download_file, extract, host_triple @@ -67,6 +67,9 @@ def bootstrap(self, force=False): action='store_true', help='Use stable rustc version') def bootstrap_rustc(self, force=False, target=[], stable=False): + # Set default value for llvm-assertions when target platform is specified + if "SERVO_RUSTC_LLVM_ASSERTIONS" not in os.environ and target: + self.config["build"]["llvm-assertions"] = not has_rustc_alt_build(target) self.set_use_stable_rust(stable) version = self.rust_version() rust_path = self.rust_path() diff --git a/python/servo/command_base.py b/python/servo/command_base.py index e8bad0a742f6..af723f8988f5 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -201,6 +201,14 @@ def set_osmesa_env(bin_path, env): return env +def has_rustc_alt_build(platform_or_triple): + platforms_with_rustc_alt_builds = ["unknown-linux-gnu", "apple-darwin", "pc-windows-msvc"] + for platform in platforms_with_rustc_alt_builds: + if platform in platform_or_triple: + return True + return False + + class BuildNotFound(Exception): def __init__(self, message): self.message = message @@ -261,9 +269,8 @@ def resolverelative(category, key): self.config["tools"].setdefault("rustc-with-gold", get_env_bool("SERVO_RUSTC_WITH_GOLD", True)) # https://github.com/rust-lang/rust/pull/39754 - platforms_with_rustc_alt_builds = ["unknown-linux-gnu", "apple-darwin", "pc-windows-msvc"] llvm_assertions_default = ("SERVO_RUSTC_LLVM_ASSERTIONS" in os.environ - or host_platform() not in platforms_with_rustc_alt_builds) + or not has_rustc_alt_build(host_platform())) self.config.setdefault("build", {}) self.config["build"].setdefault("android", False)