Skip to content

Commit ddc7994

Browse files
committed
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.
1 parent a725380 commit ddc7994

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/servo/build_commands.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def build(self, release=False, dev=False, jobs=None, params=None, no_package=Fal
118118
self.ensure_clobbered()
119119

120120
build_start = time()
121-
env["CARGO_TARGET_DIR"] = target_path
122121

123122
host = servo.platform.host_triple()
124123
target_triple = self.cross_compile_target or servo.platform.host_triple()
@@ -401,10 +400,6 @@ def build(self, release=False, dev=False, jobs=None, params=None, no_package=Fal
401400
for key in env:
402401
print((key, env[key]))
403402

404-
if sys.platform != "win32":
405-
env.setdefault("CC", "clang")
406-
env.setdefault("CXX", "clang++")
407-
408403
status = self.run_cargo_build_like_command(
409404
"build", opts, env=env, verbose=verbose,
410405
libsimpleservo=libsimpleservo, **kwargs

python/servo/command_base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def vs_dirs(self):
496496
'vcdir': vcinstalldir,
497497
}
498498

499-
def build_env(self, is_build=False, test_unit=False):
499+
def build_env(self, is_build=False):
500500
"""Return an extended environment dictionary."""
501501
env = os.environ.copy()
502502

@@ -557,6 +557,10 @@ def build_env(self, is_build=False, test_unit=False):
557557
# Always build harfbuzz from source
558558
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
559559

560+
if sys.platform != "win32":
561+
env.setdefault("CC", "clang")
562+
env.setdefault("CXX", "clang++")
563+
560564
if extra_path:
561565
util.append_paths_to_env(env, "PATH", extra_path)
562566

@@ -597,11 +601,6 @@ def build_env(self, is_build=False, test_unit=False):
597601
if "ANDROID_TOOLCHAIN" in env:
598602
env["NDK_STANDALONE"] = env["ANDROID_TOOLCHAIN"]
599603

600-
if test_unit and "msvc" in servo.platform.host_triple():
601-
# on MSVC, we need some DLLs in the path. They were copied
602-
# in to the servo.exe build dir, so just point PATH to that.
603-
util.prepend_paths_to_env(env, "PATH", path.dirname(self.get_binary_path(False, False)))
604-
605604
if self.config["build"]["rustflags"]:
606605
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " " + self.config["build"]["rustflags"]
607606

@@ -619,6 +618,7 @@ def build_env(self, is_build=False, test_unit=False):
619618
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C target-feature=+neon"
620619

621620
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates"
621+
env["CARGO_TARGET_DIR"] = servo.util.get_target_dir()
622622

623623
git_info = []
624624
if os.path.isdir('.git') and is_build:

python/servo/testing_commands.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
CommandProvider,
3232
Command,
3333
)
34+
35+
import servo.util
3436
import tidy
3537

3638
from servo.command_base import (
@@ -260,10 +262,20 @@ def test_unit(self, test_name=None, package=None, bench=False, nocapture=False,
260262
if nocapture:
261263
args += ["--", "--nocapture"]
262264

265+
# We are setting is_build here to true, because running `cargo test` can trigger builds.
266+
env = self.build_env(is_build=True)
267+
268+
# on MSVC, we need some DLLs in the path. They were copied
269+
# in to the servo.exe build dir, so just point PATH to that.
270+
# TODO(mrobinson): This should be removed entirely.
271+
if "msvc" in servo.platform.host_triple():
272+
servo.util.prepend_paths_to_env(
273+
env, "PATH", path.dirname(self.get_binary_path(False, False)))
274+
263275
return self.run_cargo_build_like_command(
264276
"bench" if bench else "test",
265277
args,
266-
env=self.build_env(test_unit=True),
278+
env=env,
267279
with_layout_2020=with_layout_2020,
268280
**kwargs)
269281

0 commit comments

Comments
 (0)