|
1 # This Source Code Form is subject to the terms of the Mozilla Public |
|
2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 # file, # You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 |
|
5 from __future__ import unicode_literals |
|
6 |
|
7 import os |
|
8 import sys |
|
9 |
|
10 from mach.decorators import ( |
|
11 CommandArgument, |
|
12 CommandProvider, |
|
13 Command, |
|
14 ) |
|
15 |
|
16 from mozbuild.base import MachCommandBase |
|
17 |
|
18 |
|
19 @CommandProvider |
|
20 class WebIDLProvider(MachCommandBase): |
|
21 @Command('webidl-example', category='misc', |
|
22 description='Generate example files for a WebIDL interface.') |
|
23 @CommandArgument('interface', nargs='+', |
|
24 help='Interface(s) whose examples to generate.') |
|
25 def webidl_example(self, interface): |
|
26 from mozwebidlcodegen import BuildSystemWebIDL |
|
27 |
|
28 manager = self._spawn(BuildSystemWebIDL).manager |
|
29 for i in interface: |
|
30 manager.generate_example_files(i) |
|
31 |
|
32 @Command('webidl-parser-test', category='testing', |
|
33 description='Run WebIDL tests.') |
|
34 @CommandArgument('--verbose', '-v', action='store_true', |
|
35 help='Run tests in verbose mode.') |
|
36 def webidl_test(self, verbose=False): |
|
37 sys.path.insert(0, os.path.join(self.topsrcdir, 'other-licenses', |
|
38 'ply')) |
|
39 |
|
40 from runtests import run_tests |
|
41 return run_tests(None, verbose=verbose) |