Trees | Indices | Help |
|
---|
|
1 # This file is part of Buildbot. Buildbot is free software: you can 2 # redistribute it and/or modify it under the terms of the GNU General Public 3 # License as published by the Free Software Foundation, version 2. 4 # 5 # This program is distributed in the hope that it will be useful, but WITHOUT 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8 # details. 9 # 10 # You should have received a copy of the GNU General Public License along with 11 # this program; if not, write to the Free Software Foundation, Inc., 51 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13 # 14 # Copyright Buildbot Team Members 15 16 # Visual studio steps 17 18 from buildbot.steps.shell import ShellCommand 19 from buildbot.process.buildstep import LogLineObserver 20 from buildbot.status.results import SUCCESS, WARNINGS, FAILURE 21 22 import re 23 2426 """ concat a path for this name """ 27 try: 28 oldval = env[name] 29 if not oldval.endswith(';'): 30 oldval = oldval + ';' 31 except KeyError: 32 oldval = "" 33 if not value.endswith(';'): 34 value = value + ';' 35 env[name] = oldval + value3638 39 _re_delimiter = re.compile(r'^(\d+>)?-{5}.+-{5}$') 40 _re_file = re.compile(r'^(\d+>)?[^ ]+\.(cpp|c)$') 41 _re_warning = re.compile(r' ?: warning [A-Z]+[0-9]+:') 42 _re_error = re.compile(r' ?error ([A-Z]+[0-9]+)?\s?: ') 43 44 nbFiles = 0 45 nbProjects = 0 46 nbWarnings = 0 47 nbErrors = 0 48 49 logwarnings = None 50 logerrors = None 5176 7753 LogLineObserver.__init__(self, **kwargs) 54 self.logwarnings = logwarnings 55 self.logerrors = logerrors 56 self.stdoutParser.delimiter = "\r\n" 57 self.stderrParser.delimiter = "\r\n"5860 if self._re_delimiter.search(line): 61 self.nbProjects += 1 62 self.logwarnings.addStdout("%s\n" % line) 63 self.logerrors.addStdout("%s\n" % line) 64 self.step.setProgress('projects', self.nbProjects) 65 elif self._re_file.search(line): 66 self.nbFiles += 1 67 self.step.setProgress('files', self.nbFiles) 68 elif self._re_warning.search(line): 69 self.nbWarnings += 1 70 self.logwarnings.addStdout("%s\n" % line) 71 self.step.setProgress('warnings', self.nbWarnings) 72 elif self._re_error.search("%s\n" % line): 73 # error has no progress indication 74 self.nbErrors += 1 75 self.logerrors.addStderr("%s\n" % line)79 # an *abstract* base class, which will not itself work as a buildstep 80 81 name = "compile" 82 description = "compiling" 83 descriptionDone = "compile" 84 85 86 progressMetrics = ( ShellCommand.progressMetrics + 87 ('projects', 'files','warnings',)) 88 89 logobserver = None 90 91 installdir = None 92 default_installdir = None 93 94 # One of build, or rebuild 95 mode = "rebuild" 96 97 projectfile = None 98 config = None 99 useenv = False 100 project = None 101 PATH = [] 102 INCLUDE = [] 103 LIB = [] 104 105 renderables = [ 'projectfile', 'config', 'project' ] 106194107 - def __init__(self, 108 installdir = None, 109 mode = "rebuild", 110 projectfile = None, 111 config = 'release', 112 useenv = False, 113 project = None, 114 INCLUDE = [], 115 LIB = [], 116 PATH = [], 117 **kwargs):118 self.installdir = installdir 119 self.mode = mode 120 self.projectfile = projectfile 121 self.config = config 122 self.useenv = useenv 123 self.project = project 124 if len(INCLUDE) > 0: 125 self.INCLUDE = INCLUDE 126 self.useenv = True 127 if len(LIB) > 0: 128 self.LIB = LIB 129 self.useenv = True 130 if len(PATH) > 0: 131 self.PATH = PATH 132 # always upcall ! 133 ShellCommand.__init__(self, **kwargs)134136 logwarnings = self.addLog("warnings") 137 logerrors = self.addLog("errors") 138 self.logobserver = MSLogLineObserver(logwarnings, logerrors) 139 self.addLogObserver('stdio', self.logobserver) 140 ShellCommand.setupLogfiles(self, cmd, logfiles)141 145147 ShellCommand.setupEnvironment(self, cmd) 148 if cmd.args['env'] is None: 149 cmd.args['env'] = {} 150 151 # setup the custom one, those one goes first 152 for path in self.PATH: 153 addEnvPath(cmd.args['env'], "PATH", path) 154 for path in self.INCLUDE: 155 addEnvPath(cmd.args['env'], "INCLUDE", path) 156 for path in self.LIB: 157 addEnvPath(cmd.args['env'], "LIB", path) 158 159 self.setupInstalldir()160162 description = ShellCommand.describe(self, done) 163 if done: 164 description.append('%d projects' % self.step_status.getStatistic('projects', 0)) 165 description.append('%d files' % self.step_status.getStatistic('files', 0)) 166 warnings = self.step_status.getStatistic('warnings', 0) 167 if warnings > 0: 168 description.append('%d warnings' % warnings) 169 errors = self.step_status.getStatistic('errors', 0) 170 if errors > 0: 171 description.append('%d errors' % errors) 172 return description173175 self.step_status.setStatistic('projects', self.logobserver.nbProjects) 176 self.step_status.setStatistic('files', self.logobserver.nbFiles) 177 self.step_status.setStatistic('warnings', self.logobserver.nbWarnings) 178 self.step_status.setStatistic('errors', self.logobserver.nbErrors)179181 if cmd.didFail(): 182 return FAILURE 183 if self.logobserver.nbErrors > 0: 184 return FAILURE 185 if self.logobserver.nbWarnings > 0: 186 return WARNINGS 187 else: 188 return SUCCESS189196 197 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio' 198237200 VisualStudio.setupEnvironment(self, cmd) 201 202 # Root of Visual Developer Studio Common files. 203 VSCommonDir = self.installdir + '\\Common' 204 MSVCDir = self.installdir + '\\VC98' 205 MSDevDir = VSCommonDir + '\\msdev98' 206 207 addEnvPath(cmd.args['env'], "PATH", MSDevDir + '\\BIN') 208 addEnvPath(cmd.args['env'], "PATH", MSVCDir + '\\BIN') 209 addEnvPath(cmd.args['env'], "PATH", VSCommonDir + '\\TOOLS\\WINNT') 210 addEnvPath(cmd.args['env'], "PATH", VSCommonDir + '\\TOOLS') 211 212 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\INCLUDE') 213 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\ATL\\INCLUDE') 214 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\MFC\\INCLUDE') 215 216 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\LIB') 217 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\MFC\\LIB')218220 command = ["msdev"] 221 command.append(self.projectfile) 222 command.append("/MAKE") 223 if self.project is not None: 224 command.append(self.project + " - " + self.config) 225 else: 226 command.append("ALL - " + self.config) 227 if self.mode == "rebuild": 228 command.append("/REBUILD") 229 elif self.mode == "clean": 230 command.append("/CLEAN") 231 else: 232 command.append("/BUILD") 233 if self.useenv: 234 command.append("/USEENV") 235 self.setCommand(command) 236 return VisualStudio.start(self)239 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio .NET 2003' 240280 281 #alias VC7 as VS2003 282 VS2003 = VC7 283242 VisualStudio.setupEnvironment(self, cmd) 243 244 VSInstallDir = self.installdir + '\\Common7\\IDE' 245 VCInstallDir = self.installdir 246 MSVCDir = self.installdir + '\\VC7' 247 248 addEnvPath(cmd.args['env'], "PATH", VSInstallDir) 249 addEnvPath(cmd.args['env'], "PATH", MSVCDir + '\\BIN') 250 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\Common7\\Tools') 251 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\Common7\\Tools\\bin') 252 253 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\INCLUDE') 254 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\ATLMFC\\INCLUDE') 255 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\PlatformSDK\\include') 256 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\SDK\\v1.1\\include') 257 258 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\LIB') 259 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\ATLMFC\\LIB') 260 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\PlatformSDK\\lib') 261 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\SDK\\v1.1\\lib')262264 command = ["devenv.com"] 265 command.append(self.projectfile) 266 if self.mode == "rebuild": 267 command.append("/Rebuild") 268 elif self.mode == "clean": 269 command.append("/Clean") 270 else: 271 command.append("/Build") 272 command.append(self.config) 273 if self.useenv: 274 command.append("/UseEnv") 275 if self.project is not None: 276 command.append("/Project") 277 command.append(self.project) 278 self.setCommand(command) 279 return VisualStudio.start(self)285 286 # Our ones 287 arch = None 288 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio 8' 289 290 renderables = ['arch'] 291 297326 327 #alias VC8 as VS2005 328 VS2005 = VC8 329299 VisualStudio.setupEnvironment(self, cmd) 300 301 VSInstallDir = self.installdir 302 VCInstallDir = self.installdir + '\\VC' 303 304 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\Common7\\IDE') 305 if self.arch == "x64": 306 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\BIN\\x86_amd64') 307 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\BIN') 308 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\Common7\\Tools') 309 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\Common7\\Tools\\bin') 310 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\PlatformSDK\\bin') 311 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\SDK\\v2.0\\bin') 312 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\VCPackages') 313 addEnvPath(cmd.args['env'], "PATH", r'${PATH}') 314 315 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\INCLUDE') 316 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\ATLMFC\\include') 317 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\PlatformSDK\\include') 318 319 archsuffix = '' 320 if self.arch == "x64": 321 archsuffix = '\\amd64' 322 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\LIB' + archsuffix) 323 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\ATLMFC\\LIB' + archsuffix) 324 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\PlatformSDK\\lib' + archsuffix) 325 addEnvPath(cmd.args['env'], "LIB", VSInstallDir + '\\SDK\\v2.0\\lib' + archsuffix)348 349 # Add first support for VC9 (Same as VC8, with a different installdir)332 command = ["vcexpress"] 333 command.append(self.projectfile) 334 if self.mode == "rebuild": 335 command.append("/Rebuild") 336 elif self.mode == "clean": 337 command.append("/Clean") 338 else: 339 command.append("/Build") 340 command.append(self.config) 341 if self.useenv: 342 command.append("/UseEnv") 343 if self.project is not None: 344 command.append("/Project") 345 command.append(self.project) 346 self.setCommand(command) 347 return VisualStudio.start(self)351 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio 9.0'352 353 VS2008 = VC9 354 355 # VC10 doesn't looks like it needs extra stuff.357 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio 10.0'358 359 VS2010 = VC10 360
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Nov 21 16:22:49 2012 | http://epydoc.sourceforge.net |