OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 import os | 6 import os |
7 import json | 7 import json |
8 import sys | 8 import sys |
9 | 9 |
10 import bb_utils | 10 import bb_utils |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 if not clobber_env: | 43 if not clobber_env: |
44 print 'Clobbering due to triggered landmines:' | 44 print 'Clobbering due to triggered landmines:' |
45 with open(landmine_path) as f: | 45 with open(landmine_path) as f: |
46 print f.read() | 46 print f.read() |
47 RunCmd(['rm', '-rf', build_path]) | 47 RunCmd(['rm', '-rf', build_path]) |
48 | 48 |
49 bb_annotations.PrintNamedStep('runhooks') | 49 bb_annotations.PrintNamedStep('runhooks') |
50 RunCmd(['gclient', 'runhooks'], halt_on_failure=True) | 50 RunCmd(['gclient', 'runhooks'], halt_on_failure=True) |
51 | 51 |
52 | 52 |
| 53 def GenerateBuildFiles(options): |
| 54 cmd = [SrcPath('tools', 'mb', 'mb.py'), |
| 55 'gen', |
| 56 '-m', options.build_properties['mastername'], |
| 57 '-b', options.build_properties['buildername'], |
| 58 '//out/%s' % options.target] |
| 59 bb_annotations.PrintNamedStep('generate_build_files') |
| 60 RunCmd(cmd, halt_on_failure=True) |
| 61 |
| 62 |
53 def Compile(options): | 63 def Compile(options): |
54 RunHooks(options.target) | 64 if options.run_mb: |
| 65 os.environ['GYP_CHROMIUM_NO_ACTION'] = '1' |
| 66 RunHooks(options.target) |
| 67 GenerateBuildFiles(options) |
| 68 else: |
| 69 RunHooks(options.target) |
| 70 |
55 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), | 71 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), |
56 '--build-tool=ninja', | 72 '--build-tool=ninja', |
57 '--compiler=goma', | 73 '--compiler=goma', |
58 '--target=%s' % options.target, | 74 '--target=%s' % options.target, |
59 '--goma-dir=%s' % bb_utils.GOMA_DIR] | 75 '--goma-dir=%s' % bb_utils.GOMA_DIR] |
60 bb_annotations.PrintNamedStep('compile') | 76 bb_annotations.PrintNamedStep('compile') |
61 if options.build_targets: | 77 if options.build_targets: |
62 build_targets = options.build_targets.split(',') | 78 build_targets = options.build_targets.split(',') |
63 cmd += ['--build-args', ' '.join(build_targets)] | 79 cmd += ['--build-args', ' '.join(build_targets)] |
64 RunCmd(cmd, halt_on_failure=True, cwd=DIR_BUILD_ROOT) | 80 RunCmd(cmd, halt_on_failure=True, cwd=DIR_BUILD_ROOT) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 def GetHostStepsOptParser(): | 120 def GetHostStepsOptParser(): |
105 parser = bb_utils.GetParser() | 121 parser = bb_utils.GetParser() |
106 parser.add_option('--steps', help='Comma separated list of host tests.') | 122 parser.add_option('--steps', help='Comma separated list of host tests.') |
107 parser.add_option('--build-targets', default='', | 123 parser.add_option('--build-targets', default='', |
108 help='Comma separated list of build targets.') | 124 help='Comma separated list of build targets.') |
109 parser.add_option('--experimental', action='store_true', | 125 parser.add_option('--experimental', action='store_true', |
110 help='Indicate whether to compile experimental targets.') | 126 help='Indicate whether to compile experimental targets.') |
111 parser.add_option('--extra_src', default='', | 127 parser.add_option('--extra_src', default='', |
112 help='Path to extra source file. If this is supplied, ' | 128 help='Path to extra source file. If this is supplied, ' |
113 'bisect script will use it to override default behavior.') | 129 'bisect script will use it to override default behavior.') |
| 130 parser.add_option('--run-mb', action='store_true', |
| 131 help='Use mb to generate build files.') |
114 | 132 |
115 return parser | 133 return parser |
116 | 134 |
117 | 135 |
118 def main(argv): | 136 def main(argv): |
119 parser = GetHostStepsOptParser() | 137 parser = GetHostStepsOptParser() |
120 options, args = parser.parse_args(argv[1:]) | 138 options, args = parser.parse_args(argv[1:]) |
121 if args: | 139 if args: |
122 return sys.exit('Unused args %s' % args) | 140 return sys.exit('Unused args %s' % args) |
123 | 141 |
124 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 142 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
125 setattr(options, 'extra_src', | 143 setattr(options, 'extra_src', |
126 options.factory_properties.get('extra_src', '')) | 144 options.factory_properties.get('extra_src', '')) |
127 | 145 |
128 if options.steps: | 146 if options.steps: |
129 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) | 147 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) |
130 | 148 |
131 | 149 |
132 if __name__ == '__main__': | 150 if __name__ == '__main__': |
133 sys.exit(main(sys.argv)) | 151 sys.exit(main(sys.argv)) |
OLD | NEW |