Bug 1432223 - Add an --all-crates option to mach cargo check, to check all the crates. r?froydnj
MozReview-Commit-ID: 2nst2ctsI6s
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -270,28 +270,32 @@ class CargoProvider(MachCommandBase):
@Command('cargo', category='build',
description='Invoke cargo in useful ways.')
def cargo(self):
self.parser.print_usage()
return 1
@SubCommand('cargo', 'check',
description='Run `cargo check` on a given crate. Defaults to gkrust.')
+ @CommandArgument('--all-crates', default=None, action='store_true',
+ help='Check all of the crates in the tree.')
@CommandArgument('crates', default=None, nargs='*', help='The crate name(s) to check.')
- def check(self, crates=None):
+ def check(self, all_crates=None, crates=None):
# XXX duplication with `mach vendor rust`
crates_and_roots = {
'gkrust': 'toolkit/library/rust',
'gkrust-gtest': 'toolkit/library/gtest/rust',
'js': 'js/rust',
'mozjs_sys': 'js/src',
'geckodriver': 'testing/geckodriver',
}
- if crates == None or crates == []:
+ if all_crates:
+ crates = crates_and_roots.keys()
+ elif crates == None or crates == []:
crates = ['gkrust']
for crate in crates:
root = crates_and_roots.get(crate, None)
if not root:
print('Cannot locate crate %s. Please check your spelling or '
'add the crate information to the list.' % crate)
return 1