зеркало из https://github.com/mozilla/gecko-dev.git
bug 1384568 - Write a generated-sources.json. r=gps
Capture the list of generated source files derived from moz.build data and save it in a generated-sources.json in the objdir so that we can upload generated source files for use in crash reports and when debugging release builds. MozReview-Commit-ID: FrHcyFo0rBF --HG-- extra : rebase_source : 09a5a38d22430e9a2c8121ddc8d47fabdd3be705
This commit is contained in:
Родитель
3ad4c3d247
Коммит
8bb1b7ab57
|
@ -14,6 +14,7 @@ from mozbuild.backend.base import BuildBackend
|
||||||
|
|
||||||
from mozbuild.frontend.context import (
|
from mozbuild.frontend.context import (
|
||||||
Context,
|
Context,
|
||||||
|
ObjDirPath,
|
||||||
Path,
|
Path,
|
||||||
RenamedSourcePath,
|
RenamedSourcePath,
|
||||||
VARIABLES,
|
VARIABLES,
|
||||||
|
@ -23,10 +24,12 @@ from mozbuild.frontend.data import (
|
||||||
ChromeManifestEntry,
|
ChromeManifestEntry,
|
||||||
ConfigFileSubstitution,
|
ConfigFileSubstitution,
|
||||||
ExampleWebIDLInterface,
|
ExampleWebIDLInterface,
|
||||||
|
Exports,
|
||||||
IPDLFile,
|
IPDLFile,
|
||||||
FinalTargetPreprocessedFiles,
|
FinalTargetPreprocessedFiles,
|
||||||
FinalTargetFiles,
|
FinalTargetFiles,
|
||||||
GeneratedEventWebIDLFile,
|
GeneratedEventWebIDLFile,
|
||||||
|
GeneratedSources,
|
||||||
GeneratedWebIDLFile,
|
GeneratedWebIDLFile,
|
||||||
PreprocessedTestWebIDLFile,
|
PreprocessedTestWebIDLFile,
|
||||||
PreprocessedWebIDLFile,
|
PreprocessedWebIDLFile,
|
||||||
|
@ -179,6 +182,7 @@ class CommonBackend(BuildBackend):
|
||||||
self._binaries = BinariesCollection()
|
self._binaries = BinariesCollection()
|
||||||
self._configs = set()
|
self._configs = set()
|
||||||
self._ipdl_sources = set()
|
self._ipdl_sources = set()
|
||||||
|
self._generated_sources = set()
|
||||||
|
|
||||||
def consume_object(self, obj):
|
def consume_object(self, obj):
|
||||||
self._configs.add(obj.config)
|
self._configs.add(obj.config)
|
||||||
|
@ -277,6 +281,16 @@ class CommonBackend(BuildBackend):
|
||||||
self._binaries.shared_libraries.append(obj)
|
self._binaries.shared_libraries.append(obj)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
elif isinstance(obj, GeneratedSources):
|
||||||
|
self._handle_generated_sources(obj.files)
|
||||||
|
return False
|
||||||
|
|
||||||
|
elif isinstance(obj, Exports):
|
||||||
|
objdir_files = [f.full_path for path, files in obj.files.walk() for f in files if isinstance(f, ObjDirPath)]
|
||||||
|
if objdir_files:
|
||||||
|
self._handle_generated_sources(objdir_files)
|
||||||
|
return False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -285,6 +299,7 @@ class CommonBackend(BuildBackend):
|
||||||
def consume_finished(self):
|
def consume_finished(self):
|
||||||
if len(self._idl_manager.idls):
|
if len(self._idl_manager.idls):
|
||||||
self._handle_idl_manager(self._idl_manager)
|
self._handle_idl_manager(self._idl_manager)
|
||||||
|
self._handle_generated_sources(mozpath.join(self.environment.topobjdir, 'dist/include/%s.h' % idl['root']) for idl in self._idl_manager.idls.values())
|
||||||
|
|
||||||
self._handle_webidl_collection(self._webidls)
|
self._handle_webidl_collection(self._webidls)
|
||||||
|
|
||||||
|
@ -305,6 +320,7 @@ class CommonBackend(BuildBackend):
|
||||||
ipdl_dir = mozpath.join(self.environment.topobjdir, 'ipc', 'ipdl')
|
ipdl_dir = mozpath.join(self.environment.topobjdir, 'ipc', 'ipdl')
|
||||||
|
|
||||||
ipdl_cppsrcs = list(itertools.chain(*[files_from(p) for p in sorted_ipdl_sources]))
|
ipdl_cppsrcs = list(itertools.chain(*[files_from(p) for p in sorted_ipdl_sources]))
|
||||||
|
self._handle_generated_sources(mozpath.join(ipdl_dir, f) for f in ipdl_cppsrcs)
|
||||||
unified_source_mapping = list(group_unified_files(ipdl_cppsrcs,
|
unified_source_mapping = list(group_unified_files(ipdl_cppsrcs,
|
||||||
unified_prefix='UnifiedProtocols',
|
unified_prefix='UnifiedProtocols',
|
||||||
unified_suffix='cpp',
|
unified_suffix='cpp',
|
||||||
|
@ -325,6 +341,16 @@ class CommonBackend(BuildBackend):
|
||||||
}
|
}
|
||||||
json.dump(d, fh, sort_keys=True, indent=4)
|
json.dump(d, fh, sort_keys=True, indent=4)
|
||||||
|
|
||||||
|
# Write out a file listing generated sources.
|
||||||
|
with self._write_file(mozpath.join(topobjdir, 'generated-sources.json')) as fh:
|
||||||
|
d = {
|
||||||
|
'sources': sorted(self._generated_sources),
|
||||||
|
}
|
||||||
|
json.dump(d, fh, sort_keys=True, indent=4)
|
||||||
|
|
||||||
|
def _handle_generated_sources(self, files):
|
||||||
|
self._generated_sources.update(mozpath.relpath(f, self.environment.topobjdir) for f in files)
|
||||||
|
|
||||||
def _handle_webidl_collection(self, webidls):
|
def _handle_webidl_collection(self, webidls):
|
||||||
if not webidls.all_stems():
|
if not webidls.all_stems():
|
||||||
return
|
return
|
||||||
|
@ -358,7 +384,7 @@ class CommonBackend(BuildBackend):
|
||||||
self.environment.topobjdir,
|
self.environment.topobjdir,
|
||||||
mozpath.join(self.environment.topobjdir, 'dist')
|
mozpath.join(self.environment.topobjdir, 'dist')
|
||||||
)
|
)
|
||||||
|
self._handle_generated_sources(manager.expected_build_output_files())
|
||||||
# Bindings are compiled in unified mode to speed up compilation and
|
# Bindings are compiled in unified mode to speed up compilation and
|
||||||
# to reduce linker memory size. Note that test bindings are separated
|
# to reduce linker memory size. Note that test bindings are separated
|
||||||
# from regular ones so tests bindings aren't shipped.
|
# from regular ones so tests bindings aren't shipped.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче