Bug 1275111 - Move artifact download/install into its own tier; r?glandium draft
authorMike Shal <mshal@mozilla.com>
Wed, 01 Jun 2016 13:48:53 -0400
changeset 375336 4484508800c63cadd3ad159a582c6492605d183e
parent 374456 92e0c73391e71a400e2c6674bca5ca70804ab081
child 522836 1320821743b7a0f409b46ce815e3ef92e2873f9b
push id20240
push userbmo:mshal@mozilla.com
push dateFri, 03 Jun 2016 22:56:41 +0000
reviewersglandium
bugs1275111, 1275673
milestone49.0a1
Bug 1275111 - Move artifact download/install into its own tier; r?glandium This also fixes the issue of processing the artifacts twice in some situations (bug 1275673). The artifact download no longer happens when a specific target is passed to 'mach build', except in the special case of 'mach build mobile/android', since that is the typical build invocation for Fennec developers. Otherwise, it only runs once during 'mach build' after configure. MozReview-Commit-ID: Ktys6u3r1kG
Makefile.in
config/baseconfig.mk
mobile/android/Makefile.in
python/mozbuild/mozbuild/config_status.py
python/mozbuild/mozbuild/mach_commands.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -232,16 +232,19 @@ recurse_pre-export:: install-manifests
 binaries::
 	@$(MAKE) install-manifests NO_REMOVE=1 install_manifests=dist/include
 endif
 
 # For historical reasons that are unknown, $(DIST)/sdk is always blown away
 # with no regard for PGO passes. This decision could probably be revisited.
 recurse_pre-export:: install-dist/sdk
 
+recurse_artifact:
+	$(topsrcdir)/mach --log-no-times artifact install
+
 ifndef JS_STANDALONE
 ifdef ENABLE_TESTS
 # Additional makefile targets to call automated test suites
 include $(topsrcdir)/testing/testsuite-targets.mk
 endif
 endif
 
 default all::
--- a/config/baseconfig.mk
+++ b/config/baseconfig.mk
@@ -40,17 +40,17 @@ ifeq (a,$(firstword a$(subst /, ,$(srcdi
 $(error MSYS-style srcdir are not supported for Windows builds.)
 endif
 endif
 endif # WINNT
 
 ifndef INCLUDED_AUTOCONF_MK
 default::
 else
-TIERS := pre-export export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools
+TIERS := $(if $(MOZ_ARTIFACT_BUILDS),artifact )pre-export export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools
 endif
 
 # These defines are used to support the twin-topsrcdir model for comm-central.
 ifdef MOZILLA_SRCDIR
   MOZILLA_DIR = $(MOZILLA_SRCDIR)
 else
   MOZILLA_DIR = $(topsrcdir)
 endif
--- a/mobile/android/Makefile.in
+++ b/mobile/android/Makefile.in
@@ -1,11 +1,21 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+include $(topsrcdir)/config/config.mk
+
+# Since most Fennec developers do 'mach build mobile/android', this skips over
+# the normal artifact download logic, but we still want to check for artifacts
+# in this case.
+ifdef MOZ_ARTIFACT_BUILDS
+default::
+	$(topsrcdir)/mach --log-no-times artifact install
+endif
+
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/testing/testsuite-targets.mk
 
 package-mobile-tests:
 	$(MAKE) stage-mochitest DIST_BIN=$(DEPTH)/$(DIST)/bin/xulrunner
 	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
 	@(cd $(PKG_STAGE) && tar $(TAR_CREATE_FLAGS) - *) | bzip2 -f > $(DIST)/$(PKG_PATH)$(TEST_PACKAGE)
--- a/python/mozbuild/mozbuild/config_status.py
+++ b/python/mozbuild/mozbuild/config_status.py
@@ -173,18 +173,8 @@ def config_status(topobjdir='.', topsrcd
     # Advertise Visual Studio if appropriate.
     if os.name == 'nt' and 'VisualStudio' not in options.backend:
         print(VISUAL_STUDIO_ADVERTISEMENT)
 
     # Advertise Eclipse if it is appropriate.
     if MachCommandConditions.is_android(env):
         if 'AndroidEclipse' not in options.backend:
             print(ANDROID_IDE_ADVERTISEMENT)
-
-    if env.substs.get('MOZ_ARTIFACT_BUILDS', False):
-        # Execute |mach artifact install| from the top source directory.
-        os.chdir(topsrcdir)
-        return subprocess.check_call([
-            sys.executable,
-            os.path.join(topsrcdir, 'mach'),
-            '--log-no-times',
-            'artifact',
-            'install'])
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -394,46 +394,30 @@ class Build(MachCommandBase):
                 # have rules in the invoked Makefile to rebuild the build
                 # backend. But that involves make reinvoking itself and there
                 # are undesired side-effects of this. See bug 877308 for a
                 # comprehensive history lesson.
                 self._run_make(directory=self.topobjdir, target='backend',
                     line_handler=output.on_line, log=False,
                     print_directory=False)
 
-                if self.substs.get('MOZ_ARTIFACT_BUILDS', False):
-                    self._run_mach_artifact_install()
-
                 # Build target pairs.
                 for make_dir, make_target in target_pairs:
                     # We don't display build status messages during partial
                     # tree builds because they aren't reliable there. This
                     # could potentially be fixed if the build monitor were more
                     # intelligent about encountering undefined state.
                     status = self._run_make(directory=make_dir, target=make_target,
                         line_handler=output.on_line, log=False, print_directory=False,
                         ensure_exit_code=False, num_jobs=jobs, silent=not verbose,
                         append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'})
 
                     if status != 0:
                         break
             else:
-                try:
-                    if self.substs.get('MOZ_ARTIFACT_BUILDS', False):
-                        self._run_mach_artifact_install()
-                except BuildEnvironmentNotFoundException:
-                    # Can't read self.substs from config.status?  That means we
-                    # need to run configure.  The client.mk invocation below
-                    # will configure, which will run config.status, which will
-                    # invoke |mach artifact install| itself before continuing
-                    # the build.  Therefore, we needn't install artifacts
-                    # ourselves.
-                    self.log(logging.DEBUG, 'artifact',
-                             {}, "Not running |mach artifact install| -- it will be run by client.mk.")
-
                 status = self._run_make(srcdir=True, filename='client.mk',
                     line_handler=output.on_line, log=False, print_directory=False,
                     allow_parallel=False, ensure_exit_code=False, num_jobs=jobs,
                     silent=not verbose)
 
                 make_extra = self.mozconfig['make_extra'] or []
                 make_extra = dict(m.split('=', 1) for m in make_extra)
 
@@ -676,28 +660,16 @@ class Build(MachCommandBase):
         if verbose:
             args.append('--verbose')
         if dry_run:
             args.append('--dry-run')
 
         return self._run_command_in_objdir(args=args, pass_thru=True,
             ensure_exit_code=False)
 
-    def _run_mach_artifact_install(self):
-        # We'd like to launch artifact using
-        # self._mach_context.commands.dispatch.  However, artifact activates
-        # the virtualenv, which plays badly with the rest of this code.
-        # Therefore, we run |mach artifact install| in a new process (and
-        # throw an exception if it fails).
-        self.log(logging.INFO, 'artifact',
-                 {}, "Running |mach artifact install|.")
-        args = [os.path.join(self.topsrcdir, 'mach'), 'artifact', 'install']
-        self._run_command_in_srcdir(args=args, require_unix_environment=True,
-            pass_thru=True, ensure_exit_code=True)
-
 @CommandProvider
 class Doctor(MachCommandBase):
     """Provide commands for diagnosing common build environment problems"""
     @Command('doctor', category='devenv',
         description='')
     @CommandArgument('--fix', default=None, action='store_true',
         help='Attempt to fix found problems.')
     def doctor(self, fix=None):