Bug 1480313 - Set check_unchanged for cargo build script rules in the Tup build. draft
authorChris Manchester <cmanchester@mozilla.com>
Wed, 01 Aug 2018 21:24:51 -0700 (2018-08-02)
changeset 825596 b6c914eea301d0244345e4de0875d12cd1fe7706
parent 825434 89374090a8377286a2025e15c8063a0285920304
push id118147
push userbmo:cmanchester@mozilla.com
push dateThu, 02 Aug 2018 04:25:14 +0000 (2018-08-02)
bugs1480313
milestone63.0a1
Bug 1480313 - Set check_unchanged for cargo build script rules in the Tup build. MozReview-Commit-ID: Cx3sP5m16Yl
python/mozbuild/mozbuild/backend/tup.py
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -807,27 +807,37 @@ class TupBackend(CommonBackend):
                 header = 'RUN'
 
             invocation['full-deps'] = set(inputs)
             invocation['full-deps'].update(invocation['outputs'])
 
             cmd_key = ' '.join(command)
             if cmd_key not in self._rust_cmds:
                 self._rust_cmds.add(cmd_key)
+                # We have some custom build scripts that depend on python code
+                # as well as invalidate a lot of the rust build, so set
+                # check_unchanged to try to reduce long incremental builds
+                # when only changing python.
+                check_unchanged = False
+                if (invocation['target_kind'][0] == 'custom-build' and
+                    os.path.basename(invocation['program']) != 'rustc'):
+                    check_unchanged = True
+
                 # The two rust libraries in the tree share many prerequisites,
                 # so we need to prune common dependencies and therefore build
                 # all rust from the same Tupfile.
                 rust_backend_file = self._get_backend_file('toolkit/library/rust')
                 rust_backend_file.rule(
                     command,
                     inputs=sorted(inputs),
                     outputs=outputs,
                     output_group=self._rust_libs,
                     extra_inputs=[self._installed_files],
                     display='%s %s' % (header, display_name(invocation)),
+                    check_unchanged=check_unchanged,
                 )
 
                 for dst, link in invocation['links'].iteritems():
                     rust_backend_file.symlink_rule(link, dst, self._rust_libs)
 
         for val in enumerate(invocations):
             _process(*val)