1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/mach_commands.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, # You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +from __future__ import unicode_literals 1.9 + 1.10 +import os 1.11 +import sys 1.12 + 1.13 +from mach.decorators import ( 1.14 + CommandArgument, 1.15 + CommandProvider, 1.16 + Command, 1.17 +) 1.18 + 1.19 +from mozbuild.base import MachCommandBase 1.20 + 1.21 + 1.22 +@CommandProvider 1.23 +class WebIDLProvider(MachCommandBase): 1.24 + @Command('webidl-example', category='misc', 1.25 + description='Generate example files for a WebIDL interface.') 1.26 + @CommandArgument('interface', nargs='+', 1.27 + help='Interface(s) whose examples to generate.') 1.28 + def webidl_example(self, interface): 1.29 + from mozwebidlcodegen import BuildSystemWebIDL 1.30 + 1.31 + manager = self._spawn(BuildSystemWebIDL).manager 1.32 + for i in interface: 1.33 + manager.generate_example_files(i) 1.34 + 1.35 + @Command('webidl-parser-test', category='testing', 1.36 + description='Run WebIDL tests.') 1.37 + @CommandArgument('--verbose', '-v', action='store_true', 1.38 + help='Run tests in verbose mode.') 1.39 + def webidl_test(self, verbose=False): 1.40 + sys.path.insert(0, os.path.join(self.topsrcdir, 'other-licenses', 1.41 + 'ply')) 1.42 + 1.43 + from runtests import run_tests 1.44 + return run_tests(None, verbose=verbose)