Running your first integration build analysis
In this topic: |
The steps in running your first analysis are:
- Create an integration project.
- Capture your build settings.
- Run the analysis.
- Check your build log for errors.
- Load the database.
Create an integration project
To create a project, run kwadmin create-project:
kwadmin --url http(s)://<host>:<port>/ create-project <project_name>
where
- <host> is the host name of the Klocwork Server.
- <port> is the port number for the Klocwork Server.
- <project_name> is a name for your project.
Project and build names must start with a letter or a digit. Period (.), minus sign (-), white space and the underscore character are also allowed in project and build names. Also note that each cannot be longer than 64 characters.
To reference a project on the command line, you must specify the project using the correct case (since project names are case sensitive). You must also specify the exact, current name of the project as it appears in Validate.
Example
kwadmin --url http://server2:8080/ create-project my_project
Capture your build settings
Details: Creating a Java build specification
Run an analysis using the build specification
To analyze your project, run kwbuildproject, specifying the name and server location of your project:
kwbuildproject --url http(s)://<host>:<port>/<project_name> --tables-directory <dir> [<options>] <build_specification1> [<build_specification2>...]
where:
- <host> is the host name of the Klocwork Server.
- <port> is the port number for the Klocwork Server.
- <project_name> is the name of the project you created above. The --url is not strictly a mandatory option, but the command will use your default installation if you don't specify a project and its Klocwork server location. This means that the analysis may not pick up the latest system build or any customized data such as configuration or KB files associated with the server project.
- <dir> is the output tables directory (mandatory argument).
- <options> are any of the options for kwbuildproject.
- <build_specification> is the build specification you generated earlier. You can specify any number of build specifications with this command.
Example
kwbuildproject --url http://server2:8080/my_project home/klocwork/myproject.out --tables-directory /my_tables
The kwbuildproject command runs in four stages:
- compilation
- issue detection
- linking
- report generation
Progress is displayed while the analysis is running. kwbuildproject returns error code 1 on any build failure (such as missing includes and compiler failures). If you see include errors, see Troubleshooting.
Check your build logs
When the analysis is complete, you can find the full build log (build.log) in the output tables directory. You can also view it in Validate. See Viewing integration build log files.
See also What's In Your Static Analysis Build Log and Why You Should Care.
Load the database
To load your analysis results into the Klocwork database, run kwadmin load:
kwadmin --url http(s)://<host>:<port>/ load <project_name> [<tables_directory>]
where
- <host> is the host name of the Klocwork Server
- <port> is the port number for the Klocwork Server
- <project_name> is the name of the project you created above
- <tables_directory> is the path to the Klocwork tables generated by kwbuildproject
Example:
kwadmin --url http://server2:8080/ load my_project /my_tables
Source files for the project are copied from the client side to the server side when the project is loaded into the Klocwork database. Source files as well as all include files are copied to the projects_root in a .ZIP archive.
What's next?
- Your development team can now connect to your integration project; see Fixing issues before check-in with Klocwork Desktop Analysis.
- You can view the results of your analysis, including metrics and reports, in Validate.