Create code snippets for Build Automator

Build Automator does not yet have the ability to include scripts which makes it a bit awkward and time consuming to use the same code in multiple scripts by duplicating the actions.

While the option to use include scripts, there is a simple but effective workaround for this problem. Select the block of actions that you want to use in multiple scripts and paste them into a text editor. What you get is an XML text that includes all the actions you specified. You can then open this xml file, copy the text from it and paste it into an appropriate place in your script.

What I do is save those code snippets as XML files in a subfolder from the project folder, that way it's easy to find them. Using variables to set values that are used in several places in the script makes it easier to work with as you only need to set them at the beginning of the copied code. In the screenshot below you can see the selected action items that are in one of my code snippets that updates and commits a project to Subversion using TortoiseProc.exe. I also extract the build number from the Subversion repository using a free SVN command line client, which will be included in the next major release of Build Automator.

Below I'm including the actual xml script, which I saved as "VersionControl_PrepareToCopy.xml"

Below is another script that I use to copy into projects after I have compiled the build, created the install and got everything done. It commits the project to the repository and then creates a tag with the latest build.

All you need to do to use those snippets is to copy them from this page and save them to file. Depending on the font size in your browser some of the code may wrap, but I don't think it should affect the text when you copy it into Build Automator. Some reformatting may also occur when you paste it into your xml document, depending on your editor. I start by creating a XML file in my editor, then copy the copied snippet in there and save it.