Bug 818246 - Part 8: Support XPIDL_FLAGS in moz.build; r=gps
authorMike Shal <mshal@mozilla.com>
Tue, 12 Mar 2013 10:09:00 -0700
changeset 124636 570563fe3824d988ef2f638b31fb6497f0f4fdf4
parent 124635 57a08895caccb40e0e0fcb336b8e6ff2713f3cbc
child 124637 e105eedc18c954680440946394ee07db386ddb72
push id24428
push usergszorc@mozilla.com
push dateWed, 13 Mar 2013 15:22:31 +0000
treeherdermozilla-central@b98d7eb83da6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs818246
milestone22.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 818246 - Part 8: Support XPIDL_FLAGS in moz.build; r=gps
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/sandbox_symbols.py
python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
python/mozbuild/mozbuild/test/backend/test_recursivemake.py
python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -73,16 +73,18 @@ class TreeMetadataEmitter(object):
         # Proxy some variables as-is until we have richer classes to represent
         # them. We should aim to keep this set small because it violates the
         # desired abstraction of the build definition away from makefiles.
         passthru = VariablePassthru(sandbox)
         if sandbox['XPIDL_SOURCES']:
             passthru.variables['XPIDLSRCS'] = sandbox['XPIDL_SOURCES']
         if sandbox['XPIDL_MODULE']:
             passthru.variables['XPIDL_MODULE'] = sandbox['XPIDL_MODULE']
+        if sandbox['XPIDL_FLAGS']:
+            passthru.variables['XPIDL_FLAGS'] = sandbox['XPIDL_FLAGS']
 
         if passthru.variables:
             yield passthru
 
     def _emit_directory_traversal_from_sandbox(self, sandbox):
         o = DirectoryTraversal(sandbox)
         o.dirs = sandbox.get('DIRS', [])
         o.parallel_dirs = sandbox.get('PARALLEL_DIRS', [])
--- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
+++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ -152,16 +152,24 @@ VARIABLES = {
 
     'XPIDL_MODULE': (unicode, "",
         """XPCOM Interface Definition Module Name.
 
         This is the name of the .xpt file that is created by linking
         XPIDL_SOURCES together. If unspecified, it defaults to be the same as
         MODULE.
         """),
+
+    'XPIDL_FLAGS': (list, [],
+        """XPCOM Interface Definition Module Flags.
+
+        This is a list of extra flags that are passed to the IDL compiler.
+        Typically this is a set of -I flags that denote extra include
+        directories to search for included .idl files.
+        """),
 }
 
 # The set of functions exposed to the sandbox.
 #
 # Each entry is a tuple of:
 #
 #  (method attribute, (argument types), docs)
 #
--- a/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
+++ b/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
@@ -1,5 +1,6 @@
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
 XPIDL_SOURCES = ['foo.idl', 'bar.idl', 'biz.idl']
 XPIDL_MODULE = 'module_name'
+XPIDL_FLAGS = ['-Idir1', '-Idir2', '-Idir3']
--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
@@ -124,13 +124,18 @@ class TestRecursiveMakeBackend(BackendTe
 
         backend_path = os.path.join(env.topobjdir, 'backend.mk')
         lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:-1]]
         self.assertEqual(lines[2:5], [
             'XPIDLSRCS += foo.idl',
             'XPIDLSRCS += bar.idl',
             'XPIDLSRCS += biz.idl',
         ])
-        self.assertEqual(lines[5], 'XPIDL_MODULE := module_name')
+        self.assertEqual(lines[5:8], [
+            'XPIDL_FLAGS += -Idir1',
+            'XPIDL_FLAGS += -Idir2',
+            'XPIDL_FLAGS += -Idir3',
+        ])
+        self.assertEqual(lines[8], 'XPIDL_MODULE := module_name')
 
 
 if __name__ == '__main__':
     main()
--- a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
@@ -1,5 +1,6 @@
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
 XPIDL_SOURCES += ['foo.idl', 'bar.idl', 'biz.idl']
 XPIDL_MODULE = 'module_name'
+XPIDL_FLAGS += ['-Idir1', '-Idir2', '-Idir3']
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -116,18 +116,21 @@ class TestEmitterBasic(unittest.TestCase
         reader = self.reader('variable-passthru')
         objs = self.read_topsrcdir(reader)
 
         self.assertEqual(len(objs), 2)
         self.assertIsInstance(objs[0], DirectoryTraversal)
         self.assertIsInstance(objs[1], VariablePassthru)
 
         variables = objs[1].variables
-        self.assertEqual(len(variables), 2)
+        self.assertEqual(len(variables), 3)
         self.assertIn('XPIDLSRCS', variables)
         self.assertEqual(variables['XPIDLSRCS'],
             ['foo.idl', 'bar.idl', 'biz.idl'])
         self.assertIn('XPIDL_MODULE', variables)
         self.assertEqual(variables['XPIDL_MODULE'], 'module_name')
+        self.assertIn('XPIDL_FLAGS', variables)
+        self.assertEqual(variables['XPIDL_FLAGS'],
+            ['-Idir1', '-Idir2', '-Idir3'])
 
 
 if __name__ == '__main__':
     main()