build/gen_test_backend.py
author Manish Goregaokar <manishearth@gmail.com>
Sun, 12 Feb 2017 16:02:29 -0800
changeset 343718 7943ca5e483ab2865df343e0529d5217c3aced1b
parent 343052 b4344af7fc7c68032a1468798882bbcc9f73a227
child 346543 2324b5d27792b17e19afe42d70c224deb52565aa
permissions -rw-r--r--
Bug 1338936 - Part 1: stylo: Add stubbed-out ServoSpecifiedValues interface, use it for pres attr mapping; r=bz,emilio MozReview-Commit-ID: 6wg32flypt7

# 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 sys

from mozbuild.backend.test_manifest import TestManifestBackend
from mozbuild.base import BuildEnvironmentNotFoundException, MozbuildObject
from mozbuild.frontend.emitter import TreeMetadataEmitter
from mozbuild.frontend.reader import BuildReader, EmptyConfig


def gen_test_backend():
    build_obj = MozbuildObject.from_environment()
    try:
        config = build_obj.config_environment
    except BuildEnvironmentNotFoundException:
        print("No build detected, test metadata may be incomplete.")
        config = EmptyConfig(build_obj.topsrcdir)
        config.topobjdir = build_obj.topobjdir

    reader = BuildReader(config)
    emitter = TreeMetadataEmitter(config)
    backend = TestManifestBackend(config)

    context = reader.read_topsrcdir()
    data = emitter.emit(context, emitfn=emitter._process_test_manifests)
    backend.consume(data)


if __name__ == '__main__':
    sys.exit(gen_test_backend())