Trees | Indices | Help |
|
---|
|
1 # Visual studio steps 2 3 from buildbot.steps.shell import ShellCommand 4 from buildbot.process.buildstep import LogLineObserver 5 from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE 6 7 import re 8 911 """ concat a path for this name """ 12 try: 13 oldval = env[name] 14 if not oldval.endswith(';'): 15 oldval = oldval + ';' 16 except KeyError: 17 oldval = "" 18 if not value.endswith(';'): 19 value = value + ';' 20 env[name] = oldval + value2123 24 _re_delimitor = re.compile(r'^(\d+>)?-{5}.+-{5}$') 25 _re_file = re.compile(r'^(\d+>)?[^ ]+\.(cpp|c)$') 26 _re_warning = re.compile(r' : warning [A-Z]+[0-9]+:') 27 _re_error = re.compile(r' error [A-Z]+[0-9]+\s?: ') 28 29 nbFiles = 0 30 nbProjects = 0 31 nbWarnings = 0 32 nbErrors = 0 33 34 logwarnings = None 35 logerrors = None 3661 6238 LogLineObserver.__init__(self, **kwargs) 39 self.logwarnings = logwarnings 40 self.logerrors = logerrors 41 self.stdoutParser.delimiter = "\r\n" 42 self.stderrParser.delimiter = "\r\n"4345 if self._re_delimitor.search(line): 46 self.nbProjects += 1 47 self.logwarnings.addStdout("%s\n" % line) 48 self.logerrors.addStdout("%s\n" % line) 49 self.step.setProgress('projects', self.nbProjects) 50 elif self._re_file.search(line): 51 self.nbFiles += 1 52 self.step.setProgress('files', self.nbFiles) 53 elif self._re_warning.search(line): 54 self.nbWarnings += 1 55 self.logwarnings.addStdout("%s\n" % line) 56 self.step.setProgress('warnings', self.nbWarnings) 57 elif self._re_error.search("%s\n" % line): 58 # error is no progres indication 59 self.nbErrors += 1 60 self.logerrors.addStderr("%s\n" % line)64 name = "compile" 65 description = "compiling" 66 descriptionDone = "compile" 67 68 logobserver = None 69 70 installdir = None 71 default_installdir = None 72 73 # One of build, or rebuild 74 mode = "rebuild" 75 76 projectfile = None 77 config = None 78 useenv = False 79 PATH = [] 80 INCLUDE = [] 81 LIB = [] 8218183 - def __init__(self, 84 installdir = None, 85 mode = "rebuild", 86 projectfile = None, 87 config = None, 88 useenv = False, 89 INCLUDE = [], 90 LIB = [], 91 PATH = [], 92 **kwargs):93 self.installdir = installdir 94 self.mode = mode 95 self.projectfile = projectfile 96 self.config = config 97 self.useenv = useenv 98 if len(INCLUDE) > 0: 99 self.INCLUDE = INCLUDE 100 self.useenv = True 101 if len(LIB) > 0: 102 self.LIB = LIB 103 self.useenv = True 104 if len(PATH) > 0: 105 self.PATH = PATH 106 # always upcall ! 107 ShellCommand.__init__(self, **kwargs) 108 self.addFactoryArguments( 109 installdir = installdir, 110 mode = mode, 111 projectfile = projectfile, 112 config = config, 113 useenv = useenv, 114 INCLUDE = INCLUDE, 115 LIB = LIB, 116 PATH = PATH 117 )118120 self.progressMetrics += ('projects', 'files', 'warnings',) 121 return ShellCommand.setupProgress(self)122124 logwarnings = self.addLog("warnings") 125 logerrors = self.addLog("errors") 126 self.logobserver = MSLogLineObserver(logwarnings, logerrors) 127 self.addLogObserver('stdio', self.logobserver) 128 ShellCommand.setupLogfiles(self, cmd, logfiles)129 130 134136 ShellCommand.setupEnvironment(self, cmd) 137 if cmd.args['env'] is None: 138 cmd.args['env'] = {} 139 140 # setup the custom one, those one goes first 141 for path in self.PATH: 142 addEnvPath(cmd.args['env'], "PATH", path) 143 for path in self.INCLUDE: 144 addEnvPath(cmd.args['env'], "INCLUDE", path) 145 for path in self.LIB: 146 addEnvPath(cmd.args['env'], "LIB", path) 147 148 self.setupInstalldir()149151 description = ShellCommand.describe(self, done) 152 if done: 153 description.append('%d projects' % self.step_status.getStatistic('projects', 0)) 154 description.append('%d files' % self.step_status.getStatistic('files', 0)) 155 warnings = self.step_status.getStatistic('warnings', 0) 156 if warnings > 0: 157 description.append('%d warnings' % warnings) 158 errors = self.step_status.getStatistic('errors', 0) 159 if errors > 0: 160 description.append('%d errors' % errors) 161 return description162164 self.step_status.setStatistic('projects', self.logobserver.nbProjects) 165 self.step_status.setStatistic('files', self.logobserver.nbFiles) 166 self.step_status.setStatistic('warnings', self.logobserver.nbWarnings) 167 self.step_status.setStatistic('errors', self.logobserver.nbErrors)168170 if self.logobserver.nbErrors > 0: 171 return FAILURE 172 if self.logobserver.nbWarnings > 0: 173 return WARNINGS 174 else: 175 return SUCCESS176183 184 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio' 185 187 188 # always upcall ! 189 VisualStudio.__init__(self, **kwargs)190192 VisualStudio.setupEnvironment(self, cmd) 193 194 # Root of Visual Developer Studio Common files. 195 VSCommonDir = self.installdir + '\\Common' 196 MSVCDir = self.installdir + '\\VC98' 197 MSDevDir = VSCommonDir + '\\msdev98' 198 199 addEnvPath(cmd.args['env'], "PATH", MSDevDir + '\\BIN') 200 addEnvPath(cmd.args['env'], "PATH", MSVCDir + '\\BIN') 201 addEnvPath(cmd.args['env'], "PATH", VSCommonDir + '\\TOOLS\\WINNT') 202 addEnvPath(cmd.args['env'], "PATH", VSCommonDir + '\\TOOLS') 203 204 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\INCLUDE') 205 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\ATL\\INCLUDE') 206 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\MFC\\INCLUDE') 207 208 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\LIB') 209 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\MFC\\LIB')210212 command = ["msdev"] 213 command.append(self.projectfile) 214 command.append("/MAKE") 215 command.append("ALL - " + self.config) 216 if self.mode == "rebuild": 217 command.append("/REBUILD") 218 else: 219 command.append("/BUILD") 220 if self.useenv: 221 command.append("/USEENV") 222 self.setCommand(command) 223 return VisualStudio.start(self)224 231233 VisualStudio.setupEnvironment(self, cmd) 234 235 VSInstallDir = self.installdir + '\\Common7\\IDE' 236 VCInstallDir = self.installdir 237 MSVCDir = self.installdir + '\\VC7' 238 239 addEnvPath(cmd.args['env'], "PATH", VSInstallDir) 240 addEnvPath(cmd.args['env'], "PATH", MSVCDir + '\\BIN') 241 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\Common7\\Tools') 242 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\Common7\\Tools\\bin') 243 244 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\INCLUDE') 245 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\ATLMFC\\INCLUDE') 246 addEnvPath(cmd.args['env'], "INCLUDE", MSVCDir + '\\PlatformSDK\\include') 247 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\SDK\\v1.1\\include') 248 249 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\LIB') 250 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\ATLMFC\\LIB') 251 addEnvPath(cmd.args['env'], "LIB", MSVCDir + '\\PlatformSDK\\lib') 252 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\SDK\\v1.1\\lib')253255 command = ["devenv"] 256 command.append(self.projectfile) 257 if self.mode == "rebuild": 258 command.append("/Rebuild") 259 else: 260 command.append("/Build") 261 command.append(self.config) 262 if self.useenv: 263 command.append("/UseEnv") 264 self.setCommand(command) 265 return VisualStudio.start(self)266 267 #alias VC7 as VS2003 268 VS2003 = VC7 269271 272 # Our ones 273 arch = "x86" 274 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio 8' 275325 326 #alias VC8 as VS2005 327 VS2005 = VC8 328277 self.arch = arch 278 279 # always upcall ! 280 VisualStudio.__init__(self, **kwargs) 281 self.addFactoryArguments(arch = arch)282284 VisualStudio.setupEnvironment(self, cmd) 285 286 VSInstallDir = self.installdir 287 VCInstallDir = self.installdir + '\\VC' 288 289 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\Common7\\IDE') 290 if self.arch == "x64": 291 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\BIN\\x86_amd64') 292 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\BIN') 293 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\Common7\\Tools') 294 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\Common7\\Tools\\bin') 295 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\PlatformSDK\\bin') 296 addEnvPath(cmd.args['env'], "PATH", VSInstallDir + '\\SDK\\v2.0\\bin') 297 addEnvPath(cmd.args['env'], "PATH", VCInstallDir + '\\VCPackages') 298 addEnvPath(cmd.args['env'], "PATH", r'${PATH}') 299 300 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\INCLUDE') 301 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\ATLMFC\\include') 302 addEnvPath(cmd.args['env'], "INCLUDE", VCInstallDir + '\\PlatformSDK\\include') 303 304 archsuffix = '' 305 if self.arch == "x64": 306 archsuffix = '\\amd64' 307 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\LIB' + archsuffix) 308 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\ATLMFC\\LIB' + archsuffix) 309 addEnvPath(cmd.args['env'], "LIB", VCInstallDir + '\\PlatformSDK\\lib' + archsuffix) 310 addEnvPath(cmd.args['env'], "LIB", VSInstallDir + '\\SDK\\v2.0\\lib' + archsuffix)311 312 # the start method is the same as for VC7314 command = ["devenv"] 315 command.append(self.projectfile) 316 if self.mode == "rebuild": 317 command.append("/Rebuild") 318 else: 319 command.append("/Build") 320 command.append(self.config) 321 if self.useenv: 322 command.append("/UseEnv") 323 self.setCommand(command) 324 return VisualStudio.start(self)342 343 # Add first support for VC9 (Same as VC8, with a different installdir)331 command = ["vcexpress"] 332 command.append(self.projectfile) 333 if self.mode == "rebuild": 334 command.append("/Rebuild") 335 else: 336 command.append("/Build") 337 command.append(self.config) 338 if self.useenv: 339 command.append("/UseEnv") 340 self.setCommand(command) 341 return VisualStudio.start(self)345 default_installdir = 'C:\\Program Files\\Microsoft Visual Studio 9.0'346 347 VS2008 = VC9 348
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Oct 29 10:00:46 2010 | http://epydoc.sourceforge.net |