Add cargo-geckolib and rustc-geckolib commands to mach.

This commit is contained in:
Simon Sapin 2017-04-05 21:50:44 +02:00
parent bf7c044955
commit ca08ff876b
3 changed files with 39 additions and 3 deletions

View file

@ -38,6 +38,24 @@ class MachCommands(CommandBase):
return call(["cargo"] + params, env=self.build_env())
return call(['cargo'] + params, env=self.build_env())
@Command('cargo-geckolib',
description='Run Cargo with the same compiler version and root crate as build-geckolib',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to Cargo")
def cargo_geckolib(self, params):
if not params:
params = []
self.set_use_stable_rust()
env = self.build_env(geckolib=True)
if self.context.topdir == getcwd():
with cd(path.join('ports', 'geckolib')):
return call(["cargo"] + params, env=env)
return call(['cargo'] + params, env=env)
@Command('cargo-update',
description='Same as update-cargo',
category='devenv')
@ -97,6 +115,21 @@ class MachCommands(CommandBase):
params = []
return call(["rustc"] + params, env=self.build_env())
@Command('rustc-geckolib',
description='Run the Rust compiler with the same compiler version and root crate as build-geckolib',
category='devenv')
@CommandArgument(
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to rustc")
def rustc_geckolib(self, params):
if params is None:
params = []
self.set_use_stable_rust()
env = self.build_env(geckolib=True)
return call(["rustc"] + params, env=env)
@Command('rust-root',
description='Print the path to the root of the Rust compiler',
category='devenv')