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, just return an exit ' | 68 help='Do not print anything on success, ' |
69 'code.') | 69 'just return an exit 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.') | |
83 subp.add_argument('path', nargs=1, | 80 subp.add_argument('path', nargs=1, |
84 help='path build was generated into.') | 81 help='path build was generated into.') |
85 subp.add_argument('input_path', nargs=1, | 82 subp.add_argument('input_path', nargs=1, |
86 help='path to a file containing the input arguments ' | 83 help='path to a file containing the input arguments ' |
87 'as a JSON object.') | 84 'as a JSON object.') |
88 subp.add_argument('output_path', nargs=1, | 85 subp.add_argument('output_path', nargs=1, |
89 help='path to a file containing the output arguments ' | 86 help='path to a file containing the output arguments ' |
90 'as a JSON object.') | 87 'as a JSON object.') |
91 subp.set_defaults(func=self.CmdAnalyze) | 88 subp.set_defaults(func=self.CmdAnalyze) |
92 | 89 |
93 subp = subps.add_parser('gen', | 90 subp = subps.add_parser('gen', |
94 help='generate a new set of build files') | 91 help='generate a new set of build files') |
95 AddCommonOptions(subp) | 92 AddCommonOptions(subp) |
96 subp.add_argument('--swarming-targets-file', | 93 subp.add_argument('--swarming-targets-file', |
97 help='save runtime dependencies for targets listed ' | 94 help='save runtime dependencies for targets listed ' |
98 'in file.') | 95 'in file.') |
99 subp.add_argument('path', nargs=1, | 96 subp.add_argument('path', nargs=1, |
100 help='path to generate build into') | 97 help='path to generate build into') |
101 subp.set_defaults(func=self.CmdGen) | 98 subp.set_defaults(func=self.CmdGen) |
102 | 99 |
103 subp = subps.add_parser('lookup', | 100 subp = subps.add_parser('lookup', |
104 help='look up the command for a given config or ' | 101 help='look up the command for a given config or ' |
105 'builder') | 102 'builder') |
106 AddCommonOptions(subp) | 103 AddCommonOptions(subp) |
107 subp.set_defaults(func=self.CmdLookup) | 104 subp.set_defaults(func=self.CmdLookup) |
108 | 105 |
109 subp = subps.add_parser('validate', | 106 subp = subps.add_parser('validate', |
110 help='validate the config file') | 107 help='validate the config file') |
111 AddCommonOptions(subp) | 108 subp.add_argument('-f', '--config-file', metavar='PATH', |
| 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.') |
112 subp.set_defaults(func=self.CmdValidate) | 115 subp.set_defaults(func=self.CmdValidate) |
113 | 116 |
114 subp = subps.add_parser('help', | 117 subp = subps.add_parser('help', |
115 help='Get help on a subcommand.') | 118 help='Get help on a subcommand.') |
116 subp.add_argument(nargs='?', action='store', dest='subcommand', | 119 subp.add_argument(nargs='?', action='store', dest='subcommand', |
117 help='The command to get help for.') | 120 help='The command to get help for.') |
118 subp.set_defaults(func=self.CmdHelp) | 121 subp.set_defaults(func=self.CmdHelp) |
119 | 122 |
120 self.args = parser.parse_args(argv) | 123 self.args = parser.parse_args(argv) |
121 | 124 |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 | 735 |
733 if __name__ == '__main__': | 736 if __name__ == '__main__': |
734 try: | 737 try: |
735 sys.exit(main(sys.argv[1:])) | 738 sys.exit(main(sys.argv[1:])) |
736 except MBErr as e: | 739 except MBErr as e: |
737 print(e) | 740 print(e) |
738 sys.exit(1) | 741 sys.exit(1) |
739 except KeyboardInterrupt: | 742 except KeyboardInterrupt: |
740 print("interrupted, exiting", stream=sys.stderr) | 743 print("interrupted, exiting", stream=sys.stderr) |
741 sys.exit(130) | 744 sys.exit(130) |
OLD | NEW |