# 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/.
import json import os import re
import mozpack.path as mozpath import six from mach.config import ConfigSettings from mach.logging import LoggingManager from mozpack.copier import FileRegistry from mozpack.files import PreprocessedFile from mozpack.manifests import InstallManifest
from mozbuild.backend.common import CommonBackend from mozbuild.base import MozbuildObject from mozbuild.frontend.data import (
ChromeManifestEntry,
FinalTargetFiles,
FinalTargetPreprocessedFiles,
JARManifest,
)
from .manifest_handler import ChromeManifestHandler
for count, line in enumerate(fh): # Regex are quite slow, so bail out early. ifnot line.startswith("//@line"): continue
m = re.match(_line_comment_re, line) if m: if this_section:
finish_section(count + 1)
inc_start, inc_source = m.groups()
# Special case to handle $SRCDIR prefixes
src_dir_prefix = "$SRCDIR"
parts = mozpath.split(inc_source) if parts[0] == src_dir_prefix:
inc_source = mozpath.join(*parts[1:]) else:
inc_source = mozpath.relpath(inc_source, topsrcdir)
# This build backend is assuming the build to have happened already, as it is parsing # built preprocessed files to generate data to map them to the original sources.
class ChromeMapBackend(CommonBackend): def _init(self):
CommonBackend._init(self)
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) returnTrue
def _handle_final_target_files(self, obj): for path, files in obj.files.walk(): for f in files: if isinstance(obj, FinalTargetPreprocessedFiles):
basename = FinalTargetPreprocessedFiles.get_obj_basename(f) else:
basename = f.target_basename
dest = mozpath.join(obj.install_target, path, basename)
obj_path = mozpath.join(self.environment.topobjdir, dest)
if isinstance(obj, FinalTargetPreprocessedFiles): assert os.path.exists(obj_path), "%s should exist" % obj_path
pp_info = generate_pp_info(obj_path, obj.topsrcdir) else:
pp_info = None
base = (
obj.topobjdir if f.full_path.startswith(obj.topobjdir) else obj.topsrcdir
)
self._install_mapping[dest] = (
mozpath.relpath(f.full_path, base),
pp_info,
)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.