Bug 1478561 - Expose MOZ_AUTOMATION to rust running in the tup build. draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 30 Jul 2018 16:46:10 -0700
changeset 824471 818d911f011a791e83254a412271090756d7fd59
parent 824364 b21e782599f6af1bef5a7232190ac406a3234453
child 824472 637a9470ef087f1314c4344d9b237c647da07524
push id117923
push userbmo:cmanchester@mozilla.com
push dateMon, 30 Jul 2018 23:47:12 +0000
bugs1478561
milestone63.0a1
Bug 1478561 - Expose MOZ_AUTOMATION to rust running in the tup build. MozReview-Commit-ID: 6ekOYJv7iz7
python/mozbuild/mozbuild/backend/tup.py
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -721,16 +721,23 @@ class TupBackend(CommonBackend):
         env.update({
             'MOZ_CARGO_WRAP_LDFLAGS': ' '.join(backend_file.local_flags['LDFLAGS']),
             'MOZ_CARGO_WRAP_LD': backend_file.environment.substs['CC'],
             linker_env_var: mozpath.join(self.environment.topsrcdir,
                                          'build', 'cargo-linker'),
             'RUSTFLAGS': '%s %s' % (' '.join(self.environment.substs['MOZ_RUST_DEFAULT_FLAGS']),
                                     ' '.join(self.environment.substs['RUSTFLAGS'])),
         })
+
+        if os.environ.get('MOZ_AUTOMATION'):
+            # Build scripts generally read environment variables that are set
+            # by cargo, however, some may rely on MOZ_AUTOMATION. We may need
+            # to audit for others as well.
+            env['MOZ_AUTOMATION'] = os.environ['MOZ_AUTOMATION']
+
         return env
 
     def _gen_cargo_rules(self, backend_file, build_plan, cargo_env):
         invocations = build_plan['invocations']
         processed = set()
 
         def get_libloading_outdir():
             for invocation in invocations: