Accelerating Build Steps in Visual Studio
A custom build step, event, or tool, can be further broken down into smaller tasks, and parallelized to achieve further acceleration. This allows for the distribution and parallelization at the process level. To get the most value from this feature, we strongly recommend using the following settings:- Predictive execution is enabled
- UseMSBuild is not used
- The build is not executed with “build regardless of errors”
Note: You can integrate the profile XML file into Visual Studio.
Distributing Tasks
By default, custom steps, exec tasks, and special build tools are not distributed to remote agents. In order to allow Incredibuild to distribute and manage these tasks, use a profile XML file.- In the Incredibuild BuildConsole command, use the /profile directive to specify a profile for Incredibuild to use: /profile=[profile_file_name].xml -or-
-
If you are building from within Visual Studio, or would like your solution to have a default profile to use (per solution), create a [solution_folder][solution_name].ib_profile.xml profile XML file. This profile is automatically loaded by Incredibuild if no profile file is specified with the /profile=[profile_file_name].xml switch.
The following XML file instructs Incredibuild to distribute every gawk task executed by the build (there is no need to specify the file extension for gawk.exe):
Copy
Batching Tasks
Use the MSBuild engine, which executes all custom build tools and rules within the context of a single project in a sequential manner, on a single CPU core. For example, a custom build tool running moc.exe (as in the GUI SDK QT) is executed in a sequential manner in project A for each file that needs to be generated. Specifying a tool name, for example, moc.exe, in your Incredibuild profile XML with the AllowPredictedBatch option, instructs Incredibuild to execute this tool in parallel, resulting in a significant performance boost. As the tool now runs in a parallel manner, it can also be configured to be distributed to remote machines. Parallelization is applied until a different executable is invoked (for example, CL or LINK). The tools that can be safely accelerated with this feature must have the following characteristics:- Two instances of the executable do not attempt to write to the same file (e.g. output file, log file).
- None of the instances of the executable should be dependent on anything that the other instances do. For example, one instance does not depend on the output file of another instance, and none of the instances deletes any files or folders thgat the other instances use).
- Add the AllowPredictedBatch=“true” tool tag to your solution’s .ib_profile.xml.
Usage Example
If your solution name file is my_solution.sln, and you would like to parallelize and distribute moc.exe execution:- Add the file my_solution.ib_profile.xml to the folder where my_solution.sln resides. This applies the profile to any build of this solution run from within Visual Studio.
- Alternatively, if building from the command line, use the /profile switch to specify the profile file: Buildconsole my_solution.sln /rebuild /cfg=”debug|win32” /profile=”my_solution.ib_profile.xml”