Skip to content

Commit 47faf83

Browse files
authored
Auto merge of servo#29947 - mrobinson:update-mozangle, r=jdm
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. Fixes servo#29674 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they do not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2 parents 7412e28 + ddc7994 commit 47faf83

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
@@ -32,6 +32,8 @@
3232
CommandProvider,
3333
Command,
3434
)
35+
36+
import servo.util
3537
import tidy
3638

3739
from servo.command_base import (
@@ -245,10 +247,20 @@ def test_unit(self, test_name=None, package=None, bench=False, nocapture=False,
245247
if nocapture:
246248
args += ["--", "--nocapture"]
247249

250+
# We are setting is_build here to true, because running `cargo test` can trigger builds.
251+
env = self.build_env(is_build=True)
252+
253+
# on MSVC, we need some DLLs in the path. They were copied
254+
# in to the servo.exe build dir, so just point PATH to that.
255+
# TODO(mrobinson): This should be removed entirely.
256+
if "msvc" in servo.platform.host_triple():
257+
servo.util.prepend_paths_to_env(
258+
env, "PATH", path.dirname(self.get_binary_path(False, False)))
259+
248260
return self.run_cargo_build_like_command(
249261
"bench" if bench else "test",
250262
args,
251-
env=self.build_env(test_unit=True),
263+
env=env,
252264
with_layout_2020=with_layout_2020,
253265
**kwargs)
254266

0 commit comments

Comments
 (0)