Bug 1798291 - Use a common CARGO_TARGET_DIR for all crates.

Differential Revision: https://phabricator.services.mozilla.com/D160777
This commit is contained in:
Arthur Carcano 2022-11-22 19:55:44 +00:00
parent 9ceb71fc14
commit bb9e2b9f8b
2 changed files with 7 additions and 5 deletions

View File

@ -1201,8 +1201,9 @@ class RecursiveMakeBackend(MakeBackend):
self, obj, backend_file, target_variable, target_cargo_variable
):
backend_file.write_once("CARGO_FILE := %s\n" % obj.cargo_file)
backend_file.write_once("CARGO_TARGET_DIR := .\n")
backend_file.write("%s += %s\n" % (target_variable, obj.location))
target_dir = mozpath.normpath(backend_file.environment.topobjdir)
backend_file.write("CARGO_TARGET_DIR := %s\n" % target_dir)
backend_file.write("%s += $(DEPTH)/%s\n" % (target_variable, obj.location))
backend_file.write("%s += %s\n" % (target_cargo_variable, obj.name))
def _process_rust_program(self, obj, backend_file):

View File

@ -1011,10 +1011,11 @@ class TestRecursiveMakeBackend(BackendTester):
expected = [
"CARGO_FILE := %s/code/Cargo.toml" % env.topsrcdir,
"CARGO_TARGET_DIR := .",
"RUST_PROGRAMS += i686-pc-windows-msvc/release/target.exe",
"CARGO_TARGET_DIR := %s" % env.topobjdir,
"RUST_PROGRAMS += $(DEPTH)/i686-pc-windows-msvc/release/target.exe",
"RUST_CARGO_PROGRAMS += target",
"HOST_RUST_PROGRAMS += i686-pc-windows-msvc/release/host.exe",
"CARGO_TARGET_DIR := %s" % env.topobjdir,
"HOST_RUST_PROGRAMS += $(DEPTH)/i686-pc-windows-msvc/release/host.exe",
"HOST_RUST_CARGO_PROGRAMS += host",
]