| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """MB - the Meta-Build wrapper around GYP and GN | 6 """MB - the Meta-Build wrapper around GYP and GN |
| 7 | 7 |
| 8 MB is a wrapper script for GYP and GN that can be used to generate build files | 8 MB is a wrapper script for GYP and GN that can be used to generate build files |
| 9 for sets of canned configurations and analyze them. | 9 for sets of canned configurations and analyze them. |
| 10 """ | 10 """ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 subp.add_argument('-f', '--config-file', metavar='PATH', | 58 subp.add_argument('-f', '--config-file', metavar='PATH', |
| 59 default=self.default_config, | 59 default=self.default_config, |
| 60 help='path to config file ' | 60 help='path to config file ' |
| 61 '(default is //tools/mb/mb_config.pyl)') | 61 '(default is //tools/mb/mb_config.pyl)') |
| 62 subp.add_argument('-g', '--goma-dir', default=self.ExpandUser('~/goma'), | 62 subp.add_argument('-g', '--goma-dir', default=self.ExpandUser('~/goma'), |
| 63 help='path to goma directory (default is %(default)s).') | 63 help='path to goma directory (default is %(default)s).') |
| 64 subp.add_argument('-n', '--dryrun', action='store_true', | 64 subp.add_argument('-n', '--dryrun', action='store_true', |
| 65 help='Do a dry run (i.e., do nothing, just print ' | 65 help='Do a dry run (i.e., do nothing, just print ' |
| 66 'the commands that will run)') | 66 'the commands that will run)') |
| 67 subp.add_argument('-q', '--quiet', action='store_true', | 67 subp.add_argument('-q', '--quiet', action='store_true', |
| 68 help='Do not print anything on success, ' | 68 help='Do not print anything, just return an exit ' |
| 69 'just return an exit code.') | 69 'code.') |
| 70 subp.add_argument('-v', '--verbose', action='count', | 70 subp.add_argument('-v', '--verbose', action='count', |
| 71 help='verbose logging (may specify multiple times).') | 71 help='verbose logging (may specify multiple times).') |
| 72 | 72 |
| 73 parser = argparse.ArgumentParser(prog='mb') | 73 parser = argparse.ArgumentParser(prog='mb') |
| 74 subps = parser.add_subparsers() | 74 subps = parser.add_subparsers() |
| 75 | 75 |
| 76 subp = subps.add_parser('analyze', | 76 subp = subps.add_parser('analyze', |
| 77 help='analyze whether changes to a set of files ' | 77 help='analyze whether changes to a set of files ' |
| 78 'will cause a set of binaries to be rebuilt.') | 78 'will cause a set of binaries to be rebuilt.') |
| 79 AddCommonOptions(subp) | 79 AddCommonOptions(subp) |
| 80 subp.add_argument('--swarming-targets-file', |
| 81 help='save runtime dependencies for targets listed ' |
| 82 'in file.') |
| 80 subp.add_argument('path', nargs=1, | 83 subp.add_argument('path', nargs=1, |
| 81 help='path build was generated into.') | 84 help='path build was generated into.') |
| 82 subp.add_argument('input_path', nargs=1, | 85 subp.add_argument('input_path', nargs=1, |
| 83 help='path to a file containing the input arguments ' | 86 help='path to a file containing the input arguments ' |
| 84 'as a JSON object.') | 87 'as a JSON object.') |
| 85 subp.add_argument('output_path', nargs=1, | 88 subp.add_argument('output_path', nargs=1, |
| 86 help='path to a file containing the output arguments ' | 89 help='path to a file containing the output arguments ' |
| 87 'as a JSON object.') | 90 'as a JSON object.') |
| 88 subp.set_defaults(func=self.CmdAnalyze) | 91 subp.set_defaults(func=self.CmdAnalyze) |
| 89 | 92 |
| 90 subp = subps.add_parser('gen', | 93 subp = subps.add_parser('gen', |
| 91 help='generate a new set of build files') | 94 help='generate a new set of build files') |
| 92 AddCommonOptions(subp) | 95 AddCommonOptions(subp) |
| 93 subp.add_argument('--swarming-targets-file', | 96 subp.add_argument('--swarming-targets-file', |
| 94 help='save runtime dependencies for targets listed ' | 97 help='save runtime dependencies for targets listed ' |
| 95 'in file.') | 98 'in file.') |
| 96 subp.add_argument('path', nargs=1, | 99 subp.add_argument('path', nargs=1, |
| 97 help='path to generate build into') | 100 help='path to generate build into') |
| 98 subp.set_defaults(func=self.CmdGen) | 101 subp.set_defaults(func=self.CmdGen) |
| 99 | 102 |
| 100 subp = subps.add_parser('lookup', | 103 subp = subps.add_parser('lookup', |
| 101 help='look up the command for a given config or ' | 104 help='look up the command for a given config or ' |
| 102 'builder') | 105 'builder') |
| 103 AddCommonOptions(subp) | 106 AddCommonOptions(subp) |
| 104 subp.set_defaults(func=self.CmdLookup) | 107 subp.set_defaults(func=self.CmdLookup) |
| 105 | 108 |
| 106 subp = subps.add_parser('validate', | 109 subp = subps.add_parser('validate', |
| 107 help='validate the config file') | 110 help='validate the config file') |
| 108 subp.add_argument('-f', '--config-file', metavar='PATH', | 111 AddCommonOptions(subp) |
| 109 default=self.default_config, | |
| 110 help='path to config file ' | |
| 111 '(default is //tools/mb/mb_config.pyl)') | |
| 112 subp.add_argument('-q', '--quiet', action='store_true', | |
| 113 help='Do not print anything on success, ' | |
| 114 'just return an exit code.') | |
| 115 subp.set_defaults(func=self.CmdValidate) | 112 subp.set_defaults(func=self.CmdValidate) |
| 116 | 113 |
| 117 subp = subps.add_parser('help', | 114 subp = subps.add_parser('help', |
| 118 help='Get help on a subcommand.') | 115 help='Get help on a subcommand.') |
| 119 subp.add_argument(nargs='?', action='store', dest='subcommand', | 116 subp.add_argument(nargs='?', action='store', dest='subcommand', |
| 120 help='The command to get help for.') | 117 help='The command to get help for.') |
| 121 subp.set_defaults(func=self.CmdHelp) | 118 subp.set_defaults(func=self.CmdHelp) |
| 122 | 119 |
| 123 self.args = parser.parse_args(argv) | 120 self.args = parser.parse_args(argv) |
| 124 | 121 |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 | 732 |
| 736 if __name__ == '__main__': | 733 if __name__ == '__main__': |
| 737 try: | 734 try: |
| 738 sys.exit(main(sys.argv[1:])) | 735 sys.exit(main(sys.argv[1:])) |
| 739 except MBErr as e: | 736 except MBErr as e: |
| 740 print(e) | 737 print(e) |
| 741 sys.exit(1) | 738 sys.exit(1) |
| 742 except KeyboardInterrupt: | 739 except KeyboardInterrupt: |
| 743 print("interrupted, exiting", stream=sys.stderr) | 740 print("interrupted, exiting", stream=sys.stderr) |
| 744 sys.exit(130) | 741 sys.exit(130) |
| OLD | NEW |