Update mozangle, cc, and cmake

This also moves some environment variable configuration to the shared
`build_env()` method, because previously clang was only being chosen for
running `./mach build` and not `./mach test-unit` which was leading to
rebuilds and thus build failures when running `test-unit`. I guess the
cmake crate does not expect the compiler to change between subsequent
runs.
This commit is contained in:
Martin Robinson 2023-06-29 12:45:45 +02:00
parent a725380db0
commit ddc7994673
No known key found for this signature in database
GPG key ID: D56AA4FA55EFE6F8
4 changed files with 25 additions and 18 deletions

View file

@ -118,7 +118,6 @@ class MachCommands(CommandBase):
self.ensure_clobbered()
build_start = time()
env["CARGO_TARGET_DIR"] = target_path
host = servo.platform.host_triple()
target_triple = self.cross_compile_target or servo.platform.host_triple()
@ -401,10 +400,6 @@ class MachCommands(CommandBase):
for key in env:
print((key, env[key]))
if sys.platform != "win32":
env.setdefault("CC", "clang")
env.setdefault("CXX", "clang++")
status = self.run_cargo_build_like_command(
"build", opts, env=env, verbose=verbose,
libsimpleservo=libsimpleservo, **kwargs

View file

@ -496,7 +496,7 @@ class CommandBase(object):
'vcdir': vcinstalldir,
}
def build_env(self, is_build=False, test_unit=False):
def build_env(self, is_build=False):
"""Return an extended environment dictionary."""
env = os.environ.copy()
@ -557,6 +557,10 @@ class CommandBase(object):
# Always build harfbuzz from source
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
if sys.platform != "win32":
env.setdefault("CC", "clang")
env.setdefault("CXX", "clang++")
if extra_path:
util.append_paths_to_env(env, "PATH", extra_path)
@ -597,11 +601,6 @@ class CommandBase(object):
if "ANDROID_TOOLCHAIN" in env:
env["NDK_STANDALONE"] = env["ANDROID_TOOLCHAIN"]
if test_unit and "msvc" in servo.platform.host_triple():
# on MSVC, we need some DLLs in the path. They were copied
# in to the servo.exe build dir, so just point PATH to that.
util.prepend_paths_to_env(env, "PATH", path.dirname(self.get_binary_path(False, False)))
if self.config["build"]["rustflags"]:
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " " + self.config["build"]["rustflags"]
@ -619,6 +618,7 @@ class CommandBase(object):
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C target-feature=+neon"
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates"
env["CARGO_TARGET_DIR"] = servo.util.get_target_dir()
git_info = []
if os.path.isdir('.git') and is_build:

View file

@ -31,6 +31,8 @@ from mach.decorators import (
CommandProvider,
Command,
)
import servo.util
import tidy
from servo.command_base import (
@ -260,10 +262,20 @@ class MachCommands(CommandBase):
if nocapture:
args += ["--", "--nocapture"]
# We are setting is_build here to true, because running `cargo test` can trigger builds.
env = self.build_env(is_build=True)
# on MSVC, we need some DLLs in the path. They were copied
# in to the servo.exe build dir, so just point PATH to that.
# TODO(mrobinson): This should be removed entirely.
if "msvc" in servo.platform.host_triple():
servo.util.prepend_paths_to_env(
env, "PATH", path.dirname(self.get_binary_path(False, False)))
return self.run_cargo_build_like_command(
"bench" if bench else "test",
args,
env=self.build_env(test_unit=True),
env=env,
with_layout_2020=with_layout_2020,
**kwargs)