blob: 4dc95cf5fdb0efdd7775a858456fc4f8baee75ef [file] [log] [blame]
Daniel Dunbar44abe742009-07-19 01:59:03 +00001import os
2
Daniel Dunbar235aa412009-07-18 07:16:15 +00003import buildbot
4import buildbot.process.factory
5from buildbot.steps.source import SVN
Daniel Dunbar44abe742009-07-19 01:59:03 +00006from buildbot.steps.shell import Configure, ShellCommand
7from buildbot.steps.shell import WarningCountingShellCommand
8from buildbot.steps.transfer import FileDownload
Daniel Dunbar235aa412009-07-18 07:16:15 +00009from buildbot.process.properties import WithProperties
10
11from zorg.buildbot.commands.DejaGNUCommand import DejaGNUCommand
12from zorg.buildbot.commands.ClangTestCommand import ClangTestCommand
13from zorg.buildbot.commands.GTestCommand import GTestCommand
14
15def getClangBuildFactory(triple,
16 CC='gcc', CXX='g++',
Daniel Dunbar44abe742009-07-19 01:59:03 +000017 CFLAGS='', CXXFLAGS='',
18 useCMake=False,
19 extraMakeArgs=''):
Daniel Dunbar235aa412009-07-18 07:16:15 +000020 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 Dunbar44abe742009-07-19 01:59:03 +000032 '-DCMAKE_C_COMPILER=%s' % (CC,),
33 '-DCMAKE_CXX_COMPILER=%s' % (CXX,),
34 '-DCMAKE_C_FLAGS=%s' % (CFLAGS,),
35 '-DCMAKE_CXX_FLAGS=%s' % (CXXFLAGS,),
Daniel Dunbar235aa412009-07-18 07:16:15 +000036 '../'],
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 Dunbar44abe742009-07-19 01:59:03 +000044 'CC=%s %s' % (CC, CFLAGS),
45 'CXX=%s %s' % (CXX, CXXFLAGS)],
Daniel Dunbar235aa412009-07-18 07:16:15 +000046 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 Dunbar44abe742009-07-19 01:59:03 +000064 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 Dunbar235aa412009-07-18 07:16:15 +000069 f.addStep(GTestCommand(name="unittest-llvm",
70 command=["make", "unittests"],
71 description="unittests (llvm)",
72 workdir="llvm"))
73 return f
Daniel Dunbar44abe742009-07-19 01:59:03 +000074
75
76def 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