Bug 1497359 - Detect and reject re-use of objdirs between Make and Tup in configure. r=froydnj
authorChris Manchester <cmanchester@mozilla.com>
Thu, 11 Oct 2018 19:16:49 +0000
changeset 499222 8878ac1f9f36c00d902b7a5d4e636ffbbc9217de
parent 499221 d1c5f2c89b170fc8f60e1b81da1f22d5218dd706
child 499223 7a275e7abf9b88e0d70a14e5a3dea3a7a8ce21e0
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1497359
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1497359 - Detect and reject re-use of objdirs between Make and Tup in configure. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D8289
moz.configure
python/mozbuild/mozbuild/controller/building.py
--- a/moz.configure
+++ b/moz.configure
@@ -282,16 +282,37 @@ option('--build-backends', nargs='+', de
        choices=build_backends_choices, help='Build backends to generate')
 
 @depends('--build-backends')
 def build_backends(backends):
     return backends
 
 set_config('BUILD_BACKENDS', build_backends)
 
+
+@depends(check_build_environment, build_backends)
+@imports('glob')
+def check_objdir_backend_reuse(build_env, backends):
+    # "Make based" might be RecursiveMake or a hybrid backend, so "Make" is
+    # intentionally vague for use with the substring match below.
+    incompatible_backends = (
+        ('Tup', 'Make'),
+        ('Make', 'Tup')
+    )
+    for backend_file in glob.iglob(os.path.join(build_env.topobjdir,
+                                                'backend.*Backend')):
+        for prev, curr in incompatible_backends:
+            if prev in backend_file and any(curr in b for b in backends):
+                die("The active objdir, %s, was previously "
+                    "used to build with a %s based backend. "
+                    "Change objdirs (by setting MOZ_OBJDIR in "
+                    "your mozconfig) or clobber to continue.\n",
+                    build_env.topobjdir, prev)
+
+
 option('--disable-gtest-in-build',
        help='Force disable building the gtest libxul during the build.',
        when='--enable-compile-environment')
 
 # Determine whether to build the gtest xul. This happens in automation
 # on Desktop platforms with the exception of Windows PGO, where linking
 # xul-gtest.dll takes too long.
 @depends('MOZ_PGO', build_project, target, 'MOZ_AUTOMATION', '--disable-gtest-in-build',
--- a/python/mozbuild/mozbuild/controller/building.py
+++ b/python/mozbuild/mozbuild/controller/building.py
@@ -1045,26 +1045,16 @@ class BuildDriver(MozbuildObject):
                 if config_rc != 0:
                     return config_rc
 
                 config = self.config_environment
 
             status = None
             active_backend = config.substs.get('BUILD_BACKENDS', [None])[0]
             if active_backend and 'Make' not in active_backend:
-                for backend_file in glob.iglob(mozpath.join(self.topobjdir,
-                                                            'backend.*Backend')):
-                    if 'Make' in backend_file:
-                        self.log(logging.ERROR, 'backend',
-                                 {'objdir': self.topobjdir},
-                                 "The active objdir, {objdir}, was previously "
-                                 "used to build with a Make-based backend. "
-                                 "Change objdirs (by setting MOZ_OBJDIR in "
-                                 "your mozconfig) to continue.\n")
-                        return 1
                 # Record whether a clobber was requested so we can print
                 # a special message later if the build fails.
                 clobber_requested = False
                 # Write out any changes to the current mozconfig in case
                 # they should invalidate configure.
                 self._write_mozconfig_json()
                 # Even if we have a config object, it may be out of date
                 # if something that influences its result has changed.