Using CruiseControl for non-Java Projects
A lot of people are under the impression that CruiseControl is solely intended for Java projects. This is a common misconception. At my current client we’re using CruiseControl to build a 15 year old, 2.5 million line mixed C/C++ app using GNU make. We’re also using it to build and functionally test a new C app we’re writing as part of the project. I’ve also used it in the past on Python apps.
There are a number of ways to do this, and they all really depend on what you’re using Cruise for. If you’re simply using it for compilation, then you can simply use <exec> to call make (or whatever you’re building with). By default it will break the build if the command returns a non-zero return code, so it should be smart enough to do this out of the box. I know that some of our Ruby projects that use this method too.
My personal preference is to get CruiseControl to do an Ant build, which has some additional logic, including taging the source repository with the build label if the build passes. The approach is very similar in this case, and has the following steps:
- Have ant do any additional work/checks you want to ensure the environment is how you want it.
- Update my working copy to an exact known version that can be tagged at a later stage if the build is good (primarily a CVS problem, not really needed if you’re using Subversion).
- Use the <exec> task from ant to run the build
- If you have additional tests to run, use an <exec> within a <parallel> block to start your newly built binary in the background, then run the tests
- If everything is good and passes, tag your source code with the build label.
So, although it is fairly easy to add build plugins for various other projects, you can save yourself a bit of pain simply using the one <exec> or shelling out of an <ant> builder.