Bug 1329726 - part 2 - ensure {,HOST_}RUST_PROGRAMS are hooked into root-deps.mk; r=chmanchester

If we don't do this, a directory with only
RUST_PROGRAMS (resp. HOST_RUST_PROGRAMS) won't get traversed properly.
This commit is contained in:
Nathan Froyd 2017-01-10 11:33:58 -05:00
parent 96bf4530f4
commit c5ffb0976b
5 changed files with 20 additions and 7 deletions

View file

@ -539,13 +539,16 @@ class RecursiveMakeBackend(CommonBackend):
backend_file.write('JAR_MANIFEST := %s\n' % obj.path.full_path)
elif isinstance(obj, RustProgram):
# Note that for these and host Rust programs, we don't need to
# bother with linked libraries, because Cargo will take care of
# all of that for us.
self._process_rust_program(obj, backend_file)
# Hook the program into the compile graph.
build_target = self._build_target_for_obj(obj)
self._compile_graph[build_target]
elif isinstance(obj, HostRustProgram):
self._process_host_rust_program(obj, backend_file)
# Hook the program into the compile graph.
build_target = self._build_target_for_obj(obj)
self._compile_graph[build_target]
elif isinstance(obj, Program):
self._process_program(obj.program, backend_file)

View file

@ -0,0 +1,6 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
RUST_PROGRAMS += ['target']
HOST_RUST_PROGRAMS += ['host']

View file

@ -2,5 +2,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
RUST_PROGRAMS += ['target']
HOST_RUST_PROGRAMS += ['host']
DIRS += ['code']

View file

@ -768,11 +768,11 @@ class TestRecursiveMakeBackend(BackendTester):
"""Test that {HOST_,}RUST_PROGRAMS are written to backend.mk correctly."""
env = self._consume('rust-programs', RecursiveMakeBackend)
backend_path = mozpath.join(env.topobjdir, 'backend.mk')
backend_path = mozpath.join(env.topobjdir, 'code/backend.mk')
lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:]]
expected = [
'CARGO_FILE := %s/Cargo.toml' % env.topsrcdir,
'CARGO_FILE := %s/code/Cargo.toml' % env.topsrcdir,
'RUST_PROGRAMS += i686-pc-windows-msvc/release/target.exe',
'RUST_CARGO_PROGRAMS += target',
'HOST_RUST_PROGRAMS += i686-pc-windows-msvc/release/host.exe',
@ -781,6 +781,11 @@ class TestRecursiveMakeBackend(BackendTester):
self.assertEqual(lines, expected)
root_deps_path = mozpath.join(env.topobjdir, 'root-deps.mk')
lines = [l.strip() for l in open(root_deps_path, 'rt').readlines()]
self.assertTrue(any(l == 'recurse_compile: code/host code/target' for l in lines))
def test_final_target(self):
"""Test that FINAL_TARGET is written to backend.mk correctly."""
env = self._consume('final_target', RecursiveMakeBackend)