Bug 1062221 - Replace add_tier_dir with DIRS. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 02 Oct 2014 09:14:07 +0900
changeset 208284 23eb4e460b71abd665b6c872b1a395b34134410b
parent 208283 0a2548fb4c6a838227363af776f6f6f349497533
child 208285 601b5bcf7af201856d545d25a30b9081cb0d951a
push id27582
push userryanvm@gmail.com
push dateThu, 02 Oct 2014 16:20:06 +0000
treeherdermozilla-central@5d6ec4dddf14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1062221
milestone35.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 1062221 - Replace add_tier_dir with DIRS. r=gps
b2g/app.mozbuild
b2g/dev/app.mozbuild
browser/app.mozbuild
config/baseconfig.mk
config/makefiles/debugmake.mk
config/recurse.mk
config/rules.mk
mobile/android/app.mozbuild
moz.build
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/context.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/reader.py
python/mozbuild/mozbuild/test/backend/data/visual-studio/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-fails-in-subdir/foo/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-fails-in-subdir/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/bar/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/baz/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/foo/biz/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/foo/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/foo_static/moz.build
python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/moz.build
python/mozbuild/mozbuild/test/frontend/test_emitter.py
python/mozbuild/mozbuild/test/frontend/test_reader.py
python/mozbuild/mozbuild/test/frontend/test_sandbox.py
toolkit/toolkit.mozbuild
tools/update-packaging/app.mozbuild
xulrunner/app.mozbuild
--- a/b2g/app.mozbuild
+++ b/b2g/app.mozbuild
@@ -1,15 +1,17 @@
 # vim: set filetype=python:
 # 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/.
 
 if not CONFIG['LIBXUL_SDK']:
     include('/toolkit/toolkit.mozbuild')
 elif CONFIG['ENABLE_TESTS']:
-    add_tier_dir('testharness', 'testing/mochitest')
+    DIRS += ['testing/mochitest']
 
 if CONFIG['MOZ_EXTENSIONS']:
-    add_tier_dir('app', 'extensions')
+    DIRS += ['extensions']
 
-add_tier_dir('app', CONFIG['MOZ_BRANDING_DIRECTORY'])
-add_tier_dir('app', 'b2g')
+DIRS += [
+    CONFIG['MOZ_BRANDING_DIRECTORY'],
+    'b2g',
+]
--- a/b2g/dev/app.mozbuild
+++ b/b2g/dev/app.mozbuild
@@ -2,24 +2,24 @@
 # 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/.
 
 if not CONFIG['LIBXUL_SDK']:
     include('/toolkit/toolkit.mozbuild')
 
 if CONFIG['MOZ_EXTENSIONS']:
-    add_tier_dir('app', 'extensions')
+    DIRS += ['extensions']
 
-add_tier_dir('app', [CONFIG['MOZ_BRANDING_DIRECTORY']])
+DIRS += [CONFIG['MOZ_BRANDING_DIRECTORY']]
 
 if CONFIG['MOZ_WEBAPP_RUNTIME']:
-    add_tier_dir('app', 'webapprt')
-
-add_tier_dir('app', 'b2g/chrome')
-add_tier_dir('app', 'b2g/components')
+    DIRS += ['webapprt']
 
-add_tier_dir('app', 'b2g/dev/app')
+DIRS += [
+    'b2g/chrome',
+    'b2g/components',
+    'b2g/dev/app',
 
-# Never add tier dirs after browser because they apparently won't get
-# packaged properly on Mac.
-add_tier_dir('app', 'browser')
-
+    # Never add dirs after browser because they apparently won't get
+    # packaged properly on Mac.
+    'browser',
+]
--- a/browser/app.mozbuild
+++ b/browser/app.mozbuild
@@ -2,19 +2,19 @@
 # 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/.
 
 if not CONFIG['LIBXUL_SDK']:
     include('/toolkit/toolkit.mozbuild')
 
 if CONFIG['MOZ_EXTENSIONS']:
-    add_tier_dir('app', 'extensions')
+    DIRS += ['extensions']
 
-add_tier_dir('app', [CONFIG['MOZ_BRANDING_DIRECTORY']])
+DIRS += [CONFIG['MOZ_BRANDING_DIRECTORY']]
 
 if CONFIG['MOZ_WEBAPP_RUNTIME']:
-    add_tier_dir('app', 'webapprt')
+    DIRS += ['webapprt']
 
-# Never add tier dirs after browser because they apparently won't get
+# Never add dirs after browser because they apparently won't get
 # packaged properly on Mac.
-add_tier_dir('app', 'browser')
+DIRS += ['browser']
 
--- a/config/baseconfig.mk
+++ b/config/baseconfig.mk
@@ -96,17 +96,16 @@ else
   SDK_HEADERS \
   SDK_LIBRARY \
   SHARED_LIBRARY_LIBS \
   SHARED_LIBRARY_NAME \
   SIMPLE_PROGRAMS \
   SONAME \
   STATIC_LIBRARY_NAME \
   TEST_DIRS \
-  TIERS \
   TOOL_DIRS \
   XPCSHELL_TESTS \
   XPIDL_MODULE \
   $(NULL)
 
 _DEPRECATED_VARIABLES := \
   ANDROID_RESFILES \
   EXPORT_LIBRARY \
@@ -119,15 +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))'))
 
 endif
--- a/config/makefiles/debugmake.mk
+++ b/config/makefiles/debugmake.mk
@@ -20,22 +20,16 @@ endef
 
 define shell_quote
 '$(subst $(CR),\$(CR),$(subst ','\'',$(1)))'
 endef
 
 echo-variable-%:
 	@echo $(call shell_quote,$($*))
 
-echo-tiers:
-	@echo $(TIERS)
-
-echo-tier-dirs:
-	@$(foreach tier,$(TIERS),echo '$(tier):'; echo '  dirs: $(tier_$(tier)_dirs)')
-
 echo-dirs:
 	@echo $(call shell_quote,$(DIRS))
 
 define print_var
 @printf '%20s = %s\n' $1 $(call shell_quote,$($1))
 
 endef
 
--- a/config/recurse.mk
+++ b/config/recurse.mk
@@ -25,22 +25,16 @@ endif
 #   make -C foo/bar
 #   make -C foo/baz
 #   make -C qux
 
 ifeq (.,$(DEPTH))
 
 include root.mk
 
-# Disable build status for mach in top directories without TIERS.
-# In practice this disables it when recursing under js/src, which confuses mach.
-ifndef TIERS
-BUILDSTATUS =
-endif
-
 # Main rules (export, compile, libs and tools) call recurse_* rules.
 # This wrapping is only really useful for build status.
 compile libs export tools::
 	$(call BUILDSTATUS,TIER_START $@)
 	+$(MAKE) recurse_$@
 	$(call BUILDSTATUS,TIER_FINISH $@)
 
 # Special rule that does install-manifests (cf. Makefile.in) + compile
@@ -65,19 +59,17 @@ CURRENT_TIER := $(subst recurse_,,$(CURR
 ifdef CURRENT_TIER
 ifeq (0,$(MAKELEVEL))
 export NO_RECURSE_MAKELEVEL=1
 else
 export NO_RECURSE_MAKELEVEL=$(word $(MAKELEVEL),2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
 endif
 endif
 
-# Get all directories traversed for all subtiers in the current tier, or use
-# directly the $(*_dirs) variables available in root.mk when there is no
-# TIERS (like for js/src).
+# Use the $(*_dirs) variables available in root.mk
 CURRENT_DIRS := $($(CURRENT_TIER)_dirs)
 
 # Need a list of compile targets because we can't use pattern rules:
 # https://savannah.gnu.org/bugs/index.php?42833
 .PHONY: $(compile_targets)
 $(compile_targets):
 	$(call SUBMAKE,$(@F),$(@D))
 
@@ -118,42 +110,30 @@ ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVE
 
 compile libs export tools::
 
 else
 #########################
 # Tier traversal handling
 #########################
 
-ifdef TIERS
-
-libs export tools::
-	$(call BUILDSTATUS,TIER_START $@)
-	$(foreach tier,$(TIERS), $(if $(filter-out libs_precompile tools_precompile,$@_$(tier)), \
-		$(foreach dir, $(tier_$(tier)_dirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),$@))))
-	$(call BUILDSTATUS,TIER_FINISH $@)
-
-else
-
 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))))
 
 ifndef TOPLEVEL_BUILD
 libs:: target host
 endif
 
-endif # ifdef TIERS
-
 endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
 
 endif # ifeq (.,$(DEPTH))
 
 recurse:
 	@$(RECURSED_COMMAND)
 	$(LOOP_OVER_DIRS)
 
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -643,25 +643,18 @@ MOZ_PROGRAM_LDFLAGS += $(MOZ_GLUE_PROGRA
 
 checkout:
 	$(MAKE) -C $(topsrcdir) -f client.mk checkout
 
 clean clobber realclean clobber_all::
 	-$(RM) $(ALL_TRASH)
 	-$(RM) -r $(ALL_TRASH_DIRS)
 
-ifdef TIERS
-clean clobber realclean clobber_all distclean::
-	$(foreach dir, \
-		$(foreach tier, $(TIERS), $(tier_$(tier)_dirs)), \
-		-$(call SUBMAKE,$@,$(dir)))
-else
 clean clobber realclean clobber_all distclean::
 	$(foreach dir,$(DIRS),-$(call SUBMAKE,$@,$(dir)))
-endif
 
 distclean::
 	-$(RM) -r $(ALL_TRASH_DIRS)
 	-$(RM) $(ALL_TRASH)  \
 	Makefile .HSancillary \
 	$(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
 	$(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
 	$(wildcard *.$(IMPORT_LIB_SUFFIX))
@@ -1631,17 +1624,16 @@ endif
 
 FREEZE_VARIABLES = \
   CSRCS \
   CPPSRCS \
   EXPORTS \
   DIRS \
   LIBRARY \
   MODULE \
-  TIERS \
   EXTRA_COMPONENTS \
   EXTRA_PP_COMPONENTS \
   $(NULL)
 
 $(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
 
 CHECK_FROZEN_VARIABLES = $(foreach var,$(FREEZE_VARIABLES), \
   $(if $(subst $($(var)_FROZEN),,'$($(var))'),$(error Makefile variable '$(var)' changed value after including rules.mk. Was $($(var)_FROZEN), now $($(var)).)))
--- a/mobile/android/app.mozbuild
+++ b/mobile/android/app.mozbuild
@@ -2,18 +2,20 @@
 # 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/.
 
 if not CONFIG['LIBXUL_SDK']:
     include('/toolkit/toolkit.mozbuild')
 
 elif CONFIG['ENABLE_TESTS']:
-    add_tier_dir('testharness', 'testing/mochitest')
+    DIRS += ['testing/mochitest']
 
 if CONFIG['ENABLE_TESTS']:
-    add_tier_dir('testharness', 'testing/instrumentation')
+    DIRS += ['testing/instrumentation']
 
 if CONFIG['MOZ_EXTENSIONS']:
-    add_tier_dir('app', 'extensions')
+    DIRS += ['extensions']
 
-add_tier_dir('app', CONFIG['MOZ_BRANDING_DIRECTORY'])
-add_tier_dir('app', 'mobile/android')
+DIRS += [
+    CONFIG['MOZ_BRANDING_DIRECTORY'],
+    'mobile/android',
+]
--- a/moz.build
+++ b/moz.build
@@ -5,55 +5,67 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 CONFIGURE_SUBST_FILES += [
     'config/autoconf.mk',
     'config/emptyvars.mk',
 ]
 
 if CONFIG['ENABLE_CLANG_PLUGIN']:
-    add_tier_dir('base', 'build/clang-plugin')
+    DIRS += ['build/clang-plugin']
 
-add_tier_dir('base', ['config', 'python'])
+DIRS += [
+    'config',
+    'python',
+]
+
 if not CONFIG['JS_STANDALONE']:
     CONFIGURE_SUBST_FILES += [
         'mozilla-config.h',
         'tools/update-packaging/Makefile',
     ]
 
-    add_tier_dir('base', ['build', 'probes'])
+    DIRS += [
+        'build',
+        'probes',
+    ]
 
 if not CONFIG['LIBXUL_SDK']:
-    add_tier_dir('base', ['mfbt'])
-
-    add_tier_dir('base', ['config/external/zlib'])
+    DIRS += [
+        'mfbt',
+        'config/external/zlib',
+    ]
 
     if not CONFIG['JS_STANDALONE']:
         if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
-            add_tier_dir('base', ['other-licenses/android'])
+            DIRS += ['other-licenses/android']
 
         if CONFIG['MOZ_MEMORY']:
-            add_tier_dir('base', ['memory'])
+            DIRS += ['memory']
 
-        add_tier_dir('base', ['mozglue', 'memory/mozalloc'])
-
+        DIRS += [
+            'mozglue',
+            'memory/mozalloc',
+        ]
 
 if not CONFIG['JS_STANDALONE']:
-    add_tier_dir('precompile', 'xpcom/xpidl')
+    DIRS += ['xpcom/xpidl']
 
 if CONFIG['COMPILE_ENVIRONMENT'] and not CONFIG['LIBXUL_SDK']:
-    add_tier_dir('nspr', 'config/external/nspr')
+    DIRS += ['config/external/nspr']
 
     if not CONFIG['JS_STANDALONE']:
-        add_tier_dir('external', 'config/external')
-        add_tier_dir('nss', 'config/external/nss')
+        DIRS += [
+            'config/external',
+            'config/external/nss',
+        ]
 
     if CONFIG['BUILD_CTYPES']:
-        add_tier_dir('js', ['config/external/ffi'])
+        DIRS += ['config/external/ffi']
     if CONFIG['ENABLE_INTL_API']:
-        add_tier_dir('js', ['config/external/icu'])
-    add_tier_dir('js', ['js/src'])
+        DIRS += ['config/external/icu']
+    DIRS += ['js/src']
 
 if not CONFIG['JS_STANDALONE']:
     # Bring in the configuration for the configured application.
     include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
 
 include('build/templates.mozbuild')
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -786,33 +786,16 @@ class RecursiveMakeBackend(CommonBackend
     def _process_directory_traversal(self, obj, backend_file):
         """Process a data.DirectoryTraversal instance."""
         fh = backend_file.fh
 
         def relativize(dirs):
             return [mozpath.normpath(mozpath.join(backend_file.relobjdir, d))
                 for d in dirs]
 
-        for tier, dirs in obj.tier_dirs.iteritems():
-            fh.write('TIERS += %s\n' % tier)
-            # For pseudo derecursification, subtiers are treated as pseudo
-            # directories, with a special hierarchy:
-            # - subtier1 + dirA - dirAA
-            # |          |      + dirAB
-            # |          ...
-            # |          + dirB
-            # + subtier2 ...
-            if dirs:
-                fh.write('tier_%s_dirs += %s\n' % (tier, ' '.join(dirs)))
-                fh.write('DIRS += $(tier_%s_dirs)\n' % tier)
-                self._traversal.add('subtiers/%s' % tier,
-                                    dirs=relativize(dirs))
-
-            self._traversal.add('', dirs=['subtiers/%s' % tier])
-
         if obj.dirs:
             fh.write('DIRS := %s\n' % ' '.join(obj.dirs))
             self._traversal.add(backend_file.relobjdir, dirs=relativize(obj.dirs))
 
         if obj.test_dirs:
             fh.write('TEST_DIRS := %s\n' % ' '.join(obj.test_dirs))
             if self.environment.substs.get('ENABLE_TESTS', False):
                 self._traversal.add(backend_file.relobjdir,
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -641,34 +641,16 @@ VARIABLES = {
         """Like DIRS but only for directories that contain test-only code.
 
         If tests are not enabled, this variable will be ignored.
 
         This variable may go away once the transition away from Makefiles is
         complete.
         """, None),
 
-    'TIERS': (OrderedDict, dict,
-        """Defines directories constituting the tier traversal mechanism.
-
-        The recursive make backend iteration is organized into tiers. There are
-        major tiers (keys in this dict) that correspond roughly to applications
-        or libraries being built. e.g. base, nspr, js, platform, app. Within
-        each tier are phases like export, libs, and tools. The recursive make
-        backend iterates over each phase in the first tier then proceeds to the
-        next tier until all tiers are exhausted.
-
-        Tiers are a way of working around deficiencies in recursive make. These
-        will probably disappear once we no longer rely on recursive make for
-        the build backend. They will likely be replaced by ``DIRS``.
-
-        This variable is typically not populated directly. Instead, it is
-        populated by calling add_tier_dir().
-        """, None),
-
     'CONFIGURE_SUBST_FILES': (StrictOrderingOnAppendList, list,
         """Output files that will be generated using configure-like substitution.
 
         This is a substitute for ``AC_OUTPUT`` in autoconf. For each path in this
         list, we will search for a file in the srcdir having the name
         ``{path}.in``. The contents of this file will be read and variable
         patterns like ``@foo@`` will be substituted with the values of the
         ``AC_SUBST`` variables declared during configure.
@@ -1110,53 +1092,16 @@ FUNCTIONS = {
 
         The parameters are:
         * name - project name.
 
         This returns a rich Android Eclipse project type, described at
         :py:class:`mozbuild.frontend.data.AndroidEclipseProjectData`.
         """),
 
-    'add_tier_dir': (
-        lambda self: self._add_tier_directory,
-        (str, [str, list], bool, bool, str),
-        """Register a directory for tier traversal.
-
-        This is the preferred way to populate the TIERS variable.
-
-        Tiers are how the build system is organized. The build process is
-        divided into major phases called tiers. The most important tiers are
-        "platform" and "apps." The platform tier builds the Gecko platform
-        (typically outputting libxul). The apps tier builds the configured
-        application (browser, mobile/android, b2g, etc).
-
-        This function is typically only called by the main moz.build file or a
-        file directly included by the main moz.build file. An error will be
-        raised if it is called when it shouldn't be.
-
-        An error will also occur if you attempt to add the same directory to
-        the same tier multiple times.
-
-        Example usage
-        ^^^^^^^^^^^^^
-
-        Register a single directory with the 'platform' tier::
-
-           add_tier_dir('platform', 'xul')
-
-        Register multiple directories with the 'app' tier.::
-
-           add_tier_dir('app', ['components', 'base'])
-
-        Register a directory as having external content (no dependencies,
-        and traversed with export, libs, and tools subtiers::
-
-           add_tier_dir('base', 'bar', external=True)
-        """),
-
     'export': (lambda self: self._export, (str,),
         """Make the specified variable available to all child directories.
 
         The variable specified by the argument string is added to the
         environment of all directories specified in the DIRS and TEST_DIRS
         variables. If those directories themselves have child directories,
         the variable will be exported to all of them.
 
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -98,25 +98,23 @@ class DirectoryTraversal(ContextDerived)
     files is complete and we move to a more optimal build backend.
 
     Fields in this class correspond to similarly named variables in the
     frontend files.
     """
     __slots__ = (
         'dirs',
         'test_dirs',
-        'tier_dirs',
     )
 
     def __init__(self, context):
         ContextDerived.__init__(self, context)
 
         self.dirs = []
         self.test_dirs = []
-        self.tier_dirs = OrderedDict()
 
 
 class BaseConfigSubstitution(ContextDerived):
     """Base class describing autogenerated files as part of config.status."""
 
     __slots__ = (
         'input_path',
         'output_path',
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -1013,14 +1013,9 @@ class TreeMetadataEmitter(LoggingMixin):
         o.dirs = context.get('DIRS', [])
         o.test_dirs = context.get('TEST_DIRS', [])
         o.affected_tiers = context.get_affected_tiers()
 
         # Some paths have a subconfigure, yet also have a moz.build. Those
         # shouldn't end up in self._external_paths.
         self._external_paths -= { o.relobjdir }
 
-        if 'TIERS' in context:
-            for tier in context['TIERS']:
-                o.tier_dirs[tier] = context['TIERS'][tier]['regular'] + \
-                    context['TIERS'][tier]['external']
-
         yield o
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -245,35 +245,16 @@ class MozbuildSandbox(Sandbox):
         return data
 
     def _add_android_eclipse_library_project(self, name):
         data = self.add_android_eclipse_project_helper(name)
         data.manifest = None
         data.is_library = True
         return data
 
-    def _add_tier_directory(self, tier, reldir, external=False):
-        """Register a tier directory with the build."""
-        if isinstance(reldir, text_type):
-            reldir = [reldir]
-
-        if not tier in self['TIERS']:
-            self['TIERS'][tier] = {
-                'regular': [],
-                'external': [],
-            }
-
-        key = 'external' if external else 'regular'
-        for path in reldir:
-            if path in self['TIERS'][tier][key]:
-                raise Exception('Directory has already been registered with '
-                    'tier: %s' % path)
-
-            self['TIERS'][tier][key].append(path)
-
     def _export(self, varname):
         """Export the variable to all subdirectories of the current path."""
 
         exports = self.metadata.setdefault('exports', dict())
         if varname in exports:
             raise Exception('Variable has already been exported: %s' % varname)
 
         try:
@@ -969,38 +950,17 @@ class BuildReader(object):
                 recurse_info[d] = {}
                 if 'templates' in sandbox.metadata:
                     recurse_info[d]['templates'] = dict(
                         sandbox.metadata['templates'])
                 if 'exports' in sandbox.metadata:
                     sandbox.recompute_exports()
                     recurse_info[d]['exports'] = dict(sandbox.metadata['exports'])
 
-        # We also have tiers whose members are directories.
-        if 'TIERS' in context:
-            if not read_tiers:
-                raise SandboxValidationError(
-                    'TIERS defined but it should not be', context)
-
-            for tier, values in context['TIERS'].items():
-                # We don't descend into external directories because external by
-                # definition is external to the build system.
-                for d in values['regular']:
-                    if d in recurse_info:
-                        raise SandboxValidationError(
-                            'Tier directory (%s) registered multiple '
-                            'times in %s' % (d, tier), context)
-                    recurse_info[d] = {'check_external': True}
-                    if 'templates' in sandbox.metadata:
-                        recurse_info[d]['templates'] = dict(
-                            sandbox.metadata['templates'])
-
         for relpath, child_metadata in recurse_info.items():
-            if 'check_external' in child_metadata:
-                relpath = '/' + relpath
             child_path = sandbox.normalize_path(mozpath.join(relpath,
                 'moz.build'), srcdir=curdir)
 
             # Ensure we don't break out of the topsrcdir. We don't do realpath
             # because it isn't necessary. If there are symlinks in the srcdir,
             # that's not our problem. We're not a hosted application: we don't
             # need to worry about security too much.
             if not is_read_allowed(child_path, context.config):
--- a/python/mozbuild/mozbuild/test/backend/data/visual-studio/moz.build
+++ b/python/mozbuild/mozbuild/test/backend/data/visual-studio/moz.build
@@ -1,7 +1,7 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
-add_tier_dir('libs', ['dir1'])
+DIRS += ['dir1']
 
 Library('test')
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/frontend/data/traversal-tier-fails-in-subdir/foo/moz.build
+++ /dev/null
@@ -1,5 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-add_tier_dir('illegal', 'IRRELEVANT')
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/frontend/data/traversal-tier-fails-in-subdir/moz.build
+++ /dev/null
@@ -1,5 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-DIRS = ['foo']
deleted file mode 100644
deleted file mode 100644
deleted file mode 100644
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/foo/moz.build
+++ /dev/null
@@ -1,5 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-DIRS = ['biz']
deleted file mode 100644
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/frontend/data/traversal-tier-simple/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-add_tier_dir('t1', 'foo')
-add_tier_dir('t1', 'foo_static')
-
-add_tier_dir('t2', 'bar')
-add_tier_dir('t3', 'baz')
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -86,17 +86,16 @@ class TestEmitterBasic(unittest.TestCase
     def test_dirs_traversal_simple(self):
         reader = self.reader('traversal-simple')
         objs = self.read_topsrcdir(reader, filter_common=False)
         self.assertEqual(len(objs), 4)
 
         for o in objs:
             self.assertIsInstance(o, DirectoryTraversal)
             self.assertEqual(o.test_dirs, [])
-            self.assertEqual(len(o.tier_dirs), 0)
             self.assertTrue(os.path.isabs(o.context_main_path))
             self.assertEqual(len(o.context_all_paths), 1)
 
         reldirs = [o.relativedir for o in objs]
         self.assertEqual(reldirs, ['', 'foo', 'foo/biz', 'bar'])
 
         dirs = [o.dirs for o in objs]
         self.assertEqual(dirs, [['foo', 'bar'], ['biz'], [], []])
@@ -114,25 +113,16 @@ class TestEmitterBasic(unittest.TestCase
 
         for o in objs:
             reldir = o.relativedir
 
             if reldir == '':
                 self.assertEqual(o.dirs, ['regular'])
                 self.assertEqual(o.test_dirs, ['test'])
 
-    def test_tier_simple(self):
-        reader = self.reader('traversal-tier-simple')
-        objs = self.read_topsrcdir(reader, filter_common=False)
-        self.assertEqual(len(objs), 6)
-
-        reldirs = [o.relativedir for o in objs]
-        self.assertEqual(reldirs, ['', 'foo', 'foo/biz', 'foo_static', 'bar',
-            'baz'])
-
     def test_config_file_substitution(self):
         reader = self.reader('config-file-substitution')
         objs = self.read_topsrcdir(reader)
         self.assertEqual(len(objs), 2)
 
         self.assertIsInstance(objs[0], ConfigFileSubstitution)
         self.assertIsInstance(objs[1], ConfigFileSubstitution)
 
--- a/python/mozbuild/mozbuild/test/frontend/test_reader.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_reader.py
@@ -63,23 +63,16 @@ class TestBuildReader(unittest.TestCase)
         self.assertEqual(len(contexts), 1)
 
     def test_dirs_traversal_all_variables(self):
         reader = self.reader('traversal-all-vars', enable_tests=True)
 
         contexts = list(reader.read_topsrcdir())
         self.assertEqual(len(contexts), 3)
 
-    def test_tier_subdir(self):
-        # add_tier_dir() should fail when not in the top directory.
-        reader = self.reader('traversal-tier-fails-in-subdir')
-
-        with self.assertRaises(Exception):
-            list(reader.read_topsrcdir())
-
     def test_relative_dirs(self):
         # Ensure relative directories are traversed.
         reader = self.reader('traversal-relative-dirs')
 
         contexts = list(reader.read_topsrcdir())
         self.assertEqual(len(contexts), 3)
 
     def test_repeated_dirs_ignored(self):
--- a/python/mozbuild/mozbuild/test/frontend/test_sandbox.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_sandbox.py
@@ -207,63 +207,16 @@ class TestMozbuildSandbox(unittest.TestC
         e = se.exception
         self.assertIsInstance(e.exc_value, KeyError)
 
         e = se.exception.exc_value
         self.assertEqual(e.args[0], 'global_ns')
         self.assertEqual(e.args[1], 'reassign')
         self.assertEqual(e.args[2], 'DIST_SUBDIR')
 
-    def test_add_tier_dir_regular_str(self):
-        sandbox = self.sandbox()
-
-        sandbox.exec_source('add_tier_dir("t1", "foo")')
-
-        self.assertEqual(sandbox['TIERS']['t1'],
-            {'regular': ['foo'], 'external': []})
-
-    def test_add_tier_dir_regular_list(self):
-        sandbox = self.sandbox()
-
-        sandbox.exec_source('add_tier_dir("t1", ["foo", "bar"])')
-
-        self.assertEqual(sandbox['TIERS']['t1'],
-            {'regular': ['foo', 'bar'], 'external': []})
-
-    def test_add_tier_dir_external(self):
-        sandbox = self.sandbox()
-
-        sandbox.exec_source('add_tier_dir("t1", "foo", external=True)')
-
-        self.assertEqual(sandbox['TIERS']['t1'],
-            {'regular': [], 'external': ['foo']})
-
-    def test_tier_order(self):
-        sandbox = self.sandbox()
-
-        source = '''
-add_tier_dir('t1', 'foo')
-add_tier_dir('t1', 'bar')
-add_tier_dir('t2', 'baz')
-add_tier_dir('t3', 'biz')
-add_tier_dir('t1', 'bat')
-'''
-
-        sandbox.exec_source(source)
-
-        self.assertEqual([k for k in sandbox['TIERS'].keys()], ['t1', 't2', 't3'])
-
-    def test_tier_multiple_registration(self):
-        sandbox = self.sandbox()
-
-        sandbox.exec_source('add_tier_dir("t1", "foo")')
-
-        with self.assertRaises(SandboxExecutionError):
-            sandbox.exec_source('add_tier_dir("t1", "foo")')
-
     def test_include_basic(self):
         sandbox = self.sandbox(data_path='include-basic')
 
         sandbox.exec_file('moz.build')
 
         self.assertEqual(sandbox['DIRS'], ['foo', 'bar'])
         self.assertEqual(sandbox._context.main_path,
             sandbox.normalize_path('moz.build'))
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -2,191 +2,204 @@
 # 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/.
 
 if CONFIG['LIBXUL_SDK']:
     error('toolkit.mozbuild is not compatible with --enable-libxul-sdk=')
 
 if CONFIG['MOZ_SANDBOX']:
-    add_tier_dir('sandbox', 'security/sandbox')
+    DIRS += ['security/sandbox']
 
-# Depends on NSS and NSPR, and must be built after sandbox or else B2G emulator
-# builds fail.
-add_tier_dir('platform', 'security/certverifier')
-
-# Depends on certverifier
-add_tier_dir('platform', 'security/apps')
+DIRS += [
+    # Depends on NSS and NSPR, and must be built after sandbox or else B2G emulator
+    # builds fail.
+    'security/certverifier',
+    # Depends on certverifier
+    'security/apps',
+]
 
 # the signing related bits of libmar depend on nss
 if CONFIG['MOZ_UPDATER']:
-    add_tier_dir('platform', 'modules/libmar')
+    DIRS += ['modules/libmar']
 
 if CONFIG['NS_TRACE_MALLOC']:
-    add_tier_dir('platform', 'tools/trace-malloc/lib')
+    DIRS += ['tools/trace-malloc/lib']
 
 if CONFIG['MOZ_DMD']:
-    add_tier_dir('platform', 'memory/replace/dmd')
-
-add_tier_dir('platform', 'config/external/freetype2')
+    DIRS += ['memory/replace/dmd']
 
-add_tier_dir('platform', 'xpcom')
-
-add_tier_dir('platform', [
+DIRS += [
+    'config/external/freetype2',
+    'xpcom',
     'modules/libpref',
     'intl',
     'netwerk',
-])
+]
 
 if CONFIG['MOZ_AUTH_EXTENSION']:
-    add_tier_dir('platform', 'extensions/auth')
+    DIRS += ['extensions/auth']
 
 if CONFIG['MOZ_UPDATER']:
-    add_tier_dir('platform', 'other-licenses/bsdiff')
+    DIRS += ['other-licenses/bsdiff']
 
 # Gecko/Core components.
 
-add_tier_dir('platform', ['ipc', 'js/ipc'])
-
-add_tier_dir('platform', ['hal', 'js/xpconnect', 'intl/chardet'])
-
-add_tier_dir('platform', 'media/libyuv')
-
-add_tier_dir('platform', ['modules/libjar', 'storage'])
+DIRS += [
+    'ipc',
+    'js/ipc',
+    'hal',
+    'js/xpconnect',
+    'intl/chardet',
+    'media/libyuv',
+    'modules/libjar',
+    'storage',
+]
 
 if CONFIG['MOZ_PERMISSIONS']:
-    add_tier_dir('platform', ['extensions/cookie', 'extensions/permissions'])
+    DIRS += [
+        'extensions/cookie',
+        'extensions/permissions',
+    ]
 
-add_tier_dir('platform', 'rdf')
+DIRS += [
+    'rdf',
+]
 
 if CONFIG['MOZ_WEBRTC']:
-    add_tier_dir('platform', [
+    DIRS += [
         'media/webrtc',
         'media/mtransport/third_party',
         'media/mtransport/build',
         'media/mtransport/standalone',
-    ])
+    ]
 
 if CONFIG['MOZ_OMX_PLUGIN']:
-    add_tier_dir('platform', [
+    DIRS += [
         'media/omx-plugin/lib/ics/libutils',
         'media/omx-plugin/lib/ics/libstagefright',
         'media/omx-plugin/lib/ics/libvideoeditorplayer',
         'media/omx-plugin/lib/gb/libutils',
         'media/omx-plugin/lib/gb/libstagefright',
         'media/omx-plugin/lib/gb/libstagefright_color_conversion',
         'media/omx-plugin/lib/gb235/libstagefright',
         'media/omx-plugin',
         'media/omx-plugin/gb',
         'media/omx-plugin/gb235',
         'media/omx-plugin/lib/hc/libstagefright',
         'media/omx-plugin/hc',
         'media/omx-plugin/kk',
-    ])
+    ]
 
 if CONFIG['ENABLE_TESTS']:
-    add_tier_dir('platform', 'testing/specialpowers')
+    DIRS += ['testing/specialpowers']
 
-add_tier_dir('platform', 'testing/gtest')
-
-add_tier_dir('platform', [
+DIRS += [
+    'testing/gtest',
     'uriloader',
     'caps',
     'parser',
     'gfx',
     'image',
     'dom',
     'view',
     'widget',
     'content',
     'editor',
     'layout',
     'docshell',
     'embedding',
     'xpfe/appshell'
-])
+]
 
 # This needs to be built after the gfx/ directory
 # to ensure all dependencies for skia (e.g. mozalloc, xpcom)
 # have been built
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
-    add_tier_dir('platform', 'other-licenses/skia-npapi')
+    DIRS += ['other-licenses/skia-npapi']
 
 if CONFIG['MOZ_UNIVERSALCHARDET']:
-    add_tier_dir('platform', 'extensions/universalchardet')
+    DIRS += ['extensions/universalchardet']
 
 if CONFIG['ACCESSIBILITY']:
-    add_tier_dir('platform', 'accessible')
+    DIRS += ['accessible']
 
 # toolkit
 
-add_tier_dir('platform', 'profile')
+DIRS += ['profile']
 
 # This must precede xpfe.
 if CONFIG['MOZ_JPROF']:
-    add_tier_dir('platform', 'tools/jprof')
+    DIRS += ['tools/jprof']
 
-add_tier_dir('platform', 'tools/profiler')
-
-add_tier_dir('platform', 'xpfe/components')
+DIRS += [
+    'tools/profiler',
+    'xpfe/components',
+]
 
 if CONFIG['MOZ_ENABLE_XREMOTE']:
-    add_tier_dir('platform', 'widget/xremoteclient')
+    DIRS += ['widget/xremoteclient']
 
 if CONFIG['MOZ_SPELLCHECK']:
-    add_tier_dir('platform', 'extensions/spellcheck')
+    DIRS += ['extensions/spellcheck']
 
-add_tier_dir('platform', 'security/manager')
-
-add_tier_dir('platform', 'toolkit')
+DIRS += [
+    'security/manager',
+    'toolkit',
+]
 
 if CONFIG['MOZ_PREF_EXTENSIONS']:
-    add_tier_dir('platform', 'extensions/pref')
+    DIRS += ['extensions/pref']
 
-add_tier_dir('platform', 'services')
-add_tier_dir('platform', 'startupcache')
-add_tier_dir('platform', 'js/ductwork/debugger')
-add_tier_dir('platform', 'other-licenses/snappy')
+DIRS += [
+    'services',
+    'startupcache',
+    'js/ductwork/debugger',
+    'other-licenses/snappy',
+]
 
 if CONFIG['MOZ_GIO_COMPONENT']:
-    add_tier_dir('platform', 'extensions/gio')
+    DIRS += ['extensions/gio']
 
-add_tier_dir('platform', 'toolkit/library/StaticXULComponentsEnd')
-add_tier_dir('platform', 'toolkit/library')
+DIRS += [
+    'toolkit/library/StaticXULComponentsEnd',
+    'toolkit/library',
+]
 
 if CONFIG['MOZ_REPLACE_MALLOC']:
-    add_tier_dir('platform', 'memory/replace')
+    DIRS += ['memory/replace']
 
 if CONFIG['NS_TRACE_MALLOC']:
-    add_tier_dir('platform', 'tools/trace-malloc')
+    DIRS += ['tools/trace-malloc']
 
 if CONFIG['MOZ_ENABLE_GNOME_COMPONENT']:
-    add_tier_dir('platform', 'toolkit/system/gnome')
+    DIRS += ['toolkit/system/gnome']
 
 # if QtNetwork is present, it will do its own network monitoring
 if not CONFIG['MOZ_ENABLE_QTNETWORK'] and CONFIG['MOZ_ENABLE_DBUS']:
-    add_tier_dir('platform', 'toolkit/system/dbus')
+    DIRS += ['toolkit/system/dbus']
 
-add_tier_dir('platform', 'addon-sdk')
+DIRS += ['addon-sdk']
 
 if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('gonk', 'android'):
-    add_tier_dir('platform', 'testing/marionette')
+    DIRS += ['testing/marionette']
 
-add_tier_dir('platform', 'tools/quitter')
-
-add_tier_dir('platform', 'media/gmp-clearkey/0.1')
+DIRS += [
+    'tools/quitter',
+    'media/gmp-clearkey/0.1',
+]
 
 if CONFIG['ENABLE_TESTS']:
-    add_tier_dir('platform', [
+    DIRS += [
         'testing/mochitest',
         'testing/xpcshell',
         'testing/tools/screenshot',
         'testing/profiles',
         'testing/mozbase',
         'testing/modules',
         'testing/web-platform',
-    ])
+    ]
 
     if CONFIG['MOZ_WEBRTC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
-            add_tier_dir('platform', [
+            DIRS += [
                 'media/webrtc/signaling/test',
                 'media/mtransport/test',
-            ])
+            ]
--- a/tools/update-packaging/app.mozbuild
+++ b/tools/update-packaging/app.mozbuild
@@ -1,10 +1,10 @@
 # vim: set filetype=python:
 # 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/.
 
-add_tier_dir('app', [
+DIRS += [
     'modules/libbz2',
     'modules/libmar',
     'other-licenses/bsdiff',
-])
+]
--- a/xulrunner/app.mozbuild
+++ b/xulrunner/app.mozbuild
@@ -1,15 +1,15 @@
 # vim: set filetype=python:
 # 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('/toolkit/toolkit.mozbuild')
 
 if CONFIG['MOZ_EXTENSIONS']:
-    add_tier_dir('app', 'extensions')
+    DIRS += ['extensions']
 
 if CONFIG['OS_ARCH'] == 'WINNT' and (CONFIG['ENABLE_TESTS'] or
         CONFIG['MOZILLA_OFFICIAL']):
-    add_tier_dir('app', 'embedding/tests/winEmbed')
+    DIRS += ['embedding/tests/winEmbed']
 
-add_tier_dir('app', 'xulrunner')
+DIRS += ['xulrunner']