Do you know Build Groups?

Can you make a build in one step? (It is #2 in The Joel Test, but that is not a main topic of this article.) If you can, you have probably set up a clean build system for doing daily builds (#3 of The Joel Test) or even continuous builds based on a source control system (#1 of The Joel Test) and some of the many really useful tools available. The build system (hopefully) takes care to make sure that your sources are at least compilable for the different platforms and different build configurations as they are available in more recent Delphi versions.

You also do Smoke Testing before you check in, don’t you? There is no reason to break the build just for being lazy. But here things may become somewhat complicated, at least when you are developing for different platforms and some of the target platforms are currently not available in your working environment. But the least thing you can do before checking in is to make sure it will compile – for all platforms and all build configurations and whatever combination of those is feasible!


The Delphi IDE actually provides the necessary buttons to change the platform and build configuration for all projects in the current project group with only a few mouse clicks, but even that might sum up to plenty of clicks and actions, which is as tedious as it is error prone. Here Build Groups come to the rescue.

Build Groups are a lesser known part of the Project Manager. They are useful to compile, build or clean selected projects of a project group  for different platforms and build configurations in one step.

To make use of them you have to click onShowBuildGroups.bmp Show Build Groups Pane inside the Project Manager. This will attach a new window inside the Project Manager where you can manage your build groups.


For illustrations I am using the DataSnapDemos sample from Delphi here, but this should work with every project group.

First thing to do is create a new build group. Click the appropriate button CreateBuildGroup.bmp, enter a decent name and you end up with a list of all available projects from the current project group. By default each project comes with its current build configuration and platform.


Now click into the Configurations column of the DelphiDataSnapServer project. A second click will switch to edit mode which unveils an ellipsis button. Click it. From the configurations available for this project select the ones that should go into this build group.

Do the same for the Platforms column. You are prompted with a list of all platforms for the selected project.SelectPlatforms

After selecting the required configurations and platforms for each project in the group, you can compile, build or clean the whole pack with only one click. Very handy to make sure your changes actually compile when you are working with lots of {$IFDEF Debug}.


Oh, btw: You can have multiple build groups for different purposes or to target only part of the projects. Just select the projects you need.


Author: Uwe Raabe

Addicted to Pascal/Delphi since the late 70's