# 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 os import shutil import sys import unittest from contextlib import contextmanager from tempfile import mkdtemp
import buildconfig import mozpack.path as mozpath import six from mozfile import which from mozpack.files import FileFinder from mozunit import main
from mozbuild.backend import get_backend_class from mozbuild.backend.configenvironment import ConfigEnvironment from mozbuild.backend.fastermake import FasterMakeBackend from mozbuild.backend.recursivemake import RecursiveMakeBackend from mozbuild.base import MozbuildObject from mozbuild.dirutils import ensureParentDir from mozbuild.frontend.emitter import TreeMetadataEmitter from mozbuild.frontend.reader import BuildReader
def make_path(): try: return buildconfig.substs["GMAKE"] except KeyError:
fetches_dir = os.environ.get("MOZ_FETCHES_DIR")
extra_search_dirs = () if fetches_dir:
extra_search_dirs = (os.path.join(fetches_dir, "mozmake"),) # Fallback for when running the test without an objdir. for name in ("gmake", "make", "mozmake", "gnumake", "mingw32-make"):
path = which(name, extra_search_dirs=extra_search_dirs) if path: return path
@contextmanager def do_test_backend(self, *backends, **kwargs): # Create the objdir in the srcdir to ensure that they share # the same drive on Windows.
topobjdir = mkdtemp(dir=buildconfig.topsrcdir) try:
config = ConfigEnvironment(buildconfig.topsrcdir, topobjdir, **kwargs)
reader = BuildReader(config)
emitter = TreeMetadataEmitter(config)
moz_build = mozpath.join(config.topsrcdir, "test.mozbuild")
definitions = list(emitter.emit(reader.read_mozbuild(moz_build, config))) for backend in backends:
backend(config).consume(definitions)
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 und die Messung sind noch experimentell.