views:

1881

answers:

3

Hi everyone, for quite a while now, I've been trying to figure out how to setup an automated build process at our shop. I've read many posts and guides on this matter and none of them really fits my specifics needs.

My SVN repository is laid out as follows

\projects
   \projectA (a product)
       \tags
           \1.0.0.1
           \1.0.0.2
           ...
       \trunk
           \src
              \proj1  (a VS C# project)
              \proj2
           \documentation

Then I have a network share, with a folder for each project (product), which in turn contains the binaries, written documentation and the generated API documentation (via NDoc - each project may have an .ndoc file in the repository) for every historical version (from the tags SVN folder) and for the latest version as well (from the trunk).

Basically, what I want to do in a scheduled batch build are these steps:

  1. examine the project's SVN folder and identify tags not present in the network share
  2. for each of these tags
    1. check out the tag folder
    2. build (with Release config)
    3. copy the resulting binaries to the network share
    4. search for .ndoc files
    5. generate CHM files via NDoc
    6. copy the resulting CHM files to the network share
  3. do the same as in 2., but for the HEAD revision of trunk

Now, the trouble is, I have no idea where to start. I do not keep .sln files in the repository, but I am able to replace these with MSBuild files which in turn build the C# projects belonging to the specific product.

I guess the most troubling part is the examination of the repository for tags which have not been processed yet - i.e. searching the tags and comparing them to a project's directory structure on the network share. I have no idea how to do that in any of the build tools (NAnt, MSBuild).

Could you please provide me with some pointers on how to approach this task as a whole and in detail as well? I do not care if I use NAnt, MSBuild, or both. I am aware that this might be rather complex, but every idea and NAnt/MSBuild snippet will be a great help.

Thanks in advance.

A: 

Can you have NAnt or MSBuild call a perl or some other scripting language script to examine the svn repository and do the checkout? If you can run the build from the command line as well it sounds like everything else is just more scripting.

apekarske
+1  A: 

In NantContrib there is a SVN command you can use to get information. Any query you can run from the SVN command line you should be able to use and then parse the result. So you could do a tag search, match the tags to folders on your network share, then perform a checkout for any that are missing using the svn-checkout command. Once done fire the msbuild command for each project folder.

An alternative if you want to have automated builds would be to create a branch instead of a tag since it looks like you are creating versions vs just a tag. If you create a branch you could have an automated build tool like CruiseControl.net or TeamCity monitory your repository. Then if a file is checked in on the Branch or Trunk you can have it kick off your automated build.

Between the two you should be able to handle it. If you would like a good example of some build scripts that have the documentation implemented in them (with zip and distribution stuff) check out the Castle Project here: http://www.castleproject.org/

They even use some of the SVN commands to get things like the revision number and what not for auto generating the assymbly info files.

Joshua Cauble
A: 

UppercuT might be a great resource to check out for NAnt snippets.

http://projectuppercut.org/

Some good explanations here: UppercuT

ferventcoder