зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1478124: Part 4a - Add XPCOM_MANIFESTS moz.build variable for XPCOM component manifests. r=froydnj
This aggregates a list of all static component manifests in the tree, and writes them out to a `manifests-lists.json` file, which is read by the codegen scripts in the next patch. It slightly abuses the IDL lists machinery, given that these aren't technically IDL files. But the semantics are similar enough that it seemed like the best option. Differential Revision: https://phabricator.services.mozilla.com/D15034 --HG-- extra : rebase_source : f1e1e1c9497ab8c18c25a106316a1af57237b99f extra : source : f500020a273a27c66bf2166505a0e97bbc34a214
This commit is contained in:
Родитель
b1c722249d
Коммит
cc171935f4
|
@ -42,6 +42,7 @@ from mozbuild.frontend.data import (
|
|||
StaticLibrary,
|
||||
UnifiedSources,
|
||||
XPIDLModule,
|
||||
XPCOMComponentManifests,
|
||||
WebIDLCollection,
|
||||
)
|
||||
from mozbuild.jar import (
|
||||
|
@ -148,6 +149,9 @@ class CommonBackend(BuildBackend):
|
|||
list(sorted(obj.all_regular_sources())),
|
||||
obj.unified_source_mapping)
|
||||
|
||||
elif isinstance(obj, XPCOMComponentManifests):
|
||||
self._handle_xpcom_collection(obj)
|
||||
|
||||
elif isinstance(obj, UnifiedSources):
|
||||
# Unified sources aren't relevant to artifact builds.
|
||||
if self.environment.is_artifact_build:
|
||||
|
@ -369,6 +373,20 @@ class CommonBackend(BuildBackend):
|
|||
manager.expected_build_output_files(),
|
||||
manager.GLOBAL_DEFINE_FILES)
|
||||
|
||||
def _handle_xpcom_collection(self, manifests):
|
||||
components_dir = mozpath.join(manifests.topobjdir,
|
||||
'xpcom', 'components')
|
||||
|
||||
# The code generators read their configuration from this file, so it
|
||||
# needs to be written early.
|
||||
o = dict(
|
||||
manifests=sorted(manifests.all_sources()),
|
||||
)
|
||||
|
||||
conf_file = mozpath.join(components_dir, 'manifest-lists.json')
|
||||
with self._write_file(conf_file) as fh:
|
||||
json.dump(o, fh, sort_keys=True, indent=2)
|
||||
|
||||
def _write_unified_file(self, unified_file, source_filenames,
|
||||
output_directory, poison_windows_h=False):
|
||||
with self._write_file(mozpath.join(output_directory, unified_file)) as f:
|
||||
|
|
|
@ -1766,6 +1766,13 @@ VARIABLES = {
|
|||
as ``MODULE``.
|
||||
"""),
|
||||
|
||||
'XPCOM_MANIFESTS': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
|
||||
"""XPCOM Component Manifest Files.
|
||||
|
||||
This is a list of files that define XPCOM components to be added
|
||||
to the component registry.
|
||||
"""),
|
||||
|
||||
'PREPROCESSED_IPDL_SOURCES': (StrictOrderingOnAppendList, list,
|
||||
"""Preprocessed IPDL source files.
|
||||
|
||||
|
|
|
@ -373,6 +373,20 @@ class IPDLCollection(ContextDerived):
|
|||
return sorted(set(p for p, _ in self.unified_source_mapping))
|
||||
|
||||
|
||||
class XPCOMComponentManifests(ContextDerived):
|
||||
"""Collects XPCOM manifest files during the build."""
|
||||
|
||||
def __init__(self, context):
|
||||
ContextDerived.__init__(self, context)
|
||||
self.manifests = set()
|
||||
|
||||
def all_sources(self):
|
||||
return self.manifests
|
||||
|
||||
def all_source_files(self):
|
||||
return []
|
||||
|
||||
|
||||
class LinkageWrongKindError(Exception):
|
||||
"""Error thrown when trying to link objects of the wrong kind"""
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ from .data import (
|
|||
TestManifest,
|
||||
UnifiedSources,
|
||||
VariablePassthru,
|
||||
XPCOMComponentManifests,
|
||||
XPIDLModule,
|
||||
)
|
||||
from mozpack.chrome.manifest import (
|
||||
|
@ -213,12 +214,17 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
('IPDL_SOURCES', lambda c: c.sources),
|
||||
('PREPROCESSED_IPDL_SOURCES', lambda c: c.preprocessed_sources),
|
||||
]
|
||||
xpcom_attrs = [
|
||||
('XPCOM_MANIFESTS', lambda c: c.manifests),
|
||||
]
|
||||
|
||||
idl_sources = {}
|
||||
for root, cls, attrs in ((self.config.substs.get('WEBIDL_ROOT'),
|
||||
WebIDLCollection, webidl_attrs),
|
||||
(self.config.substs.get('IPDL_ROOT'),
|
||||
IPDLCollection, ipdl_attrs)):
|
||||
IPDLCollection, ipdl_attrs),
|
||||
(self.config.substs.get('XPCOM_ROOT'),
|
||||
XPCOMComponentManifests, xpcom_attrs)):
|
||||
if root:
|
||||
collection = cls(contexts[root])
|
||||
for var, src_getter in attrs:
|
||||
|
@ -1164,6 +1170,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
'WEBIDL_FILES',
|
||||
'IPDL_SOURCES',
|
||||
'PREPROCESSED_IPDL_SOURCES',
|
||||
'XPCOM_MANIFESTS',
|
||||
)
|
||||
for context_var in idl_vars:
|
||||
for name in context.get(context_var, []):
|
||||
|
|
|
@ -1077,10 +1077,13 @@ with only_when('--enable-compile-environment'):
|
|||
def idl_roots(build_env):
|
||||
return namespace(ipdl_root=os.path.join(build_env.topobjdir, 'ipc', 'ipdl'),
|
||||
webidl_root=os.path.join(build_env.topobjdir,
|
||||
'dom', 'bindings'))
|
||||
'dom', 'bindings'),
|
||||
xpcom_root=os.path.join(build_env.topobjdir,
|
||||
'xpcom', 'components'))
|
||||
|
||||
set_config('WEBIDL_ROOT', idl_roots.webidl_root)
|
||||
set_config('IPDL_ROOT', idl_roots.ipdl_root)
|
||||
set_config('XPCOM_ROOT', idl_roots.xpcom_root)
|
||||
|
||||
# Proxy bypass protection
|
||||
# ==============================================================
|
||||
|
|
Загрузка…
Ссылка в новой задаче