michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, # You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: from __future__ import unicode_literals michael@0: michael@0: import os michael@0: import sys michael@0: michael@0: from mach.decorators import ( michael@0: CommandArgument, michael@0: CommandProvider, michael@0: Command, michael@0: ) michael@0: michael@0: from mozbuild.base import MachCommandBase michael@0: michael@0: michael@0: @CommandProvider michael@0: class WebIDLProvider(MachCommandBase): michael@0: @Command('webidl-example', category='misc', michael@0: description='Generate example files for a WebIDL interface.') michael@0: @CommandArgument('interface', nargs='+', michael@0: help='Interface(s) whose examples to generate.') michael@0: def webidl_example(self, interface): michael@0: from mozwebidlcodegen import BuildSystemWebIDL michael@0: michael@0: manager = self._spawn(BuildSystemWebIDL).manager michael@0: for i in interface: michael@0: manager.generate_example_files(i) michael@0: michael@0: @Command('webidl-parser-test', category='testing', michael@0: description='Run WebIDL tests.') michael@0: @CommandArgument('--verbose', '-v', action='store_true', michael@0: help='Run tests in verbose mode.') michael@0: def webidl_test(self, verbose=False): michael@0: sys.path.insert(0, os.path.join(self.topsrcdir, 'other-licenses', michael@0: 'ply')) michael@0: michael@0: from runtests import run_tests michael@0: return run_tests(None, verbose=verbose)