Build numbers and OpenWrap

13 views
Skip to first unread message

Sebastien Lambla

unread,
May 16, 2012, 4:27:35 PM5/16/12
to openevery...@googlegroups.com

Quick note for all that may use OpenWrap to build stuff.

 

There’s a few features that are relevant to versioning in the latest 2.0.3 codebase you can toy with. I built them all so that OpenWrap could be in charge of the versioning scheme on the whole pipeline, rather than have to have specific projects in teamcity configured manually with those versions, something I detest.

 

First, you can use the same version for your package and for your assemblies by enabling assembly info generation. It’s transparent, so you only add

 

assembly-info: assembly-version

assembly-info: file-version

assembly-info: assembly-info

 

And make sure the assembly-level attributes for those three are not included, and you’ll have a build that keeps everything in sync.

 

Second, in your version file, the syntax 1.0.0+* has always been supported (which generates a timestamp). There’s now a 1.0.0. # that builds incrementally.

 

Third, when you build your package, if you want to override the incremental build counter, you can set the “BuildCounter” input on the build-wrap command and pass it an environment variable instead (so build-wrap –buildcounter %BUILD_NUMBER%) and that’ll work with that number instead of the one OW uses itself.

 

So if you set your version file to “1.0.0+#” and “-buildcounter 5”, OW will generate a version of 1.0.0+5.

 

Fourth, you can now read properties from the result of various commands inside MSBuild. For those that haven’t looked at the command system, commands output objects, those objects then get rendered on screen using strings.

 

For example, the build-wrap command  has an output called PackageBuilt that has two properties, File and Version. I want to tell TeamCity what version OpenWrap decided to use after processing my version file, so capturing the Version is rather useful.

 

That gives me the following to build a package.

    <RunCommand

      Verb="build"

      Noun="wrap"

      Capture="PackageBuilt.Version">

      <Output TaskParameter="Captures" ItemName="Captured" />

    </RunCommand>

   

    

    <Message Importance="High" Text="##teamcity[buildNumber '@(Captured)']" Condition="'$(BUILD_NUMBER)' != '' and '%(Property)' == 'PackageBuilt.Version'" />

 

Each captured property is assigned to the item spec and the name itself into the Property metadata, letting you use those in your scripts.

 

Note that once the conversion to strongly-typed messages in all commands is complete, we’ll easily be able to spit out xml for automating at the command-line level, but that’s not a priority right now.

 

Anyway, any feedback is appreciated.

 

Seb

Reply all
Reply to author
Forward
0 new messages