diff --git a/Makefile.in b/Makefile.in index f208edc90606..64ef038576eb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -21,7 +21,7 @@ endif include $(topsrcdir)/config/config.mk -GARBAGE_DIRS += dist _javagen _profile staticlib +GARBAGE_DIRS += _javagen _profile staticlib DIST_GARBAGE = config.cache config.log config.status* config-defs.h \ config/autoconf.mk \ mozilla-config.h \ @@ -141,10 +141,10 @@ install-tests: install-_tests include $(topsrcdir)/build/moz-automation.mk -# _tests should be purged during cleaning. However, we don't want it purged -# during PGO builds because it contains some auto-generated files. +# dist and _tests should be purged during cleaning. However, we don't want them +# purged during PGO builds because they contain some auto-generated files. ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),) -GARBAGE_DIRS += _tests +GARBAGE_DIRS += dist _tests endif # Windows PGO builds don't perform a clean before the 2nd pass. So, we want diff --git a/config/makefiles/xpidl/Makefile.in b/config/makefiles/xpidl/Makefile.in index f63c59735e19..d0b2a981c6ac 100644 --- a/config/makefiles/xpidl/Makefile.in +++ b/config/makefiles/xpidl/Makefile.in @@ -43,6 +43,16 @@ endif $(dist_include_dir) $(@D) $(idl_deps_dir) $(libxul_sdk_includes) \ $(basename $(notdir $@)) $($(basename $(notdir $@))_deps) +# Chrome manifests may be written from several Makefiles at various times during +# the build. The 'buildlist' action adds to the file if it already exists, but +# if it does exist, make considers it to be up-to-date (as we have no inputs to +# depend on). We use FORCE to ensure that we always add the interface manifest, +# whether or not the chrome manifest already exists. +%/chrome.manifest: FORCE + $(call py_action,buildlist,$@ 'manifest components/interfaces.manifest') + +chrome_manifests := @chrome_manifests@ + xpidl_modules := @xpidl_modules@ xpt_files := @xpt_files@ @@ -52,7 +62,7 @@ depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp) GARBAGE += $(xpt_files) $(depends_files) -xpidl:: $(xpt_files) +xpidl:: $(xpt_files) $(chrome_manifests) $(xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir)) diff --git a/config/rules.mk b/config/rules.mk index ee09ab22ac36..a3b76d320984 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -1167,21 +1167,6 @@ INSTALL_TARGETS += AUTOCFG_JS_EXPORTS endif endif -################################################################################ -# Install a linked .xpt into the appropriate place. -# This should ideally be performed by the non-recursive idl make file. Some day. -ifdef XPT_NAME #{ - -ifndef NO_DIST_INSTALL -ifndef NO_INTERFACES_MANIFEST -export:: $(call mkdir_deps,$(FINAL_TARGET)/components) - $(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest 'interfaces $(XPT_NAME)') - $(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/interfaces.manifest') -endif -endif - -endif #} XPT_NAME - ################################################################################ # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components ifdef EXTRA_COMPONENTS diff --git a/netwerk/test/httpserver/Makefile.in b/netwerk/test/httpserver/Makefile.in deleted file mode 100644 index 14ddfc0a275c..000000000000 --- a/netwerk/test/httpserver/Makefile.in +++ /dev/null @@ -1,7 +0,0 @@ -# vim: noexpandtab ts=8 sw=8 -# -# 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/. - -NO_INTERFACES_MANIFEST = 1 diff --git a/netwerk/test/httpserver/moz.build b/netwerk/test/httpserver/moz.build index 747f1f9698a5..c822fbeb5561 100644 --- a/netwerk/test/httpserver/moz.build +++ b/netwerk/test/httpserver/moz.build @@ -10,6 +10,9 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'test_necko' +# Don't add our test-only .xpt files to the normal manifests +XPIDL_NO_MANIFEST = True + XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini'] EXTRA_COMPONENTS += [ diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py index f76c68ddd7b0..87162d9ed245 100644 --- a/python/mozbuild/mozbuild/backend/common.py +++ b/python/mozbuild/mozbuild/backend/common.py @@ -45,29 +45,39 @@ class XPIDLManager(object): self.idls = {} self.modules = {} + self.interface_manifests = {} + self.chrome_manifests = set() - def register_idl(self, source, module, install_target, allow_existing=False): + def register_idl(self, idl, allow_existing=False): """Registers an IDL file with this instance. The IDL file will be built, installed, etc. """ - basename = mozpath.basename(source) + basename = mozpath.basename(idl.source_path) root = mozpath.splitext(basename)[0] + xpt = '%s.xpt' % idl.module + manifest = mozpath.join(idl.install_target, 'components', 'interfaces.manifest') + chrome_manifest = mozpath.join(idl.install_target, 'chrome.manifest') entry = { - 'source': source, - 'module': module, + 'source': idl.source_path, + 'module': idl.module, 'basename': basename, 'root': root, + 'manifest': manifest, } if not allow_existing and entry['basename'] in self.idls: raise Exception('IDL already registered: %s' % entry['basename']) self.idls[entry['basename']] = entry - t = self.modules.setdefault(entry['module'], (install_target, set())) + t = self.modules.setdefault(entry['module'], (idl.install_target, set())) t[1].add(entry['root']) + if idl.add_to_manifest: + self.interface_manifests.setdefault(manifest, set()).add(xpt) + self.chrome_manifests.add(chrome_manifest) + class WebIDLCollection(object): """Collects WebIDL info referenced during the build.""" @@ -190,8 +200,7 @@ class CommonBackend(BuildBackend): topsrcdir=obj.topsrcdir) elif isinstance(obj, XPIDLFile): - self._idl_manager.register_idl(obj.source_path, obj.module, - obj.install_target) + self._idl_manager.register_idl(obj) elif isinstance(obj, ConfigFileSubstitution): # Do not handle ConfigFileSubstitution for Makefiles. Leave that diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index c7dbacc6b6e4..f0e79c85eeec 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -102,6 +102,7 @@ MOZBUILD_VARIABLES = [ 'MODULE', 'NO_DIST_INSTALL', 'NO_EXPAND_LIBS', + 'NO_INTERFACES_MANIFEST', 'NO_JS_MANIFEST', 'OS_LIBS', 'PARALLEL_DIRS', @@ -1072,6 +1073,22 @@ INSTALL_TARGETS += %(prefix)s rules = StringIO() mk.dump(rules, removal_guard=False) + # Write out manifests defining interfaces + dist_dir = mozpath.join(self.environment.topobjdir, 'dist') + for manifest, entries in manager.interface_manifests.items(): + path = mozpath.join(self.environment.topobjdir, manifest) + with self._write_file(path) as fh: + for xpt in sorted(entries): + fh.write('interfaces %s\n' % xpt) + + if install_target.startswith('dist/'): + path = mozpath.relpath(path, dist_dir) + prefix, subpath = path.split('/', 1) + key = 'dist_%s' % prefix + self._install_manifests[key].add_optional_exists(subpath) + + chrome_manifests = [mozpath.join('$(DEPTH)', m) for m in sorted(manager.chrome_manifests)] + # Create dependency for output header so we force regeneration if the # header was deleted. This ideally should not be necessary. However, # some processes (such as PGO at the time this was implemented) wipe @@ -1086,6 +1103,7 @@ INSTALL_TARGETS += %(prefix)s obj.topobjdir = self.environment.topobjdir obj.config = self.environment self._create_makefile(obj, extra=dict( + chrome_manifests = ' '.join(chrome_manifests), xpidl_rules=rules.getvalue(), xpidl_modules=' '.join(xpt_modules), xpt_files=' '.join(sorted(xpt_files)), diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 1c81a75fa1f4..46d862d6f89e 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -1147,6 +1147,14 @@ VARIABLES = { as ``MODULE``. """, None), + 'XPIDL_NO_MANIFEST': (bool, bool, + """Indicate that the XPIDL module should not be added to a manifest. + + This flag exists primarily to prevent test-only XPIDL modules from being + added to the application's chrome manifest. Most XPIDL modules should + not use this flag. + """, None), + 'IPDL_SOURCES': (StrictOrderingOnAppendList, list, """IPDL source files. diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index 20ce75d08867..15195d5572a0 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -160,17 +160,19 @@ class XPIDLFile(ContextDerived): """Describes an XPIDL file to be compiled.""" __slots__ = ( + 'add_to_manifest', 'basename', 'install_target', 'source_path', ) - def __init__(self, context, source, module): + def __init__(self, context, source, module, add_to_manifest): ContextDerived.__init__(self, context) self.source_path = source self.basename = mozpath.basename(source) self.module = module + self.add_to_manifest = add_to_manifest self.install_target = context['FINAL_TARGET'] diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 90ed30885cd7..e2e3f229f02c 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -814,7 +814,7 @@ class TreeMetadataEmitter(LoggingMixin): for idl in context['XPIDL_SOURCES']: yield XPIDLFile(context, mozpath.join(context.srcdir, idl), - xpidl_module) + xpidl_module, add_to_manifest=not context['XPIDL_NO_MANIFEST']) def _process_generated_files(self, context): generated_files = context.get('GENERATED_FILES') diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index c28821f11e81..b5fa64b02e6f 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -497,6 +497,7 @@ class TestRecursiveMakeBackend(BackendTester): m = InstallManifest(path=os.path.join(install_dir, 'dist_bin')) self.assertIn('components/my_module.xpt', m) + self.assertIn('components/interfaces.manifest', m) m = InstallManifest(path=mozpath.join(install_dir, 'dist_include')) self.assertIn('foo.h', m) diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in index 4b99cf23433f..bafc8e7ff9ed 100644 --- a/xpcom/tests/Makefile.in +++ b/xpcom/tests/Makefile.in @@ -5,9 +5,6 @@ # Make sure we have symbols in case we need to debug these. MOZ_DEBUG_SYMBOLS = 1 -# Don't add our test-only .xpt files to the normal manifests -NO_INTERFACES_MANIFEST = 1 - include $(topsrcdir)/config/rules.mk ifneq (,$(SIMPLE_PROGRAMS)) diff --git a/xpcom/tests/moz.build b/xpcom/tests/moz.build index 899566a22c34..5d9367d1ee4c 100644 --- a/xpcom/tests/moz.build +++ b/xpcom/tests/moz.build @@ -101,6 +101,9 @@ XPIDL_SOURCES += [ 'NotXPCOMTest.idl', ] +# Don't add our test-only .xpt files to the normal manifests +XPIDL_NO_MANIFEST = True + LOCAL_INCLUDES += [ '../ds', ]