Bug 951352 - Disallow XPIDL_MODULE if XPIDL_SOURCES isn't defined; r=glandium
authorGregory Szorc <gps@mozilla.com>
Tue, 17 Dec 2013 12:45:56 -0800
changeset 161457 e4fcb5a4ebae28f0730267681f3d8d201b9b8314
parent 161456 2b7739306a76180cd3cd787adc626b656f8d3917
child 161458 f2abdcd247446cd1d517155f7af426e8deb5e7de
push id37915
push usergszorc@mozilla.com
push dateFri, 20 Dec 2013 18:09:29 +0000
treeherdermozilla-inbound@e4fcb5a4ebae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs951352, 939044
milestone29.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 951352 - Disallow XPIDL_MODULE if XPIDL_SOURCES isn't defined; r=glandium Once upon a time XPIDL_MODULE and MODULE were kind of the same and MODULE got mass-converted into XPIDL_MODULE with the removal of MODULE in bug 939044. Unfortunately, we forgot to add a check for XPIDL_MODULE being defined if XPIDL_SOURCES isn't (a build config that makes no sense and only results in cargo culting). This patch corrects that oversight.
dom/browser-element/moz.build
dom/cellbroadcast/src/moz.build
dom/devicestorage/moz.build
dom/promise/moz.build
dom/speakermanager/moz.build
dom/wappush/interfaces/moz.build
netwerk/protocol/rtsp/moz.build
netwerk/sctp/datachannel/moz.build
netwerk/sctp/src/moz.build
netwerk/srtp/src/moz.build
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/test/frontend/data/xpidl-module-no-sources/moz.build
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/dom/browser-element/moz.build
+++ b/dom/browser-element/moz.build
@@ -1,18 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
 TEST_DIRS += ['mochitest']
 
-XPIDL_MODULE = 'dom_browserelement'
-
 EXPORTS.mozilla += [
     'BrowserElementParent.h',
 ]
 
 SOURCES += [
     'BrowserElementParent.cpp',
 ]
 
--- a/dom/cellbroadcast/src/moz.build
+++ b/dom/cellbroadcast/src/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
-XPIDL_MODULE = 'dom_cellbroadcast'
-
 EXPORTS.mozilla.dom += [
     'CellBroadcast.h',
 ]
 
 SOURCES += [
     'CellBroadcast.cpp',
 ]
 
--- a/dom/devicestorage/moz.build
+++ b/dom/devicestorage/moz.build
@@ -1,18 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
 TEST_DIRS += ['test', 'ipc']
 
-XPIDL_MODULE = 'dom_devicestorage'
-
 EXPORTS += [
     'DeviceStorage.h',
     'nsDeviceStorage.h',
 ]
 
 EXPORTS.mozilla.dom.devicestorage += [
     'DeviceStorageRequestChild.h',
     'DeviceStorageRequestParent.h',
--- a/dom/promise/moz.build
+++ b/dom/promise/moz.build
@@ -1,18 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
 TEST_DIRS += ['tests']
 
-XPIDL_MODULE = 'dom_promise'
-
 EXPORTS.mozilla.dom += [
     'Promise.h',
     'PromiseNativeHandler.h'
 ]
 
 SOURCES += [
     'Promise.cpp',
     'PromiseCallback.cpp',
--- a/dom/speakermanager/moz.build
+++ b/dom/speakermanager/moz.build
@@ -1,18 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
 MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
-XPIDL_MODULE = 'dom_speakermanager'
-
 EXPORTS += [
     'SpeakerManager.h',
     'SpeakerManagerService.h',
     'SpeakerManagerServiceChild.h',
 ]
 
 SOURCES += [
     'SpeakerManager.cpp',
--- a/dom/wappush/interfaces/moz.build
+++ b/dom/wappush/interfaces/moz.build
@@ -1,10 +1,5 @@
 # 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/.
 
-XPIDL_SOURCES += [
-]
-
-XPIDL_MODULE = 'dom_wappush'
-
--- a/netwerk/protocol/rtsp/moz.build
+++ b/netwerk/protocol/rtsp/moz.build
@@ -1,15 +1,13 @@
 # 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/.
 
-XPIDL_MODULE = 'necko_rtsp'
-
 EXPORTS.mozilla.net += [
     'controller/RtspController.h',
     'controller/RtspControllerChild.h',
     'controller/RtspControllerParent.h',
     'controller/RtspMetaData.h',
     'rtsp/RTSPSource.h',
     'RtspChannel.h',
     'RtspHandler.h',
--- a/netwerk/sctp/datachannel/moz.build
+++ b/netwerk/sctp/datachannel/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
-XPIDL_MODULE = 'necko_datachan'
-
 EXPORTS.mozilla.net += [
     'DataChannel.h',
     'DataChannelListener.h',
     'DataChannelProtocol.h'
 ]
 
 SOURCES += [
     'DataChannel.cpp',
--- a/netwerk/sctp/src/moz.build
+++ b/netwerk/sctp/src/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
-XPIDL_MODULE = 'necko_sctp'
-
 EXPORTS.mozilla.net += [
     'usrsctp.h',
 ]
 
 SOURCES += [
     'netinet/sctp_asconf.c',
     'netinet/sctp_auth.c',
     'netinet/sctp_bsd_addr.c',
--- a/netwerk/srtp/src/moz.build
+++ b/netwerk/srtp/src/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # 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/.
 
-XPIDL_MODULE = 'necko_srtp'
-
 UNIFIED_SOURCES += [
     'crypto/cipher/aes.c',
     'crypto/cipher/aes_cbc.c',
     'crypto/cipher/aes_icm.c',
     'crypto/cipher/cipher.c',
     'crypto/cipher/null_cipher.c',
     'crypto/hash/auth.c',
     'crypto/hash/hmac.c',
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -179,16 +179,20 @@ class TreeMetadataEmitter(LoggingMixin):
         # together into a final .xpt, which has the name defined by
         # XPIDL_MODULE.
         xpidl_module = sandbox['XPIDL_MODULE']
 
         if sandbox['XPIDL_SOURCES'] and not xpidl_module:
             raise SandboxValidationError('XPIDL_MODULE must be defined if '
                 'XPIDL_SOURCES is defined.')
 
+        if xpidl_module and not sandbox['XPIDL_SOURCES']:
+            raise SandboxValidationError('XPIDL_MODULE cannot be defined '
+                'unless there are XPIDL_SOURCES: %s' % sandbox['RELATIVEDIR'])
+
         if sandbox['XPIDL_SOURCES'] and sandbox['NO_DIST_INSTALL']:
             self.log(logging.WARN, 'mozbuild_warning', dict(
                 path=sandbox.main_path),
                 '{path}: NO_DIST_INSTALL has no effect on XPIDL_SOURCES.')
 
         for idl in sandbox['XPIDL_SOURCES']:
             yield XPIDLFile(sandbox, mozpath.join(sandbox['SRCDIR'], idl),
                 xpidl_module)
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/test/frontend/data/xpidl-module-no-sources/moz.build
@@ -0,0 +1,5 @@
+# -*- 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/
+
+XPIDL_MODULE = 'xpidl_module'
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -422,11 +422,18 @@ class TestEmitterBasic(unittest.TestCase
             self.assertIsInstance(obj, JARManifest)
             self.assertTrue(os.path.isabs(obj.path))
 
     def test_jar_manifests_multiple_files(self):
         with self.assertRaisesRegexp(SandboxValidationError, 'limited to one value'):
             reader = self.reader('jar-manifests-multiple-files')
             self.read_topsrcdir(reader)
 
+    def test_xpidl_module_no_sources(self):
+        """XPIDL_MODULE without XPIDL_SOURCES should be rejected."""
+        with self.assertRaisesRegexp(SandboxValidationError, 'XPIDL_MODULE '
+            'cannot be defined'):
+            reader = self.reader('xpidl-module-no-sources')
+            self.read_topsrcdir(reader)
+
 
 if __name__ == '__main__':
     main()