Bug 1094033 part 1 - Consolidate how to add new tiers. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 06 Nov 2014 09:29:11 +0900
changeset 238597 162cb466bb29
parent 238596 b49cc4ae0fdd
child 238598 59ebd02c7c2c
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1094033
milestone36.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 1094033 part 1 - Consolidate how to add new tiers. r=gps
Makefile.in
config/baseconfig.mk
config/recurse.mk
config/rules.mk
python/mozbuild/mozbuild/backend/recursivemake.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -32,20 +32,20 @@ ifdef JS_STANDALONE
 configure_dir = $(topsrcdir)/js/src
 else
 configure_dir = $(topsrcdir)
 endif
 
 ifndef MOZ_PROFILE_USE
 # We need to explicitly put backend.RecursiveMakeBackend here
 # otherwise the rule in rules.mk doesn't run early enough.
-libs binaries export tools:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
+$(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
 ifndef JS_STANDALONE
 ifndef LIBXUL_SDK
-libs binaries export tools:: $(topsrcdir)/js/src/configure js/src/config.status
+$(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
 endif
 endif
 endif
 
 ifdef JS_STANDALONE
 .PHONY: CLOBBER
 CLOBBER:
 else
@@ -169,17 +169,17 @@ export:: install-dist/sdk
 ifndef JS_STANDALONE
 ifdef ENABLE_TESTS
 # Additional makefile targets to call automated test suites
 include $(topsrcdir)/testing/testsuite-targets.mk
 endif
 endif
 
 default all::
-	$(call BUILDSTATUS,TIERS export $(if $(COMPILE_ENVIRONMENT),compile )libs tools $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
+	$(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
 
 include $(topsrcdir)/config/rules.mk
 
 distclean::
 	$(RM) $(DIST_GARBAGE)
 
 ifeq ($(OS_ARCH),WINNT)
 # we want to copy PDB files on Windows
--- a/config/baseconfig.mk
+++ b/config/baseconfig.mk
@@ -118,16 +118,16 @@ else
   MOCHITEST_CHROME_FILES \
   MOCHITEST_FILES \
   MOCHITEST_FILES_PARTS \
   MOCHITEST_METRO_FILES \
   MOCHITEST_ROBOCOP_FILES \
   SHORT_LIBNAME \
   TESTING_JS_MODULES \
   TESTING_JS_MODULE_DIR \
-  TIERS \
   $(NULL)
 
 # Freeze the values specified by moz.build to catch them if they fail.
 
 $(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES) $(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
 
+TIERS := export $(if $(COMPILE_ENVIRONMENT),compile )libs tools
 endif
--- a/config/recurse.mk
+++ b/config/recurse.mk
@@ -27,29 +27,29 @@ endif
 #   make -C qux
 
 ifeq (.,$(DEPTH))
 
 include root.mk
 
 # Main rules (export, compile, libs and tools) call recurse_* rules.
 # This wrapping is only really useful for build status.
-compile libs export tools::
+$(TIERS)::
 	$(call BUILDSTATUS,TIER_START $@)
 	+$(MAKE) recurse_$@
 	$(call BUILDSTATUS,TIER_FINISH $@)
 
 # Special rule that does install-manifests (cf. Makefile.in) + compile
 binaries::
 	+$(MAKE) recurse_compile
 
 # Carefully avoid $(eval) type of rule generation, which makes pymake slower
 # than necessary.
 # Get current tier and corresponding subtiers from the data in root.mk.
-CURRENT_TIER := $(filter $(foreach tier,compile libs export tools,recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
+CURRENT_TIER := $(filter $(foreach tier,$(TIERS),recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
 ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
 $(error $(CURRENT_TIER) not supported on the same make command line)
 endif
 CURRENT_TIER := $(subst recurse_,,$(CURRENT_TIER:-deps=))
 
 # The rules here are doing directory traversal, so we don't want further
 # recursion to happen when running make -C subdir $tier. But some make files
 # further call make -C something else, and sometimes expect recursion to
@@ -103,32 +103,32 @@ endif
 
 endif # ifeq ($(CURRENT_TIER),compile)
 
 else
 
 # Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
 ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
 
-compile libs export tools::
+$(TIERS)::
 
 else
 #########################
 # Tier traversal handling
 #########################
 
 define CREATE_SUBTIER_TRAVERSAL_RULE
 .PHONY: $(1)
 
 $(1):: $$(SUBMAKEFILES)
 	$$(LOOP_OVER_DIRS)
 
 endef
 
-$(foreach subtier,export libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
+$(foreach subtier,$(filter-out compile,$(TIERS)),$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
 
 ifndef TOPLEVEL_BUILD
 libs:: target host
 endif
 
 endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
 
 endif # ifeq (.,$(DEPTH))
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -537,22 +537,17 @@ endif
 endif
 endif
 
 # The root makefile doesn't want to do a plain export/libs, because
 # of the tiers and because of libxul. Suppress the default rules in favor
 # of something else. Makefiles which use this var *must* provide a sensible
 # default rule before including rules.mk
 default all::
-	$(MAKE) export
-ifdef COMPILE_ENVIRONMENT
-	$(MAKE) compile
-endif
-	$(MAKE) libs
-	$(MAKE) tools
+	$(foreach tier,$(TIERS),$(call SUBMAKE,$(tier)))
 
 ifeq ($(findstring s,$(filter-out --%, $(MAKEFLAGS))),)
 ECHO := echo
 QUIET :=
 else
 ECHO := true
 QUIET := -q
 endif
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -492,39 +492,43 @@ class RecursiveMakeBackend(CommonBackend
             self.log(logging.DEBUG, 'fill_root_mk', {
                 'number': len(skip), 'tier': tier
                 }, 'Ignoring {number} directories during {tier}')
         for tier, no_skip in self._no_skip.items():
             self.log(logging.DEBUG, 'fill_root_mk', {
                 'number': len(no_skip), 'tier': tier
                 }, 'Using {number} directories during {tier}')
 
+        def should_skip(tier, dir):
+            if tier in self._may_skip:
+                return dir in self._may_skip[tier]
+            if tier in self._no_skip:
+                return dir not in self._no_skip[tier]
+            return False
+
         # Traverse directories in parallel, and skip static dirs
         def parallel_filter(current, subdirs):
             all_subdirs = subdirs.dirs + subdirs.tests
-            if current in self._may_skip[tier] \
-                    or current.startswith('subtiers/'):
+            if should_skip(tier, current) or current.startswith('subtiers/'):
                 current = None
             return current, all_subdirs, []
 
         # build everything in parallel, including static dirs
         # Because of bug 925236 and possible other unknown race conditions,
         # don't parallelize the libs tier.
         def libs_filter(current, subdirs):
-            if current in self._may_skip['libs'] \
-                    or current.startswith('subtiers/'):
+            if should_skip('libs', current) or current.startswith('subtiers/'):
                 current = None
             return current, [], subdirs.dirs + subdirs.tests
 
         # Because of bug 925236 and possible other unknown race conditions,
         # don't parallelize the tools tier. There aren't many directories for
         # this tier anyways.
         def tools_filter(current, subdirs):
-            if current not in self._no_skip['tools'] \
-                    or current.startswith('subtiers/'):
+            if should_skip('tools', current) or current.startswith('subtiers/'):
                 current = None
             return current, [], subdirs.dirs + subdirs.tests
 
         filters = [
             ('export', parallel_filter),
             ('libs', libs_filter),
             ('tools', tools_filter),
         ]
@@ -802,16 +806,19 @@ class RecursiveMakeBackend(CommonBackend
         # registered or not.
         self._traversal.add(backend_file.relobjdir)
 
         affected_tiers = set(obj.affected_tiers)
 
         for tier in set(self._may_skip.keys()) - affected_tiers:
             self._may_skip[tier].add(backend_file.relobjdir)
 
+        for tier in set(self._no_skip.keys()) & affected_tiers:
+            self._no_skip[tier].add(backend_file.relobjdir)
+
     def _walk_hierarchy(self, obj, element, namespace=''):
         """Walks the ``HierarchicalStringList`` ``element`` in the context of
         the mozbuild object ``obj`` as though by ``element.walk()``, but yield
         three-tuple containing the following:
 
         - ``source`` - The path to the source file named by the current string
         - ``dest``   - The relative path, including the namespace, of the
                        destination file.