| 76 | |
| 77 | |
| 78 | class MetaBuildWrapper(): |
| 79 | def __init__(self): |
| 80 | self.chromium_src_dir = CHROMIUM_SRC_DIR |
| 81 | self.default_config = os.path.join(self.chromium_src_dir, 'infra', 'mb', |
| 82 | 'mb_config.pyl') |
| 83 | self.default_isolate_map = os.path.join(self.chromium_src_dir, 'infra', |
| 84 | 'mb', 'gn_isolate_map.pyl') |
| 85 | self.executable = sys.executable |
| 86 | self.platform = sys.platform |
| 87 | self.sep = os.sep |
| 88 | self.args = argparse.Namespace() |
| 89 | self.configs = {} |
| 90 | self.luci_tryservers = {} |
| 91 | self.builder_groups = {} |
| 92 | self.mixins = {} |
| 93 | self.isolate_exe = 'isolate.exe' if self.platform.startswith( |
| 94 | 'win') else 'isolate' |
| 95 | |
| 96 | def Main(self, args): |
| 97 | self.ParseArgs(args) |
| 98 | try: |
| 99 | ret = self.args.func() |
| 100 | if ret: |
| 101 | self.DumpInputFiles() |
| 102 | return ret |
| 103 | except KeyboardInterrupt: |
| 104 | self.Print('interrupted, exiting') |
| 105 | return 130 |
| 106 | except Exception: |
| 107 | self.DumpInputFiles() |
| 108 | s = traceback.format_exc() |
| 109 | for l in s.splitlines(): |
| 110 | self.Print(l) |
| 111 | return 1 |
| 112 | |
| 113 | def ParseArgs(self, argv): |
| 114 | def AddCommonOptions(subp): |
| 115 | subp.add_argument('-b', '--builder', |
| 116 | help='builder name to look up config from') |
| 117 | subp.add_argument( |
| 118 | '-m', '--builder-group', |
| 119 | help='builder group name to look up config from') |
| 120 | subp.add_argument('-c', '--config', |
| 121 | help='configuration to analyze') |
| 122 | subp.add_argument('--phase', |
| 123 | help='optional phase name (used when builders ' |
| 124 | 'do multiple compiles with different ' |
| 125 | 'arguments in a single build)') |
| 126 | subp.add_argument('-f', '--config-file', metavar='PATH', |
| 127 | default=self.default_config, |
| 128 | help='path to config file ' |
| 129 | '(default is %(default)s)') |
| 130 | subp.add_argument( |
| 131 | '-i', |
| 132 | '--isolate-map-file', |
| 133 | metavar='PATH', |
| 134 | help='path to isolate map file ' |
| 135 | '(default is %(default)s)', |