When working on a project you do accept that you have to do some choirs that you would rather not. When working on something “just4fun” this same assumption is just not true. If I am spending my free time behind the computer then I want to do things that I want to do. One of those things that I hate to do are reports and deployment packages.
The sad truth is that you need both. So what can you do about it? From my standpoint you have two options:
- You just do it by hand and bear the pain
- Automate it!
As “The pragmatic programmer” and “The productive programmer” are teaching us automation is the way to go! So we have to look at build automation. In the past I would just open a text editor and start typing a ANT build script. But for valy I wanted to do something new. And the reasons why I wanted to get from ANT are the following:
- XML is good for structuring data but are really bad when trying to capture a process
- It is quite hard to get a reasonable structure into the XML file
- It takes quite some experience to reasonably read the ANT file
I hope you get the general idea that XML is not a good way of describing a build process. ANT is a great tool but the XML format is killing it for me (hope they provie a DSL in the future).
So after long consideration I opted for RAKE. Rake is a Ruby based DSL for build automation. If you have ruby installed then getting RAKE is as simple as installling an addition gem. But setting up RAKE is not a part of this post.
After opting for RAKE I had to determine what my build script will do and if I will have more than one to get the job done. Some hours later I came up with the following list of tasks it has to do:
- Get sources from the mercurial repository
- Build sources
- Run tests
- Run nCover
- Assemble documentation
- Create a deployment package
Not exactly mission impossible but still a challenge.
Before we continue let’s get something clear. The scripts posted here are still work in progress and my change. If you want to follow my progress, all scripts are published at http://code.google.com/p/valy/source/browse/#hg/Build. And ofcourse you can copy and use at your delight, just let me know if you made some improvements.
I will not use any words on how I structured the code because I lost to many words already 🙂
Because this post is getting quite long I have decided to break it into multiple posts.
So until next time.