Bug 1823598 - Run configure before running a mach cargo command. r=firefox-build-system-reviewers,ahochheiden

When there is no configured environment, mach cargo commands always need
one. `BuildDriver.build` does create one, but for commands that don't
need that, we do need configure. Ideally, we wouldn't, but that requires
moving all the cargo invocation logic out of rust.mk, which would be
more work.

Differential Revision: https://phabricator.services.mozilla.com/D173109
This commit is contained in:
Mike Hommey 2023-03-21 22:45:25 +00:00
Родитель f346c8ce36
Коммит 4268674aa7
1 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -236,11 +236,11 @@ def cargo(
if cargo_extra_flags is not None:
cargo_extra_flags = " ".join(cargo_extra_flags)
if cargo_build_flags:
try:
command_context.config_environment
except BuildEnvironmentNotFoundException:
build = command_context._spawn(BuildDriver)
try:
command_context.config_environment
except BuildEnvironmentNotFoundException:
build = command_context._spawn(BuildDriver)
if cargo_build_flags:
ret = build.build(
command_context.metrics,
what=["pre-export", "export"],
@ -248,8 +248,13 @@ def cargo(
verbose=verbose,
mach_context=command_context._mach_context,
)
if ret != 0:
return ret
else:
ret = build.configure(
command_context.metrics,
buildstatus_messages=False,
)
if ret != 0:
return ret
# XXX duplication with `mach vendor rust`
crates_and_roots = {