OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """A tool to build chrome, executed by buildbot. | 6 """A tool to build chrome, executed by buildbot. |
7 | 7 |
8 When this is run, the current directory (cwd) should be the outer build | 8 When this is run, the current directory (cwd) should be the outer build |
9 directory (e.g., chrome-release/build/). | 9 directory (e.g., chrome-release/build/). |
10 | 10 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 # HACK(yyanagisawa): update environment files on |env| update. | 400 # HACK(yyanagisawa): update environment files on |env| update. |
401 # For compiling on Windows, environment in environment files are used. | 401 # For compiling on Windows, environment in environment files are used. |
402 # It means even if enviroment such as GOMA_DISABLED is updated in | 402 # It means even if enviroment such as GOMA_DISABLED is updated in |
403 # compile.py, the update will be ignored. | 403 # compile.py, the update will be ignored. |
404 # We need to update environment files to reflect the update. | 404 # We need to update environment files to reflect the update. |
405 if chromium_utils.IsWindows() and NeedEnvFileUpdateOnWin(env): | 405 if chromium_utils.IsWindows() and NeedEnvFileUpdateOnWin(env): |
406 print 'Updating environment.{x86,x64} files.' | 406 print 'Updating environment.{x86,x64} files.' |
407 UpdateWindowsEnvironment(options.target_output_dir, env) | 407 UpdateWindowsEnvironment(options.target_output_dir, env) |
408 | 408 |
409 if options.clobber: | |
410 print 'Removing %s' % options.target_output_dir | |
411 # Deleting output_dir would also delete all the .ninja files necessary to | |
412 # build. Clobbering should run before runhooks (which creates .ninja | |
413 # files). For now, only delete all non-.ninja files. | |
414 # TODO(thakis): Make "clobber" a step that runs before "runhooks". | |
415 # Once the master has been restarted, remove all clobber handling | |
416 # from compile.py, https://crbug.com/574557 | |
417 build_directory.RmtreeExceptNinjaOrGomaFiles(options.target_output_dir) | |
418 | |
419 command.extend(options.build_args) | 409 command.extend(options.build_args) |
420 command.extend(args) | 410 command.extend(args) |
421 | 411 |
422 maybe_set_official_build_envvars(options, env) | 412 maybe_set_official_build_envvars(options, env) |
423 | 413 |
424 if options.compiler: | 414 if options.compiler: |
425 print 'using', options.compiler | 415 print 'using', options.compiler |
426 | 416 |
427 if options.compiler in ('goma', 'goma-clang'): | 417 if options.compiler in ('goma', 'goma-clang'): |
428 assert options.goma_dir | 418 assert options.goma_dir |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 outdir = 'out_%s' % (options.cros_board,) | 455 outdir = 'out_%s' % (options.cros_board,) |
466 elif options.out_dir: | 456 elif options.out_dir: |
467 outdir = options.out_dir | 457 outdir = options.out_dir |
468 else: | 458 else: |
469 outdir = 'out' | 459 outdir = 'out' |
470 return os.path.abspath(os.path.join(options.src_dir, outdir, options.target)) | 460 return os.path.abspath(os.path.join(options.src_dir, outdir, options.target)) |
471 | 461 |
472 | 462 |
473 def get_parsed_options(): | 463 def get_parsed_options(): |
474 option_parser = optparse.OptionParser() | 464 option_parser = optparse.OptionParser() |
475 option_parser.add_option('--clobber', action='store_true', default=False, | |
476 help='delete the output directory before compiling') | |
477 option_parser.add_option('--target', default='Release', | 465 option_parser.add_option('--target', default='Release', |
478 help='build target (Debug or Release)') | 466 help='build target (Debug or Release)') |
479 option_parser.add_option('--src-dir', default=None, | 467 option_parser.add_option('--src-dir', default=None, |
480 help='path to the root of the source tree') | 468 help='path to the root of the source tree') |
481 option_parser.add_option('--mode', default='dev', | 469 option_parser.add_option('--mode', default='dev', |
482 help='build mode (dev or official) controlling ' | 470 help='build mode (dev or official) controlling ' |
483 'environment variables set during build') | 471 'environment variables set during build') |
484 # TODO(thakis): Remove this, https://crbug.com/622768 | 472 # TODO(thakis): Remove this, https://crbug.com/622768 |
485 option_parser.add_option('--build-tool', default=None, help='ignored') | 473 option_parser.add_option('--build-tool', default=None, help='ignored') |
486 option_parser.add_option('--build-args', action='append', default=[], | 474 option_parser.add_option('--build-args', action='append', default=[], |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 exit_status = main_ninja(options, args, env) | 561 exit_status = main_ninja(options, args, env) |
574 | 562 |
575 # stop goma | 563 # stop goma |
576 goma_teardown(options, env, exit_status, goma_cloudtail) | 564 goma_teardown(options, env, exit_status, goma_cloudtail) |
577 | 565 |
578 return exit_status | 566 return exit_status |
579 | 567 |
580 | 568 |
581 if '__main__' == __name__: | 569 if '__main__' == __name__: |
582 sys.exit(real_main()) | 570 sys.exit(real_main()) |
OLD | NEW |