Bug 910096 - Treat js/src differently from other "static" directories. r=gps

This commit is contained in:
Mike Hommey 2013-08-30 11:12:23 +09:00
parent 602c5092f9
commit c87e058ada
5 changed files with 25 additions and 8 deletions

View File

@ -3,5 +3,5 @@
# 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('js', 'js/src', static=True)
add_tier_dir('js', 'js/src', external=True)

View File

@ -174,7 +174,8 @@ class TreeMetadataEmitter(LoggingMixin):
if 'TIERS' in sandbox:
for tier in sandbox['TIERS']:
o.tier_dirs[tier] = sandbox['TIERS'][tier]['regular']
o.tier_dirs[tier] = sandbox['TIERS'][tier]['regular'] + \
sandbox['TIERS'][tier]['external']
o.tier_static_dirs[tier] = sandbox['TIERS'][tier]['static']
yield o

View File

@ -212,7 +212,7 @@ class MozbuildSandbox(Sandbox):
Sandbox.exec_file(self, path)
def _add_tier_directory(self, tier, reldir, static=False):
def _add_tier_directory(self, tier, reldir, static=False, external=False):
"""Register a tier directory with the build."""
if isinstance(reldir, text_type):
reldir = [reldir]
@ -221,9 +221,13 @@ class MozbuildSandbox(Sandbox):
self['TIERS'][tier] = {
'regular': [],
'static': [],
'external': [],
}
key = 'static' if static else 'regular'
key = 'static' if static else 'external' if external else 'regular'
if external and static:
raise Exception('Only one of external or static can be set at the '
'same time')
for path in reldir:
if path in self['TIERS'][tier][key]:

View File

@ -414,7 +414,7 @@ FUNCTIONS = {
include('/elsewhere/foo.build')
"""),
'add_tier_dir': ('_add_tier_directory', (str, [str, list], bool),
'add_tier_dir': ('_add_tier_directory', (str, [str, list], bool, bool),
"""Register a directory for tier traversal.
This is the preferred way to populate the TIERS variable.
@ -443,6 +443,10 @@ FUNCTIONS = {
# Register a directory as having static content (no dependencies).
add_tier_dir('base', 'foo', static=True)
# Register a directory as having external content (same as static
# content, but traversed with export, libs, and tools subtiers.
add_tier_dir('base', 'bar', external=True)
"""),
'warning': ('_warning', (str,),

View File

@ -169,7 +169,7 @@ class TestSandbox(unittest.TestCase):
sandbox.exec_source('add_tier_dir("t1", "foo")', 'foo.py')
self.assertEqual(sandbox['TIERS']['t1'],
{'regular': ['foo'], 'static': []})
{'regular': ['foo'], 'static': [], 'external': []})
def test_add_tier_dir_regular_list(self):
sandbox = self.sandbox()
@ -177,7 +177,7 @@ class TestSandbox(unittest.TestCase):
sandbox.exec_source('add_tier_dir("t1", ["foo", "bar"])', 'foo.py')
self.assertEqual(sandbox['TIERS']['t1'],
{'regular': ['foo', 'bar'], 'static': []})
{'regular': ['foo', 'bar'], 'static': [], 'external': []})
def test_add_tier_dir_static(self):
sandbox = self.sandbox()
@ -185,7 +185,15 @@ class TestSandbox(unittest.TestCase):
sandbox.exec_source('add_tier_dir("t1", "foo", static=True)', 'foo.py')
self.assertEqual(sandbox['TIERS']['t1'],
{'regular': [], 'static': ['foo']})
{'regular': [], 'static': ['foo'], 'external': []})
def test_add_tier_dir_static(self):
sandbox = self.sandbox()
sandbox.exec_source('add_tier_dir("t1", "foo", external=True)', 'foo.py')
self.assertEqual(sandbox['TIERS']['t1'],
{'regular': [], 'static': [], 'external': ['foo']})
def test_tier_order(self):
sandbox = self.sandbox()