Bug 924187 - Deal with interfaces.manifest from the backend. r=mshal

--HG--
extra : rebase_source : 2d2cbc1ebc97496c54aef63de73b00af8126e750
This commit is contained in:
Brian O'Keefe 2015-02-13 08:11:57 -05:00
Родитель af01c0a6a3
Коммит c6ba641724
13 изменённых файлов: 68 добавлений и 39 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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))

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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 += [

Просмотреть файл

@ -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

Просмотреть файл

@ -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)),

Просмотреть файл

@ -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.

Просмотреть файл

@ -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']

Просмотреть файл

@ -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')

Просмотреть файл

@ -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)

Просмотреть файл

@ -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))

Просмотреть файл

@ -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',
]