aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/post_build_commands.py
blob: 276a772c7875528ddd1faf29c1969f378ba8432d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import print_function, unicode_literals

import json
import os
import os.path as path
import shutil
import subprocess
import sys
import tarfile
from time import time
import urllib

from mach.registrar import Registrar
from mach.decorators import (
    CommandArgument,
    CommandProvider,
    Command,
)

from servo.command_base import CommandBase

@CommandProvider
class MachCommands(CommandBase):
    @Command('run',
             description='Run Servo',
             category='post-build',
             allow_all_args=True)
    @CommandArgument('params', default=None, nargs='...',
                     help="Command-line arguments to be passed through to Servo")
    def run(self, params):
        subprocess.check_call([path.join("target", "servo")] + params,
                              env=self.build_env())

    @Command('doc',
             description='Generate documentation',
             category='post-build',
             allow_all_args=True)
    @CommandArgument('params', default=None, nargs='...',
                     help="Command-line arguments to be passed through to cargo doc")
    def doc(self, params):
        self.ensure_bootstrapped()
        return subprocess.call(["cargo", "doc"] + params,
                               env=self.build_env())