mach: Fix cross-build check when using asan

When using asan the target_override is enabled,
but we can also still be cross-compiling.
Swapping the order fixes the cross-build
detection in combination with asan.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2025-05-29 15:21:40 +08:00
parent c6e37e83e4
commit 979304e493
No known key found for this signature in database

View file

@ -803,15 +803,16 @@ class CommandBase(object):
"--manifest-path",
path.join(self.context.topdir, "ports", "servoshell", "Cargo.toml"),
]
if target_override:
args += ["--target", target_override]
elif self.target.is_cross_build():
if self.target.is_cross_build():
args += ["--target", self.target.triple()]
if type(self.target) in [AndroidTarget, OpenHarmonyTarget]:
# Note: in practice `cargo rustc` should just be used unconditionally.
assert command != "build", "For Android / OpenHarmony `cargo rustc` must be used instead of cargo build"
if command == "rustc":
args += ["--lib", "--crate-type=cdylib"]
elif target_override:
args += ["--target", target_override]
features = []