[Buildbot-devel] Visual Studio: new build step

Oleg Smolsky oleg at smolsky.net
Sun Sep 23 20:57:34 UTC 2012

On 2012-09-21 13:29, Dmitry Nezhevenko wrote:
> Well, it'll be a bit tricky too. I've something like this:
> def setupEnvironment(self, cmd):
>          BaseCompile.setupEnvironment(self, cmd)
>          cmd.args['env']['VCENV_BAT'] = "\"${%s}\\..\\..\\VC\\vcvarsall.bat\"" % self.commToolsName
> def start(self):
>          command = "%%VCENV_BAT%% %s && vcbuild /M1 /nocolor /useenv %s %s^|%s" % \
>              (batArch, self.projectfile.replace("/", "\\"), cfg, self.arch)
> It was the only way to actually use it together with '|' character in
> command line (due to stupid 'Win32|Release' configuration names)
Thank you! I've just adapted this code to call msbuild. This way I don't 
have to dork with the pipe symbol. Here is the minimal implementation of 
the new build step:

class VS2012(VC10):
     def setupEnvironment(self, cmd):
         VisualStudio.setupEnvironment(self, cmd)
         cmd.args['env']['VCENV_BAT'] = 

     def start(self):
         command = ["%VCENV_BAT%"]
         command.append("/p:Configuration=%s" % (self.config))
         command.append("/p:Platform=%s" % (self.platform))
         if self.project is not None:
             command.append("/t:%s" % (self.project))


         return VisualStudio.start(self)

This is far simpler than reading stuff from the remote registry as there 
are no asyn steps. Both win32 and amd64 builds are supported. 
Hypothetically, ARM and DDK builds would work too. I will debug this next.

P.S. here is a pretty printer for naming sub tasks:

     def describe(self, done=False):
         s = "building "
         if done:
             s = "built "
         if self.project is not None:
             s += "%s for %s|%s" % (self.project, self.config, 
             s += "solution for %s|%s" % (self.config, self.platform)
         return s.split()


More information about the devel mailing list