Build Script Fundamentals

A build script is made up of several elements. The main script consists of a single "project" element, which is broken down into "targets". Each target is then made up of "tasks", which perform an action such as compiling source code or compressing files.

Build Script Elements

project

The main node that is required by every build script. Use it to define the project's name and its default build target. It can also be used to set global properties that can be accessed by all targets.

target

A target is a collection of build tasks, similar to a function. It will run all of the tasks it contains, and it is commonly used to break a build file into more manageable chunks. For example, resource building can be done in a separate target that is included into the main build file. This keeps everything much cleaner, and also means that only certain targets can be run if so desired.

macro

Macros are small bits of code that BlitzBuild will evaluate when processing a property or arguments. They are enclosed in the following syntax: ${expression}. For example, the following macro would be expanded into the path of a BlitzPlus userlib named "myuserlib.dll": ${blitzplus::userlib('myuserlib.dll')}.

property

Properties are the BlitzBuild equivalent of variables. They can either be set in the main project node, where they will be globally accessible, or they can be set in tasks where they will only be accessed by the local task.

One important point is that property values are only processed when they are accessed by a task or function. For example, this means a property that gets its value from a folder's existence will have a different value if the folder is deleted during the script's execution.

task

Tasks are where the action in a build script occurs. Each task does a single job, such as compiling an executable or creating a directory.

More information: Task reference

function

A function is a small piece of code that can be used in parameters and properties. They're used to do jobs such as getting path names and manipulating strings.

More information: Function reference