Bug 1275111 - Move artifact download/install into its own tier; r=glandium
authorMike Shal <mshal@mozilla.com>
Wed, 01 Jun 2016 13:48:53 -0400
changeset 302124 2597c1ed402f3ebf3091d7868701d5ec3a8a0eaf
parent 302123 e057b5daf5814d41680d6309a7bcca9545380051
child 302125 055b2ced895114e1ba5268462e24e4e490141943
push id19714
push usercbook@mozilla.com
push dateTue, 21 Jun 2016 10:15:32 +0000
treeherderfx-team@eb945fc547af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1275111, 1275673
milestone50.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). Note that the artifact download no longer happens when a specific target is passed to 'mach build'. MozReview-Commit-ID: Ktys6u3r1kG
Makefile.in
config/baseconfig.mk
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/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)
 
                 self.log(logging.WARNING, 'warning_summary',
                     {'count': len(monitor.warnings_database)},
                     '{count} compiler warnings present.')
@@ -655,28 +639,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):