mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Added a mach command for cargo update
As proposed in #3736 Example usage: ``` sh $ ./mach update-cargo -p rust-xml . Updating git repository `https://github.com/netvl/rust-xml` ports/cef Updating git repository `https://github.com/netvl/rust-xml` ports/android/glut_app Updating git repository `https://github.com/netvl/rust-xml` ```
This commit is contained in:
parent
7eeec45a4e
commit
3a43abfa35
1 changed files with 20 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
from os import path
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ from mach.decorators import (
|
||||||
Command,
|
Command,
|
||||||
)
|
)
|
||||||
|
|
||||||
from servo.command_base import CommandBase
|
from servo.command_base import CommandBase, cd
|
||||||
|
|
||||||
|
|
||||||
@CommandProvider
|
@CommandProvider
|
||||||
|
@ -24,6 +25,24 @@ class MachCommands(CommandBase):
|
||||||
return subprocess.call(["cargo"] + params,
|
return subprocess.call(["cargo"] + params,
|
||||||
env=self.build_env())
|
env=self.build_env())
|
||||||
|
|
||||||
|
@Command('update-cargo',
|
||||||
|
description='Update Cargo dependencies',
|
||||||
|
category='devenv',
|
||||||
|
allow_all_args=True)
|
||||||
|
@CommandArgument(
|
||||||
|
'params', default=None, nargs='...',
|
||||||
|
help='Command-line arguments to be passed through to cargo update')
|
||||||
|
def update_cargo(self, params):
|
||||||
|
cargo_paths = [path.join('.'),
|
||||||
|
path.join('ports', 'cef'),
|
||||||
|
path.join('ports', 'android', 'glut_app')]
|
||||||
|
|
||||||
|
for cargo_path in cargo_paths:
|
||||||
|
with cd(cargo_path):
|
||||||
|
print(cargo_path)
|
||||||
|
subprocess.call(["cargo", "update"] + params,
|
||||||
|
env=self.build_env())
|
||||||
|
|
||||||
@Command('rustc',
|
@Command('rustc',
|
||||||
description='Run the Rust compiler',
|
description='Run the Rust compiler',
|
||||||
category='devenv',
|
category='devenv',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue