Bug 1349640 - Upload a mapping for headers in dist/include for the benefit of code coverage builds. r=mshal

MozReview-Commit-ID: 5q9I5S1QOt9

--HG--
extra : rebase_source : e893e9b2ea1ef2cbfe1cfd8e92af71e79f1615a2
This commit is contained in:
Chris Manchester 2017-03-29 11:43:16 -07:00
Родитель ca45875a78
Коммит 4ada59b662
1 изменённых файлов: 39 добавлений и 4 удалений

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

@ -6,11 +6,37 @@ from __future__ import absolute_import, print_function
import argparse
import sys
import json
import buildconfig
from mozpack.files import FileFinder
from mozpack.copier import Jarrer
from mozpack.copier import Jarrer, FileRegistry
from mozpack.files import FileFinder, GeneratedFile
from mozpack.manifests import (
InstallManifest,
UnreadableInstallManifest,
)
import mozpack.path as mozpath
def package_gcno_tree(root, output_file):
def describe_install_manifest(manifest, dest_dir):
try:
manifest = InstallManifest(manifest)
except UnreadableInstallManifest:
raise IOError(errno.EINVAL, 'Error parsing manifest file', manifest)
reg = FileRegistry()
mapping = {}
manifest.populate_registry(reg)
for dest_file, src in reg:
if hasattr(src, 'path'):
dest_path = mozpath.join(dest_dir, dest_file)
relsrc_path = mozpath.relpath(src.path, buildconfig.topsrcdir)
mapping[dest_path] = relsrc_path
return mapping
def package_coverage_data(root, output_file):
# XXX JarWriter doesn't support unicode strings, see bug 1056859
if isinstance(root, unicode):
root = root.encode('utf-8')
@ -19,6 +45,15 @@ def package_gcno_tree(root, output_file):
jarrer = Jarrer(optimize=False)
for p, f in finder.find("**/*.gcno"):
jarrer.add(p, f)
dist_include_manifest = mozpath.join(buildconfig.topobjdir,
'_build_manifests',
'install',
'dist_include')
linked_files = describe_install_manifest(dist_include_manifest,
'dist/include')
mapping_file = GeneratedFile(json.dumps(linked_files, sort_keys=True))
jarrer.add('linked-files-map.json', mapping_file)
jarrer.copy(output_file)
@ -37,7 +72,7 @@ def cli(args=sys.argv[1:]):
from buildconfig import topobjdir
args.root = topobjdir
return package_gcno_tree(args.root, args.output_file)
return package_coverage_data(args.root, args.output_file)
if __name__ == '__main__':
sys.exit(cli())