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 """Entry point for both build and try bots | 6 """Entry point for both build and try bots |
7 | 7 |
8 This script is invoked from XXX, usually without arguments | 8 This script is invoked from XXX, usually without arguments |
9 to package an SDK. It automatically determines whether | 9 to package an SDK. It automatically determines whether |
10 this SDK is for mac, win, linux. | 10 this SDK is for mac, win, linux. |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 'multithreaded_input_events', | 421 'multithreaded_input_events', |
422 'pi_generator', | 422 'pi_generator', |
423 'pong', | 423 'pong', |
424 'sine_synth', | 424 'sine_synth', |
425 'tumbler', | 425 'tumbler', |
426 'websocket', | 426 'websocket', |
427 'dlopen', | 427 'dlopen', |
428 ] | 428 ] |
429 | 429 |
430 LIBRARY_LIST = [ | 430 LIBRARY_LIST = [ |
431 'pthread', | 431 'nacl_mounts', |
noelallen1
2012/07/27 00:29:40
The LIBRARY_LIST specifies the build order. Since
binji
2012/07/27 18:16:39
Ah, I see now. I thought it just looked nicer sort
| |
432 'ppapi', | 432 'ppapi', |
433 'ppapi_cpp', | 433 'ppapi_cpp', |
434 'ppapi_gles2', | 434 'ppapi_gles2', |
435 'pthread', | |
435 ] | 436 ] |
436 | 437 |
437 LIB_DICT = { | 438 LIB_DICT = { |
438 'linux': [], | 439 'linux': [], |
439 'mac': [], | 440 'mac': [], |
440 'win': ['x86_32'] | 441 'win': ['x86_32'] |
441 } | 442 } |
442 | 443 |
443 def BuildStepCopyExamples(pepperdir, toolchains): | 444 def BuildStepCopyExamples(pepperdir, toolchains, build_experimental): |
444 buildbot_common.BuildStep('Copy examples') | 445 buildbot_common.BuildStep('Copy examples') |
445 | 446 |
446 if not os.path.exists(os.path.join(pepperdir, 'tools')): | 447 if not os.path.exists(os.path.join(pepperdir, 'tools')): |
447 buildbot_common.ErrorExit('Examples depend on missing tools.') | 448 buildbot_common.ErrorExit('Examples depend on missing tools.') |
448 if not os.path.exists(os.path.join(pepperdir, 'toolchain')): | 449 if not os.path.exists(os.path.join(pepperdir, 'toolchain')): |
449 buildbot_common.ErrorExit('Examples depend on missing toolchains.') | 450 buildbot_common.ErrorExit('Examples depend on missing toolchains.') |
450 | 451 |
451 exampledir = os.path.join(pepperdir, 'examples') | 452 exampledir = os.path.join(pepperdir, 'examples') |
452 buildbot_common.RemoveDir(exampledir) | 453 buildbot_common.RemoveDir(exampledir) |
453 buildbot_common.MakeDir(exampledir) | 454 buildbot_common.MakeDir(exampledir) |
(...skipping 21 matching lines...) Expand all Loading... | |
475 args.append('--' + toolchain) | 476 args.append('--' + toolchain) |
476 | 477 |
477 for example in EXAMPLE_LIST: | 478 for example in EXAMPLE_LIST: |
478 dsc = os.path.join(SDK_EXAMPLE_DIR, example, 'example.dsc') | 479 dsc = os.path.join(SDK_EXAMPLE_DIR, example, 'example.dsc') |
479 args.append(dsc) | 480 args.append(dsc) |
480 | 481 |
481 for library in LIBRARY_LIST: | 482 for library in LIBRARY_LIST: |
482 dsc = os.path.join(SDK_LIBRARY_DIR, library, 'library.dsc') | 483 dsc = os.path.join(SDK_LIBRARY_DIR, library, 'library.dsc') |
483 args.append(dsc) | 484 args.append(dsc) |
484 | 485 |
486 if build_experimental: | |
487 args.append('--experimental') | |
488 | |
485 if generate_make.main(args): | 489 if generate_make.main(args): |
486 buildbot_common.ErrorExit('Failed to build examples.') | 490 buildbot_common.ErrorExit('Failed to build examples.') |
487 | 491 |
488 | 492 |
489 def GetWindowsEnvironment(): | 493 def GetWindowsEnvironment(): |
490 sys.path.append(os.path.join(NACL_DIR, 'buildbot')) | 494 sys.path.append(os.path.join(NACL_DIR, 'buildbot')) |
491 import buildbot_standard | 495 import buildbot_standard |
492 | 496 |
493 # buildbot_standard.SetupWindowsEnvironment expects a "context" object. We'll | 497 # buildbot_standard.SetupWindowsEnvironment expects a "context" object. We'll |
494 # fake enough of that here to work. | 498 # fake enough of that here to work. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 src_dir = os.path.join(pepperdir, 'src') | 537 src_dir = os.path.join(pepperdir, 'src') |
534 makefile = os.path.join(src_dir, 'Makefile') | 538 makefile = os.path.join(src_dir, 'Makefile') |
535 if os.path.isfile(makefile): | 539 if os.path.isfile(makefile): |
536 print "\n\nMake: " + src_dir | 540 print "\n\nMake: " + src_dir |
537 if platform == 'win': | 541 if platform == 'win': |
538 # We need to modify the environment to build host on Windows. | 542 # We need to modify the environment to build host on Windows. |
539 env = GetWindowsEnvironment() | 543 env = GetWindowsEnvironment() |
540 else: | 544 else: |
541 env = os.environ | 545 env = os.environ |
542 | 546 |
543 buildbot_common.Run(['make', '-j8'], | 547 #buildbot_common.Run(['make', '-j8'], |
noelallen1
2012/07/27 00:29:40
Is this a left over? Or do you want to keep it to
binji
2012/07/27 18:16:39
Whoops, left over. I was using it to make it easie
| |
548 buildbot_common.Run(['make', '-j1'], | |
544 cwd=os.path.abspath(src_dir), shell=True, env=env) | 549 cwd=os.path.abspath(src_dir), shell=True, env=env) |
545 # Clean to remove temporary files but keep the built libraries. | 550 # Clean to remove temporary files but keep the built libraries. |
546 buildbot_common.Run(['make', '-j8', 'clean'], | 551 buildbot_common.Run(['make', 'clean'], |
547 cwd=os.path.abspath(src_dir), shell=True) | 552 cwd=os.path.abspath(src_dir), shell=True) |
548 | 553 |
549 | 554 |
550 def BuildStepTarBundle(pepper_ver, tarfile): | 555 def BuildStepTarBundle(pepper_ver, tarfile): |
551 buildbot_common.BuildStep('Tar Pepper Bundle') | 556 buildbot_common.BuildStep('Tar Pepper Bundle') |
552 buildbot_common.MakeDir(os.path.dirname(tarfile)) | 557 buildbot_common.MakeDir(os.path.dirname(tarfile)) |
553 buildbot_common.Run([sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, | 558 buildbot_common.Run([sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, |
554 'pepper_' + pepper_ver], cwd=NACL_DIR) | 559 'pepper_' + pepper_ver], cwd=NACL_DIR) |
555 | 560 |
556 | 561 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 action='store_true', dest='only_updater', default=False) | 702 action='store_true', dest='only_updater', default=False) |
698 parser.add_option('--test-examples', | 703 parser.add_option('--test-examples', |
699 help='Run the pyauto tests for examples.', action='store_true', | 704 help='Run the pyauto tests for examples.', action='store_true', |
700 dest='test_examples', default=False) | 705 dest='test_examples', default=False) |
701 parser.add_option('--skip-tar', help='Skip generating a tarball.', | 706 parser.add_option('--skip-tar', help='Skip generating a tarball.', |
702 action='store_true', dest='skip_tar', default=False) | 707 action='store_true', dest='skip_tar', default=False) |
703 parser.add_option('--archive', help='Force the archive step.', | 708 parser.add_option('--archive', help='Force the archive step.', |
704 action='store_true', dest='archive', default=False) | 709 action='store_true', dest='archive', default=False) |
705 parser.add_option('--release', help='PPAPI release version.', | 710 parser.add_option('--release', help='PPAPI release version.', |
706 dest='release', default=None) | 711 dest='release', default=None) |
712 parser.add_option('--experimental', | |
713 help='build experimental examples and libraries', action='store_true', | |
714 dest='build_experimental', default=False) | |
707 | 715 |
708 options, args = parser.parse_args(args[1:]) | 716 options, args = parser.parse_args(args[1:]) |
709 platform = getos.GetPlatform() | 717 platform = getos.GetPlatform() |
710 arch = 'x86' | 718 arch = 'x86' |
711 | 719 |
712 builder_name = os.getenv('BUILDBOT_BUILDERNAME','') | 720 builder_name = os.getenv('BUILDBOT_BUILDERNAME','') |
713 if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0: | 721 if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0: |
714 options.pnacl = True | 722 options.pnacl = True |
715 | 723 |
716 # TODO(binji) There is currently a hack in download_nacl_toolchains.py that | 724 # TODO(binji) There is currently a hack in download_nacl_toolchains.py that |
(...skipping 24 matching lines...) Expand all Loading... | |
741 tarname = 'naclsdk_' + platform + '.tar.bz2' | 749 tarname = 'naclsdk_' + platform + '.tar.bz2' |
742 if 'pnacl' in toolchains: | 750 if 'pnacl' in toolchains: |
743 tarname = 'p' + tarname | 751 tarname = 'p' + tarname |
744 tarfile = os.path.join(SERVER_DIR, tarname) | 752 tarfile = os.path.join(SERVER_DIR, tarname) |
745 | 753 |
746 if options.release: | 754 if options.release: |
747 pepper_ver = options.release | 755 pepper_ver = options.release |
748 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) | 756 print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) |
749 | 757 |
750 if options.only_examples: | 758 if options.only_examples: |
751 BuildStepCopyExamples(pepperdir, toolchains) | 759 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) |
752 BuildStepBuildLibraries(pepperdir, platform) | 760 BuildStepBuildLibraries(pepperdir, platform) |
753 BuildStepBuildExamples(pepperdir, platform) | 761 BuildStepBuildExamples(pepperdir, platform) |
754 if options.test_examples: | 762 if options.test_examples: |
755 BuildStepTestExamples(pepperdir, platform, pepper_ver) | 763 BuildStepTestExamples(pepperdir, platform, pepper_ver) |
756 elif options.only_updater: | 764 elif options.only_updater: |
757 build_updater.BuildUpdater(OUT_DIR) | 765 build_updater.BuildUpdater(OUT_DIR) |
758 else: # Build everything. | 766 else: # Build everything. |
759 BuildStepBuildToolsTests() | 767 BuildStepBuildToolsTests() |
760 | 768 |
761 BuildStepDownloadToolchains(platform) | 769 BuildStepDownloadToolchains(platform) |
762 BuildStepCleanPepperDirs(pepperdir, pepperdir_old) | 770 BuildStepCleanPepperDirs(pepperdir, pepperdir_old) |
763 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) | 771 BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) |
764 BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) | 772 BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) |
765 BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) | 773 BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) |
766 BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) | 774 BuildStepBuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) |
767 InstallHeaders(os.path.join(pepperdir, 'include'), None, 'libs') | 775 InstallHeaders(os.path.join(pepperdir, 'include'), None, 'libs') |
768 BuildStepCopyBuildHelpers(pepperdir, platform) | 776 BuildStepCopyBuildHelpers(pepperdir, platform) |
769 BuildStepCopyExamples(pepperdir, toolchains) | 777 BuildStepCopyExamples(pepperdir, toolchains, options.build_experimental) |
770 | 778 |
771 # Ship with libraries prebuilt, so run that first. | 779 # Ship with libraries prebuilt, so run that first. |
772 BuildStepBuildLibraries(pepperdir, platform) | 780 BuildStepBuildLibraries(pepperdir, platform) |
773 | 781 |
774 if not options.skip_tar: | 782 if not options.skip_tar: |
775 BuildStepTarBundle(pepper_ver, tarfile) | 783 BuildStepTarBundle(pepper_ver, tarfile) |
776 build_updater.BuildUpdater(OUT_DIR) | 784 build_updater.BuildUpdater(OUT_DIR) |
777 | 785 |
778 # BuildStepTestUpdater downloads the bundle to its own directory. Build | 786 # BuildStepTestUpdater downloads the bundle to its own directory. Build |
779 # the examples and test from this directory instead of the original. | 787 # the examples and test from this directory instead of the original. |
780 pepperdir = BuildStepTestUpdater(platform, pepper_ver, clnumber, tarfile) | 788 pepperdir = BuildStepTestUpdater(platform, pepper_ver, clnumber, tarfile) |
781 BuildStepBuildExamples(pepperdir, platform) | 789 BuildStepBuildExamples(pepperdir, platform) |
782 if options.test_examples: | 790 if options.test_examples: |
783 BuildStepTestExamples(pepperdir, platform, pepper_ver) | 791 BuildStepTestExamples(pepperdir, platform, pepper_ver) |
784 | 792 |
785 # Archive on non-trybots. | 793 # Archive on non-trybots. |
786 if options.archive or buildbot_common.IsSDKBuilder(): | 794 if options.archive or buildbot_common.IsSDKBuilder(): |
787 BuildStepArchiveBundle(pepper_ver, clnumber, tarfile) | 795 BuildStepArchiveBundle(pepper_ver, clnumber, tarfile) |
788 BuildStepArchiveSDKTools() | 796 BuildStepArchiveSDKTools() |
789 | 797 |
790 return 0 | 798 return 0 |
791 | 799 |
792 | 800 |
793 if __name__ == '__main__': | 801 if __name__ == '__main__': |
794 sys.exit(main(sys.argv)) | 802 sys.exit(main(sys.argv)) |
OLD | NEW |