Bug 1108750 - part 7 - move IPDL unification logic to CommonBackend; r=mshal
After a bunch of tiny changes, we're finally ready to make real progress. We can now move the grouping of the generated IDPL C++ files and the actual writing of the unified files for them into the common build backend. Derivative backends now only have to concern themselves with adding the particular logic that compiling those files requires.
This commit is contained in:
@@ -30,6 +30,10 @@ from ..frontend.data import (
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
from ..util import (
|
||||
group_unified_files,
|
||||
)
|
||||
|
||||
class XPIDLManager(object):
|
||||
"""Helps manage XPCOM IDLs in the context of the build system."""
|
||||
def __init__(self, config):
|
||||
@@ -255,9 +259,16 @@ class CommonBackend(BuildBackend):
|
||||
'%sParent.cpp' % root])
|
||||
return files
|
||||
|
||||
ipdl_cppsrcs = list(itertools.chain(*[files_from(p) for p in sorted_ipdl_sources]))
|
||||
ipdl_dir = mozpath.join(self.environment.topobjdir, 'ipc', 'ipdl')
|
||||
|
||||
self._handle_ipdl_sources(sorted_ipdl_sources, ipdl_cppsrcs)
|
||||
ipdl_cppsrcs = list(itertools.chain(*[files_from(p) for p in sorted_ipdl_sources]))
|
||||
unified_source_mapping = list(group_unified_files(ipdl_cppsrcs,
|
||||
unified_prefix='UnifiedProtocols',
|
||||
unified_suffix='cpp',
|
||||
files_per_unified_file=16))
|
||||
|
||||
self._write_unified_files(unified_source_mapping, ipdl_dir, poison_windows_h=False)
|
||||
self._handle_ipdl_sources(ipdl_dir, sorted_ipdl_sources, unified_source_mapping)
|
||||
|
||||
for config in self._configs:
|
||||
self.backend_input_files.add(config.source)
|
||||
|
||||
@@ -1236,20 +1236,14 @@ INSTALL_TARGETS += %(prefix)s
|
||||
|
||||
self.summary.makefile_out_count += 1
|
||||
|
||||
def _handle_ipdl_sources(self, sorted_ipdl_sources, ipdl_cppsrcs):
|
||||
def _handle_ipdl_sources(self, ipdl_dir, sorted_ipdl_sources,
|
||||
unified_ipdl_cppsrcs_mapping):
|
||||
# Write out a master list of all IPDL source files.
|
||||
ipdl_dir = mozpath.join(self.environment.topobjdir, 'ipc', 'ipdl')
|
||||
mk = Makefile()
|
||||
|
||||
mk.add_statement('ALL_IPDLSRCS := %s' % ' '.join(sorted_ipdl_sources))
|
||||
|
||||
unified_source_mapping = list(group_unified_files(ipdl_cppsrcs,
|
||||
unified_prefix='UnifiedProtocols',
|
||||
unified_suffix='cpp',
|
||||
files_per_unified_file=16))
|
||||
|
||||
self._write_unified_files(unified_source_mapping, ipdl_dir, poison_windows_h=False)
|
||||
self._add_unified_build_rules(mk, unified_source_mapping, ipdl_dir,
|
||||
self._add_unified_build_rules(mk, unified_ipdl_cppsrcs_mapping,
|
||||
unified_files_makefile_variable='CPPSRCS')
|
||||
|
||||
mk.add_statement('IPDLDIRS := %s' % ' '.join(sorted(set(mozpath.dirname(p)
|
||||
|
||||
Reference in New Issue
Block a user