Bug 1432223 - Add an --all-crates option to mach cargo check, to check all the crates. r?froydnj draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 22 Jan 2018 12:46:29 -0500
changeset 723191 9973901f9322bb0ac2c4d835d77176636858f86b
parent 723190 71885f5d0399430caca4b18340a9b9a9efefa308
child 746792 055938c205938dd7ebdd20476ad9f8499f909cb5
push id96354
push userkgupta@mozilla.com
push dateMon, 22 Jan 2018 17:47:08 +0000
reviewersfroydnj
bugs1432223
milestone59.0a1
Bug 1432223 - Add an --all-crates option to mach cargo check, to check all the crates. r?froydnj MozReview-Commit-ID: 2nst2ctsI6s
python/mozbuild/mozbuild/mach_commands.py
--- 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