mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #7232 - vks:print-commands, r=jdm
mach: Print commands if '--verbose' is set Fixes #6363. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7232) <!-- Reviewable:end -->
This commit is contained in:
commit
7f69a2994d
1 changed files with 22 additions and 13 deletions
|
@ -110,6 +110,14 @@ def notify(title, text):
|
||||||
print("[Warning] Could not generate notification! %s" % extra, file=sys.stderr)
|
print("[Warning] Could not generate notification! %s" % extra, file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
|
def call(*args, **kwargs):
|
||||||
|
"""Wrap `subprocess.call`, printing the command if verbose=True."""
|
||||||
|
verbose = kwargs.pop('verbose', False)
|
||||||
|
if verbose:
|
||||||
|
print(' '.join(args[0]))
|
||||||
|
subprocess.call(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@CommandProvider
|
@CommandProvider
|
||||||
class MachCommands(CommandBase):
|
class MachCommands(CommandBase):
|
||||||
@Command('build',
|
@Command('build',
|
||||||
|
@ -187,7 +195,7 @@ class MachCommands(CommandBase):
|
||||||
# Ensure the APK builder submodule has been built first
|
# Ensure the APK builder submodule has been built first
|
||||||
apk_builder_dir = "support/android-rs-glue"
|
apk_builder_dir = "support/android-rs-glue"
|
||||||
with cd(path.join(apk_builder_dir, "apk-builder")):
|
with cd(path.join(apk_builder_dir, "apk-builder")):
|
||||||
subprocess.call(["cargo", "build"], env=self.build_env())
|
call(["cargo", "build"], env=self.build_env(), verbose=verbose)
|
||||||
|
|
||||||
opts += ["--target", "arm-linux-androideabi"]
|
opts += ["--target", "arm-linux-androideabi"]
|
||||||
|
|
||||||
|
@ -212,9 +220,10 @@ class MachCommands(CommandBase):
|
||||||
if jobs is not None:
|
if jobs is not None:
|
||||||
make_cmd += ["-j" + jobs]
|
make_cmd += ["-j" + jobs]
|
||||||
with cd(self.android_support_dir()):
|
with cd(self.android_support_dir()):
|
||||||
status = subprocess.call(
|
status = call(
|
||||||
make_cmd + ["-f", "openssl.makefile"],
|
make_cmd + ["-f", "openssl.makefile"],
|
||||||
env=self.build_env())
|
env=self.build_env(),
|
||||||
|
verbose=verbose)
|
||||||
if status:
|
if status:
|
||||||
return status
|
return status
|
||||||
openssl_dir = path.join(self.android_support_dir(), "openssl-1.0.1k")
|
openssl_dir = path.join(self.android_support_dir(), "openssl-1.0.1k")
|
||||||
|
@ -222,9 +231,9 @@ class MachCommands(CommandBase):
|
||||||
env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include")
|
env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include")
|
||||||
env['OPENSSL_STATIC'] = 'TRUE'
|
env['OPENSSL_STATIC'] = 'TRUE'
|
||||||
|
|
||||||
status = subprocess.call(
|
status = call(
|
||||||
["cargo", "build"] + opts,
|
["cargo", "build"] + opts,
|
||||||
env=env, cwd=self.servo_crate())
|
env=env, cwd=self.servo_crate(), verbose=verbose)
|
||||||
elapsed = time() - build_start
|
elapsed = time() - build_start
|
||||||
|
|
||||||
# Generate Desktop Notification if elapsed-time > some threshold value
|
# Generate Desktop Notification if elapsed-time > some threshold value
|
||||||
|
@ -259,8 +268,8 @@ class MachCommands(CommandBase):
|
||||||
|
|
||||||
build_start = time()
|
build_start = time()
|
||||||
with cd(path.join("ports", "cef")):
|
with cd(path.join("ports", "cef")):
|
||||||
ret = subprocess.call(["cargo", "build"] + opts,
|
ret = call(["cargo", "build"] + opts,
|
||||||
env=self.build_env())
|
env=self.build_env(), verbose=verbose)
|
||||||
elapsed = time() - build_start
|
elapsed = time() - build_start
|
||||||
|
|
||||||
# Generate Desktop Notification if elapsed-time > some threshold value
|
# Generate Desktop Notification if elapsed-time > some threshold value
|
||||||
|
@ -298,7 +307,7 @@ class MachCommands(CommandBase):
|
||||||
env = self.build_env(gonk=True)
|
env = self.build_env(gonk=True)
|
||||||
build_start = time()
|
build_start = time()
|
||||||
with cd(path.join("ports", "gonk")):
|
with cd(path.join("ports", "gonk")):
|
||||||
ret = subprocess.call(["cargo", "build"] + opts, env=env)
|
ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)
|
||||||
elapsed = time() - build_start
|
elapsed = time() - build_start
|
||||||
|
|
||||||
# Generate Desktop Notification if elapsed-time > some threshold value
|
# Generate Desktop Notification if elapsed-time > some threshold value
|
||||||
|
@ -316,16 +325,16 @@ class MachCommands(CommandBase):
|
||||||
help='Number of jobs to run in parallel')
|
help='Number of jobs to run in parallel')
|
||||||
@CommandArgument('--release', default=False, action="store_true",
|
@CommandArgument('--release', default=False, action="store_true",
|
||||||
help="Build tests with release mode")
|
help="Build tests with release mode")
|
||||||
def build_tests(self, jobs=None, release=False):
|
def build_tests(self, jobs=None, verbose=False, release=False):
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
args = ["cargo", "test", "--no-run"]
|
args = ["cargo", "test", "--no-run"]
|
||||||
if is_headless_build():
|
if is_headless_build():
|
||||||
args += ["--no-default-features", "--features", "headless"]
|
args += ["--no-default-features", "--features", "headless"]
|
||||||
if release:
|
if release:
|
||||||
args += ["--release"]
|
args += ["--release"]
|
||||||
return subprocess.call(
|
return call(
|
||||||
args,
|
args,
|
||||||
env=self.build_env(), cwd=self.servo_crate())
|
env=self.build_env(), cwd=self.servo_crate(), verbose=verbose)
|
||||||
|
|
||||||
@Command('clean',
|
@Command('clean',
|
||||||
description='Clean the build directory.',
|
description='Clean the build directory.',
|
||||||
|
@ -347,5 +356,5 @@ class MachCommands(CommandBase):
|
||||||
if verbose:
|
if verbose:
|
||||||
opts += ["-v"]
|
opts += ["-v"]
|
||||||
opts += params
|
opts += params
|
||||||
return subprocess.call(["cargo", "clean"] + opts,
|
return call(["cargo", "clean"] + opts,
|
||||||
env=self.build_env(), cwd=self.servo_crate())
|
env=self.build_env(), cwd=self.servo_crate(), verbose=verbose)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue