Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame^] | 1 | import os |
| 2 | |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 3 | import buildbot |
| 4 | import buildbot.process.factory |
| 5 | from buildbot.steps.source import SVN |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame^] | 6 | from buildbot.steps.shell import Configure, ShellCommand |
| 7 | from buildbot.steps.shell import WarningCountingShellCommand |
| 8 | from buildbot.steps.transfer import FileDownload |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 9 | from buildbot.process.properties import WithProperties |
| 10 | |
| 11 | from zorg.buildbot.commands.DejaGNUCommand import DejaGNUCommand |
| 12 | from zorg.buildbot.commands.ClangTestCommand import ClangTestCommand |
| 13 | from zorg.buildbot.commands.GTestCommand import GTestCommand |
| 14 | |
| 15 | def getClangBuildFactory(triple, |
| 16 | CC='gcc', CXX='g++', |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame^] | 17 | CFLAGS='', CXXFLAGS='', |
| 18 | useCMake=False, |
| 19 | extraMakeArgs=''): |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 20 | f = buildbot.process.factory.BuildFactory() |
| 21 | f.addStep(SVN(name='svn-llvm', |
| 22 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 23 | defaultBranch='trunk', |
| 24 | workdir='llvm')) |
| 25 | f.addStep(SVN(name='svn-clang', |
| 26 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
| 27 | defaultBranch='trunk', |
| 28 | workdir='llvm/tools/clang')) |
| 29 | if useCMake: |
| 30 | builddir = 'llvm/build' |
| 31 | f.addStep(Configure(command=['cmake', |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame^] | 32 | '-DCMAKE_C_COMPILER=%s' % (CC,), |
| 33 | '-DCMAKE_CXX_COMPILER=%s' % (CXX,), |
| 34 | '-DCMAKE_C_FLAGS=%s' % (CFLAGS,), |
| 35 | '-DCMAKE_CXX_FLAGS=%s' % (CXXFLAGS,), |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 36 | '../'], |
| 37 | workdir=builddir, |
| 38 | description=['cmake','Debug'], |
| 39 | descriptionDone=['cmake','Debug'])) |
| 40 | else: |
| 41 | builddir = 'llvm' |
| 42 | f.addStep(Configure(command=['./configure', |
| 43 | '--build', triple, |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame^] | 44 | 'CC=%s %s' % (CC, CFLAGS), |
| 45 | 'CXX=%s %s' % (CXX, CXXFLAGS)], |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 46 | workdir=builddir, |
| 47 | description=['configuring','Debug'], |
| 48 | descriptionDone=['configure','Debug'])) |
| 49 | f.addStep(WarningCountingShellCommand(name="clean-llvm", |
| 50 | command="make clean", |
| 51 | haltOnFailure=True, |
| 52 | description="cleaning llvm", |
| 53 | descriptionDone="clean llvm", |
| 54 | workdir=builddir)) |
| 55 | f.addStep(WarningCountingShellCommand(name="compile", |
| 56 | command=WithProperties("nice -n 10 make -j%(jobs)d"), |
| 57 | haltOnFailure=True, |
| 58 | description="compiling llvm & clang", |
| 59 | descriptionDone="compile llvm & clang", |
| 60 | workdir=builddir)) |
| 61 | if not useCMake: # :( |
| 62 | f.addStep(DejaGNUCommand(name='test-llvm', |
| 63 | workdir=builddir)) |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame^] | 64 | if not useCMake: # :( |
| 65 | f.addStep(ClangTestCommand(name='test-clang', |
| 66 | command=WithProperties("nice -n 10 make -j%(jobs)d test VERBOSE=1"), |
| 67 | workdir="llvm/tools/clang")) |
| 68 | if not useCMake: # :( |
Daniel Dunbar | 235aa41 | 2009-07-18 07:16:15 +0000 | [diff] [blame] | 69 | f.addStep(GTestCommand(name="unittest-llvm", |
| 70 | command=["make", "unittests"], |
| 71 | description="unittests (llvm)", |
| 72 | workdir="llvm")) |
| 73 | return f |
Daniel Dunbar | 44abe74 | 2009-07-19 01:59:03 +0000 | [diff] [blame^] | 74 | |
| 75 | |
| 76 | def getClangMSVCBuildFactory(): |
| 77 | f = buildbot.process.factory.BuildFactory() |
| 78 | |
| 79 | if True: |
| 80 | f.addStep(SVN(name='svn-llvm', |
| 81 | mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/', |
| 82 | defaultBranch='trunk', |
| 83 | workdir='llvm')) |
| 84 | |
| 85 | if True: |
| 86 | f.addStep(SVN(name='svn-clang', |
| 87 | mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/', |
| 88 | defaultBranch='trunk', |
| 89 | workdir='llvm/tools/clang')) |
| 90 | |
| 91 | # Full & fast clean. |
| 92 | if True: |
| 93 | f.addStep(ShellCommand(name='clean-1', |
| 94 | command=['del','/s/q','build'], |
| 95 | warnOnFailure=True, |
| 96 | description='cleaning', |
| 97 | descriptionDone='clean', |
| 98 | workdir='llvm')) |
| 99 | f.addStep(ShellCommand(name='clean-2', |
| 100 | command=['rmdir','/s/q','build'], |
| 101 | warnOnFailure=True, |
| 102 | description='cleaning', |
| 103 | descriptionDone='clean', |
| 104 | workdir='llvm')) |
| 105 | |
| 106 | # Create the project files. |
| 107 | |
| 108 | # FIXME: Don't require local versions of these files. See buildbot ticket |
| 109 | # #595. We could always write the contents into a temp file, to avoid having |
| 110 | # them in SVN, and to allow parameterization. |
| 111 | f.addStep(FileDownload(mastersrc=os.path.join(os.path.dirname(__file__), |
| 112 | 'ClangMSVC_cmakegen.bat'), |
| 113 | slavedest='cmakegen.bat', |
| 114 | workdir='llvm\\build')) |
| 115 | f.addStep(ShellCommand(name='cmake', |
| 116 | command=['cmakegen.bat'], |
| 117 | haltOnFailure=True, |
| 118 | description='cmake gen', |
| 119 | workdir='llvm\\build')) |
| 120 | |
| 121 | # Build it. |
| 122 | f.addStep(FileDownload(mastersrc=os.path.join(os.path.dirname(__file__), |
| 123 | 'ClangMSVC_vcbuild.bat'), |
| 124 | slavedest='vcbuild.bat', |
| 125 | workdir='llvm\\build')) |
| 126 | f.addStep(WarningCountingShellCommand(name='vcbuild', |
| 127 | command=['vcbuild.bat'], |
| 128 | haltOnFailure=True, |
| 129 | description='vcbuild', |
| 130 | workdir='llvm\\build', |
| 131 | warningPattern=" warning C.*:")) |
| 132 | return f |