Build Avoidance

Build Avoidance reduces the build time by using a built-in caching option, which enables you to rebuild only objects that were modified, and not the whole code base. The performance improvement will be mainly manifested from the second execution onward, after the cache is populated in the first build execution. Therefore, this feature is not useful for Single-Use VMs.

To use build avoidance, you use a command line switch when running each build which both checks to see if there is anything useful in the cache, and stores the build you are running in the cache for future use. Using build avoidance requires additional storage space, which is allocated on the Initiator machine for the cache. We recommend allocating at least twice the size of the project output folder.

You define whether the cache can be shared across multiple users ("shared"), or for a single user ("user"). In both cases, the cache can only be used on a single Incredibuild Initiator machine.

Configuring Build Avoidance Settings

The following commands can be used on the Initiator: 

  • Set the build avoidance cache. By default, the cache is 100GB, but you can modify it: 

    /opt/incredibuild/management/build_avoid_cache.sh <user|shared> set_size <size in GB>

  • Return information about the location and size of your build avoidance cache:

    /opt/incredibuild/management/build_avoid_cache.sh <user|shared> info

  • Clear the build avoidance cache:

    /opt/incredibuild/management/build_avoid_cache.sh <user|shared> clear

Running Builds using Build Avoidance

When running builds, add the following command line switches to use build avoidance. By default, the --avoid commands are OFF. When they are used, they apply only to the current build.

  • --avoid-<user|shared> activates build avoidance.

  • --avoid-basedir=<path> defines the base directory of your project. This information allows Incredibuild to utilize the caches from builds initiated from a different path.

For example:

ib_console --avoid-shared --avoid-basedir=/home/myuser/opencv/sources make -j 40