Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: tools/gn/bootstrap/bootstrap.py

Issue 1415343008: GN bootstrap fixes: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« build/config/features.gni ('K') | « build/config/features.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Bootstraps gn. 6 """Bootstraps gn.
7 7
8 It is done by first building it manually in a temporary directory, then building 8 It is done by first building it manually in a temporary directory, then building
9 it with its own BUILD.gn to the final destination. 9 it with its own BUILD.gn to the final destination.
10 """ 10 """
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) 76 parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
77 parser.add_option('-d', '--debug', action='store_true', 77 parser.add_option('-d', '--debug', action='store_true',
78 help='Do a debug build. Defaults to release build.') 78 help='Do a debug build. Defaults to release build.')
79 parser.add_option('-o', '--output', 79 parser.add_option('-o', '--output',
80 help='place output in PATH', metavar='PATH') 80 help='place output in PATH', metavar='PATH')
81 parser.add_option('-s', '--no-rebuild', action='store_true', 81 parser.add_option('-s', '--no-rebuild', action='store_true',
82 help='Do not rebuild GN with GN.') 82 help='Do not rebuild GN with GN.')
83 parser.add_option('--no-clean', action='store_true', 83 parser.add_option('--no-clean', action='store_true',
84 help='Re-used build directory instead of using new ' 84 help='Re-used build directory instead of using new '
85 'temporary location each time') 85 'temporary location each time')
86 parser.add_option('--gn-gen-args', help='Args to pass to gn gen --args')
86 parser.add_option('-v', '--verbose', action='store_true', 87 parser.add_option('-v', '--verbose', action='store_true',
87 help='Log more details') 88 help='Log more details')
88 options, args = parser.parse_args(argv) 89 options, args = parser.parse_args(argv)
89 90
90 if args: 91 if args:
91 parser.error('Unrecognized command line arguments: %s.' % ', '.join(args)) 92 parser.error('Unrecognized command line arguments: %s.' % ', '.join(args))
92 93
93 logging.basicConfig(level=logging.DEBUG if options.verbose else logging.ERROR) 94 logging.basicConfig(level=logging.DEBUG if options.verbose else logging.ERROR)
94 95
95 try: 96 try:
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 'base/task_runner.cc', 228 'base/task_runner.cc',
228 'base/third_party/dmg_fp/dtoa_wrapper.cc', 229 'base/third_party/dmg_fp/dtoa_wrapper.cc',
229 'base/third_party/dmg_fp/g_fmt.cc', 230 'base/third_party/dmg_fp/g_fmt.cc',
230 'base/third_party/icu/icu_utf.cc', 231 'base/third_party/icu/icu_utf.cc',
231 'base/third_party/nspr/prtime.cc', 232 'base/third_party/nspr/prtime.cc',
232 'base/thread_task_runner_handle.cc', 233 'base/thread_task_runner_handle.cc',
233 'base/threading/non_thread_safe_impl.cc', 234 'base/threading/non_thread_safe_impl.cc',
234 'base/threading/post_task_and_reply_impl.cc', 235 'base/threading/post_task_and_reply_impl.cc',
235 'base/threading/sequenced_worker_pool.cc', 236 'base/threading/sequenced_worker_pool.cc',
236 'base/threading/simple_thread.cc', 237 'base/threading/simple_thread.cc',
238 'base/threading/thread.cc',
237 'base/threading/thread_checker_impl.cc', 239 'base/threading/thread_checker_impl.cc',
238 'base/threading/thread_collision_warner.cc', 240 'base/threading/thread_collision_warner.cc',
239 'base/threading/thread_id_name_manager.cc', 241 'base/threading/thread_id_name_manager.cc',
240 'base/threading/thread_local_storage.cc', 242 'base/threading/thread_local_storage.cc',
241 'base/threading/thread_restrictions.cc', 243 'base/threading/thread_restrictions.cc',
242 'base/threading/worker_pool.cc', 244 'base/threading/worker_pool.cc',
243 'base/time/time.cc', 245 'base/time/time.cc',
244 'base/timer/elapsed_timer.cc', 246 'base/timer/elapsed_timer.cc',
245 'base/timer/timer.cc', 247 'base/timer/timer.cc',
246 'base/trace_event/memory_allocator_dump.cc', 248 'base/trace_event/memory_allocator_dump.cc',
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 else: 430 else:
429 ninja_lines.append(' ld = $ldxx') 431 ninja_lines.append(' ld = $ldxx')
430 432
431 ninja_lines.append('') # Make sure the file ends with a newline. 433 ninja_lines.append('') # Make sure the file ends with a newline.
432 434
433 with open(path, 'w') as f: 435 with open(path, 'w') as f:
434 f.write(ninja_template + '\n'.join(ninja_lines)) 436 f.write(ninja_template + '\n'.join(ninja_lines))
435 437
436 438
437 def build_gn_with_gn(temp_gn, build_dir, options): 439 def build_gn_with_gn(temp_gn, build_dir, options):
438 cmd = [temp_gn, 'gen', build_dir] 440 gn_gen_args = options.gn_gen_args or ''
439 if not options.debug: 441 if not options.debug:
440 cmd.append('--args=is_debug=false') 442 gn_gen_args += ' is_debug=false'
443 cmd = [temp_gn, 'gen', build_dir, '--args=%s' % gn_gen_args]
441 check_call(cmd) 444 check_call(cmd)
442 445
443 cmd = ['ninja', '-C', build_dir] 446 cmd = ['ninja', '-C', build_dir]
444 if options.verbose: 447 if options.verbose:
445 cmd.append('-v') 448 cmd.append('-v')
446 cmd.append('gn') 449 cmd.append('gn')
447 check_call(cmd) 450 check_call(cmd)
448 451
449 if not options.debug: 452 if not options.debug:
450 check_call(['strip', os.path.join(build_dir, 'gn')]) 453 check_call(['strip', os.path.join(build_dir, 'gn')])
451 454
452 455
453 if __name__ == '__main__': 456 if __name__ == '__main__':
454 sys.exit(main(sys.argv[1:])) 457 sys.exit(main(sys.argv[1:]))
OLDNEW
« build/config/features.gni ('K') | « build/config/features.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698