Build Automation is a feature of Xojo that allows you to automatically run “steps” before and after you build your project. Are you taking advantage of this useful feature?
A Built Step is an item that you add to your project. There are three specific Build Steps that you can use:
- Copy Files
- Script
- External Script
Each Build Step can run for Debug builds, Release builds or both.
To add a Build Step to your project, use the Insert button (or menu). Build Steps that are in the Contents section are inactive. To activate a Build Step, drag it onto a specific target in the Build Settings section. This adds a disclosure triangle to the target and adds a “Build” item beneath it. Put the Build Step before “Build” to have it run before the build is done and put it after the “Build” item to have it run after the build has been created.
The Copy Files step is used to copy files either before or after the build occurs. Often it is used after to copy specific files that are needed (perhaps resources) into a folder alongside the built app. There several output locations from which you can choose, including:
- App Parent Folder
- Resources Folder
- Frameworks Folder
- Bundle Parent Folder
- Contents Folder
The Script and External Script Built Steps let you run IDE Scripts as part of the build process. IDE Scripting was described in a previous blog post. Running them as part of the build process can be very handy. You can do things like change version information, modify properties and even run external commands from the Shell. One common use of an IDE Build Script is to code sign an application after it has been built.
If you use a tool on Windows to create your installer and it has a command-line version, you could event launch it as part of the build process to create your installer for you.
Here is a simple example of a Script Build Step. It simply saves the project before building it:
DoCommand("SaveFile")
For more information about Build Automation, refer to User Guide Book 3: Framework, Chapter 9: Building Your Applications, Section 2: Build Automation.