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 | |
63 def Compile(options): | 53 def Compile(options): |
64 if options.run_mb: | 54 RunHooks(options.target) |
65 os.environ['GYP_CHROMIUM_NO_ACTION'] = '1' | |
66 RunHooks(options.target) | |
67 GenerateBuildFiles(options) | |
68 else: | |
69 RunHooks(options.target) | |
70 | |
71 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), | 55 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), |
72 '--build-tool=ninja', | 56 '--build-tool=ninja', |
73 '--compiler=goma', | 57 '--compiler=goma', |
74 '--target=%s' % options.target, | 58 '--target=%s' % options.target, |
75 '--goma-dir=%s' % bb_utils.GOMA_DIR] | 59 '--goma-dir=%s' % bb_utils.GOMA_DIR] |
76 bb_annotations.PrintNamedStep('compile') | 60 bb_annotations.PrintNamedStep('compile') |
77 if options.build_targets: | 61 if options.build_targets: |
78 build_targets = options.build_targets.split(',') | 62 build_targets = options.build_targets.split(',') |
79 cmd += ['--build-args', ' '.join(build_targets)] | 63 cmd += ['--build-args', ' '.join(build_targets)] |
80 RunCmd(cmd, halt_on_failure=True, cwd=DIR_BUILD_ROOT) | 64 RunCmd(cmd, halt_on_failure=True, cwd=DIR_BUILD_ROOT) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 def GetHostStepsOptParser(): | 104 def GetHostStepsOptParser(): |
121 parser = bb_utils.GetParser() | 105 parser = bb_utils.GetParser() |
122 parser.add_option('--steps', help='Comma separated list of host tests.') | 106 parser.add_option('--steps', help='Comma separated list of host tests.') |
123 parser.add_option('--build-targets', default='', | 107 parser.add_option('--build-targets', default='', |
124 help='Comma separated list of build targets.') | 108 help='Comma separated list of build targets.') |
125 parser.add_option('--experimental', action='store_true', | 109 parser.add_option('--experimental', action='store_true', |
126 help='Indicate whether to compile experimental targets.') | 110 help='Indicate whether to compile experimental targets.') |
127 parser.add_option('--extra_src', default='', | 111 parser.add_option('--extra_src', default='', |
128 help='Path to extra source file. If this is supplied, ' | 112 help='Path to extra source file. If this is supplied, ' |
129 'bisect script will use it to override default behavior.') | 113 '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.') | |
132 | 114 |
133 return parser | 115 return parser |
134 | 116 |
135 | 117 |
136 def main(argv): | 118 def main(argv): |
137 parser = GetHostStepsOptParser() | 119 parser = GetHostStepsOptParser() |
138 options, args = parser.parse_args(argv[1:]) | 120 options, args = parser.parse_args(argv[1:]) |
139 if args: | 121 if args: |
140 return sys.exit('Unused args %s' % args) | 122 return sys.exit('Unused args %s' % args) |
141 | 123 |
142 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 124 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
143 setattr(options, 'extra_src', | 125 setattr(options, 'extra_src', |
144 options.factory_properties.get('extra_src', '')) | 126 options.factory_properties.get('extra_src', '')) |
145 | 127 |
146 if options.steps: | 128 if options.steps: |
147 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) | 129 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) |
148 | 130 |
149 | 131 |
150 if __name__ == '__main__': | 132 if __name__ == '__main__': |
151 sys.exit(main(sys.argv)) | 133 sys.exit(main(sys.argv)) |
OLD | NEW |