Running Klocwork in an IncrediBuild environment
This article explains how to run the Klocwork C/C++ integration build analysis in an environment where the build is distributed with Xoreax IncrediBuild.
Prerequisites
Before you can integrate IncrediBuild with Klocwork, ensure you have your Incredibuild software fully installed, and have valid licenses for both Incredibuild and Klocwork.
You also need the 'access Web API' permission in Klocwork. By default, this permission is assigned to project root admins and project admins. For more information about roles, see Setting up roles.
Generating a build trace file with IncrediBuild
A valid JSON build trace file is generated in the <incrediBuild-install-path>/temp folder each time an IncrediBuild accelerated build is performed. The file will be named using the following naming convention:
IbCodeAnalysis_SolutionName_TimeStamp.json
where SolutionName is the name of your solution and TimeStamp is a value defining the time at which the file was created.
See Build trace file format for information about the format of the trace file, or kwinject for details on how to generate a build specification.
Specifying your own build trace file name
You can specify your own custom file name and path by adding the /ca_fie=<file-path> on the BuildConsole command line. For example, /ca_file="C:\MyFile.JSon".
Distributing the analysis
<server_install>\config\xgProfile.xml
Run the integration build analysis tool, kwbuildproject, indirectly through this XGE profile. Include all of the kwbuildproject options you require:
xgConsole /profile="<server_install>\config\xgProfile.xml" /command="kwbuildproject -j<N> ..."
where<N> is the number of parallel threads to be used for the integration build analysis. This number must match the number of IncrediBuild agents that will be used.
Troubleshooting the analysis
If you run into problems with your IncrediBuild analysis, try performing the following steps:
- In the Agent Settings dialog, on the Agent|General page, set your logging level to Extended and enable generate detailed logs for locally executed tasks.
- Run your build.
- Double-click the IncrediBuild tray icon, then in the Build Monitor screen, click File -> Save Monitor File As... to save the execution monitor progress file (.ib_mon file).
- Contact IncrediBuild Customer Support and be sure to attach your monitor progress file.
- Restore your logging level back to Minimal.
Defining custom steps or build tools
By default, IncrediBuild does not account for custom steps or external build tools as part of your build process. As a result, information about these tools will not be recorded in any generated build trace file.
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <Profile FormatVersion="1"> <Tools> <Tool Filename="a" AllowIntercept="true" /> <Tool Filename="b" AllowIntercept="true" /> </Tools> </Profile>
To specify the .xml file to IncrediBuild:
In Visual Studio: name the .xml file according to the following format:
<solution_name>.ib_profile.xml
where solution_name is the name of your current solution. Place the file in the same folder as your solution file.
On the command line: add the following switch to the BuildConsole command line:
/profile=<profile.xml_file_path>
where <profile.xml_file_path> is the location and file name of your .xml file.
Limitations
- Klocwork supports only C/C++ projects distributed under IncrediBuild.
- Klocwork does not support distributing the analysis in Visual Studio.
- The xgConsole tool suppresses the "Progress NN%" messages that the Klocwork analysis tools print to the console.