Providing a build specification template for your developers
Normally, developers working at their desktops each create their own build specifications, either manually, or automatically as part of the Klocwork analysis.
A build specification template is a version of build specification that uses variables for any paths that may differ on developer desktops. The build engineer can create one file that can be shared with all developers. When the build specification template is used to run a Klocwork analysis, the variable references are replaced with variable values.
This means that a build specification created in one build environment can be used in another build environment.
To effectively use a server project build specification template in a desktop project, these requirements must be met:
- Compiler versions and default compilation flags are the same on the server side as they are on the desktop.
- Users do not add or remove files or change compilation flags on their desktop projects. (If users add files or change compilation flags, then these files won't be included in the analysis, leading to less accurate results.)
A build specification template can be useful in an environment such as the following:
- a large project is built regularly on a server
- a number of users maintain a working copy of the same project on other machines
- users are not allowed to make any changes to the build process and/or do not want to run a full build on the client side; they work with one small component at a time
- users want to use the full build specification to get the benefits of inter-component Klocwork analysis
- the project layout may be the same on the server and the client machines, but the path to the source root directory is different
Overview of creating and using a build specification template
- You create the build specification template as shown in this section. The file must have the extension .tpl.
- You import the build specification template into the integration project with kwadmin import-config.
- You tell the development team what variables you have created in the build specification template.
- Unless you have only used the kwpsroot variable, developers map the variables in the template to local paths. See Using build settings from the integration project.
- Developers run a Klocwork analysis. Because of the connection to the integration project, kwcheck and Klocwork Desktop retrieve and use the build specification template file automatically.
Alternatively, you can use the build specification template with kwbuildproject. See Using a build specification template with kwbuildproject.
The kwpsroot variable
The kwpsroot variable is a variable used in a build specification template that is automatically substituted with the name of the parent directory of the kwcheck project settings directory (named .kwps by default).
For example, if the path to .kwps is /home/joeuser/dev/myproject/.kwps, then %kwpsroot% will be expanded to /home/joeuser/dev/myproject.
If all paths in the project may be specified relative to the location of the .kwps parent directory, the build team needs to define only the kwpsroot variable with the --variable option of kwinject. In this case, developers do not have to set variable values with kwcheck set-var.