OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 # | 6 # |
7 | 7 |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 '-a', arch, | 409 '-a', arch, |
410 '--os', gn_os, | 410 '--os', gn_os, |
411 '-v', | 411 '-v', |
412 ] | 412 ] |
413 process = subprocess.Popen(gn_command) | 413 process = subprocess.Popen(gn_command) |
414 process.wait() | 414 process.wait() |
415 if process.returncode != 0: | 415 if process.returncode != 0: |
416 print ("Tried to run GN, but it failed. Try running it manually: \n\t$ " + | 416 print ("Tried to run GN, but it failed. Try running it manually: \n\t$ " + |
417 ' '.join(gn_command)) | 417 ' '.join(gn_command)) |
418 | 418 |
| 419 |
| 420 def ShouldRunGN(out_dir): |
| 421 return (not os.path.exists(out_dir) or |
| 422 not os.path.isfile(os.path.join(out_dir, 'args.gn'))) |
| 423 |
| 424 |
| 425 def UseGoma(out_dir): |
| 426 args_gn = os.path.join(out_dir, 'args.gn') |
| 427 return 'use_goma = true' in open(args_gn, 'r').read() |
| 428 |
| 429 |
419 def BuildNinjaCommand(options, target, target_os, mode, arch): | 430 def BuildNinjaCommand(options, target, target_os, mode, arch): |
420 out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os) | 431 out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os) |
421 if not os.path.exists(out_dir): | 432 if ShouldRunGN(out_dir): |
422 RunGN(target_os, mode, arch) | 433 RunGN(target_os, mode, arch) |
423 command = ['ninja', '-C', out_dir] | 434 command = ['ninja', '-C', out_dir] |
424 if options.verbose: | 435 if options.verbose: |
425 command += ['-v'] | 436 command += ['-v'] |
| 437 if UseGoma(out_dir): |
| 438 command += ['-j200'] |
426 command += [target] | 439 command += [target] |
427 return command | 440 return command |
428 | 441 |
429 | 442 |
430 filter_xcodebuild_output = False | 443 filter_xcodebuild_output = False |
431 def BuildOneConfig(options, target, target_os, mode, arch, override_tools): | 444 def BuildOneConfig(options, target, target_os, mode, arch, override_tools): |
432 global filter_xcodebuild_output | 445 global filter_xcodebuild_output |
433 start_time = time.time() | 446 start_time = time.time() |
434 args = [] | 447 args = [] |
435 build_config = utils.GetBuildConf(mode, arch, target_os) | 448 build_config = utils.GetBuildConf(mode, arch, target_os) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 else: | 609 else: |
597 if BuildOneConfig(options, target, target_os, | 610 if BuildOneConfig(options, target, target_os, |
598 mode, arch, cross_build) != 0: | 611 mode, arch, cross_build) != 0: |
599 return 1 | 612 return 1 |
600 | 613 |
601 return 0 | 614 return 0 |
602 | 615 |
603 | 616 |
604 if __name__ == '__main__': | 617 if __name__ == '__main__': |
605 sys.exit(Main()) | 618 sys.exit(Main()) |
OLD | NEW |