diff options
author | Matt A. Tobin <email@mattatobin.com> | 2021-10-30 21:06:12 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2021-10-30 21:09:16 -0400 |
commit | 824870f81dc777722d250bfe8c96650763cba32f (patch) | |
tree | f60a931802bd2fb784e23c973094e8221a380fa6 /python | |
parent | f6b93a345707595fdf7b84cbcd4c6cfe8c7d4262 (diff) | |
download | aura-central-824870f81dc777722d250bfe8c96650763cba32f.tar.gz |
Issue %3031 - Remove ChromeMap build-backend
Diffstat (limited to 'python')
-rw-r--r-- | python/mozbuild/mozbuild/backend/__init__.py | 1 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/codecoverage/__init__.py | 0 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/codecoverage/chrome_map.py | 105 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/codecoverage/packager.py | 43 |
4 files changed, 0 insertions, 149 deletions
diff --git a/python/mozbuild/mozbuild/backend/__init__.py b/python/mozbuild/mozbuild/backend/__init__.py index 20b2f6a3a..b280c7f97 100644 --- a/python/mozbuild/mozbuild/backend/__init__.py +++ b/python/mozbuild/mozbuild/backend/__init__.py @@ -3,7 +3,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. backends = { - 'ChromeMap': 'mozbuild.codecoverage.chrome_map', 'CompileDB': 'mozbuild.compilation.database', 'RecursiveMake': 'mozbuild.backend.recursivemake', } diff --git a/python/mozbuild/mozbuild/codecoverage/__init__.py b/python/mozbuild/mozbuild/codecoverage/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/python/mozbuild/mozbuild/codecoverage/__init__.py +++ /dev/null diff --git a/python/mozbuild/mozbuild/codecoverage/chrome_map.py b/python/mozbuild/mozbuild/codecoverage/chrome_map.py deleted file mode 100644 index 81c3c9a07..000000000 --- a/python/mozbuild/mozbuild/codecoverage/chrome_map.py +++ /dev/null @@ -1,105 +0,0 @@ -# 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/. - -from collections import defaultdict -import json -import os -import urlparse - -from mach.config import ConfigSettings -from mach.logging import LoggingManager -from mozbuild.backend.common import CommonBackend -from mozbuild.base import MozbuildObject -from mozbuild.frontend.data import ( - FinalTargetFiles, - FinalTargetPreprocessedFiles, -) -from mozbuild.frontend.data import JARManifest, ChromeManifestEntry -from mozpack.chrome.manifest import ( - Manifest, - ManifestChrome, - ManifestOverride, - ManifestResource, - parse_manifest, -) -import mozpack.path as mozpath - - -class ChromeManifestHandler(object): - def __init__(self): - self.overrides = {} - self.chrome_mapping = defaultdict(set) - - def handle_manifest_entry(self, entry): - format_strings = { - "content": "chrome://%s/content/", - "resource": "resource://%s/", - "locale": "chrome://%s/locale/", - "skin": "chrome://%s/skin/", - } - - if isinstance(entry, (ManifestChrome, ManifestResource)): - if isinstance(entry, ManifestResource): - dest = entry.target - url = urlparse.urlparse(dest) - if not url.scheme: - dest = mozpath.normpath(mozpath.join(entry.base, dest)) - if url.scheme == 'file': - dest = mozpath.normpath(url.path) - else: - dest = mozpath.normpath(entry.path) - - base_uri = format_strings[entry.type] % entry.name - self.chrome_mapping[base_uri].add(dest) - if isinstance(entry, ManifestOverride): - self.overrides[entry.overloaded] = entry.overload - if isinstance(entry, Manifest): - for e in parse_manifest(None, entry.path): - self.handle_manifest_entry(e) - -class ChromeMapBackend(CommonBackend): - def _init(self): - CommonBackend._init(self) - - log_manager = LoggingManager() - self._cmd = MozbuildObject(self.environment.topsrcdir, ConfigSettings(), - log_manager, self.environment.topobjdir) - self._install_mapping = {} - self.manifest_handler = ChromeManifestHandler() - - def consume_object(self, obj): - if isinstance(obj, JARManifest): - self._consume_jar_manifest(obj) - if isinstance(obj, ChromeManifestEntry): - self.manifest_handler.handle_manifest_entry(obj.entry) - if isinstance(obj, (FinalTargetFiles, - FinalTargetPreprocessedFiles)): - self._handle_final_target_files(obj) - return True - - def _handle_final_target_files(self, obj): - for path, files in obj.files.walk(): - for f in files: - dest = mozpath.join(obj.install_target, path, f.target_basename) - is_pp = isinstance(obj, - FinalTargetPreprocessedFiles) - self._install_mapping[dest] = f.full_path, is_pp - - def consume_finished(self): - # Our result has three parts: - # A map from url prefixes to objdir directories: - # { "chrome://mozapps/content/": [ "dist/bin/chrome/toolkit/content/mozapps" ], ... } - # A map of overrides. - # A map from objdir paths to sourcedir paths, and a flag for whether the source was preprocessed: - # { "dist/bin/browser/chrome/browser/content/browser/aboutSessionRestore.js": - # [ "$topsrcdir/browser/components/sessionstore/content/aboutSessionRestore.js", false ], ... } - outputfile = os.path.join(self.environment.topobjdir, 'chrome-map.json') - with self._write_file(outputfile) as fh: - chrome_mapping = self.manifest_handler.chrome_mapping - overrides = self.manifest_handler.overrides - json.dump([ - {k: list(v) for k, v in chrome_mapping.iteritems()}, - overrides, - self._install_mapping, - ], fh, sort_keys=True, indent=2) diff --git a/python/mozbuild/mozbuild/codecoverage/packager.py b/python/mozbuild/mozbuild/codecoverage/packager.py deleted file mode 100644 index 3a4f359f6..000000000 --- a/python/mozbuild/mozbuild/codecoverage/packager.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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/. - -from __future__ import absolute_import, print_function - -import argparse -import sys - -from mozpack.files import FileFinder -from mozpack.copier import Jarrer - -def package_gcno_tree(root, output_file): - # XXX JarWriter doesn't support unicode strings, see bug 1056859 - if isinstance(root, unicode): - root = root.encode('utf-8') - - finder = FileFinder(root) - jarrer = Jarrer(optimize=False) - for p, f in finder.find("**/*.gcno"): - jarrer.add(p, f) - jarrer.copy(output_file) - - -def cli(args=sys.argv[1:]): - parser = argparse.ArgumentParser() - parser.add_argument('-o', '--output-file', - dest='output_file', - help='Path to save packaged data to.') - parser.add_argument('--root', - dest='root', - default=None, - help='Root directory to search from.') - args = parser.parse_args(args) - - if not args.root: - from buildconfig import topobjdir - args.root = topobjdir - - return package_gcno_tree(args.root, args.output_file) - -if __name__ == '__main__': - sys.exit(cli()) |