Using PVS-Studio with huge projects (MSBuild integration)
Upcoming SlideShare
Loading in...5
×
 

Using PVS-Studio with huge projects (MSBuild integration)

on

  • 268 views

If your solution includes a lot of large projects, you may find it uncomfortable to operate the PVS-Studio analyzer when checking it. In this small post we'll explain why it happens and how ...

If your solution includes a lot of large projects, you may find it uncomfortable to operate the PVS-Studio analyzer when checking it. In this small post we'll explain why it happens and how integrating PVS-Studio into MSBuild's build process will help you to improve the situation.

Statistics

Views

Total Views
268
Views on SlideShare
268
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Using PVS-Studio with huge projects (MSBuild integration) Using PVS-Studio with huge projects (MSBuild integration) Document Transcript

  • Using PVS-Studio with huge projects (MSBuild integration) Author: Andrey Karpov Date: 18.04.2013 If your solution includes a lot of large projects, you may find it uncomfortable to operate the PVS-Studio analyzer when checking it. In this small post we'll explain why it happens and how integrating PVS-Studio into MSBuild's build process will help you to improve the situation. I want to make it clear right away that the analyzer's operation mode described below should be used only in rare cases when dealing with huge projects. You'll get no benefit from using it for small and medium projects - in fact analysis may even get much slower. But let's assume your case is just that rare one - your solution includes quite a lot of projects, and the total number of files to be compiled is many thousands. The PVS-Studio analyzer uses the API functions provided by Visual Studio to gather information about files. It needs to know which files should be checked, which preprocessor definitions are specified for each file, which directories with header files should be used, and so on. If there are a lot of projects and files, data gathering takes too much time. PVS-Studio meditates for a long time before starting analysis. It is especially noticeable with incremental analysis. It often happens that data gathering is several times longer than the analysis of a few changed files itself. We can't fix that because we cannot speed up calls of API functions. But there is a workaround: integration into MSBuild's build process. We won't discuss how to get started with MSBuild in this post. This aspect is described very thoroughly in the documentation, and we find it senseless to copy text from there. Something may change in time, and this blog post will become obsolete. That's why we refer readers to the documentation section for more information: "Direct integration of PVS-Studio into MSBuild's build process. MSBuild integration mode in Visual Studio IDE". Let's only enumerate advantages and disadvantages of the integration method here. Advantages: 1) The analyzer doesn't need to gather information about files - MSBuild will provide it with all the necessary data. This will significantly reduce analysis time in projects containing a huge number of files. 2) In case of incremental analysis, MSBuild will run a check only for the files which have been changed and provide you with all the information you need. Therefore, using the incremental analysis mode with large projects becomes quite convenient.
  • 3) You can check projects which are extensions to the standard Visual C++ project model (for example driver projects). Any Visual C++ user can extend the project model to add their own specific build parameters into it. But if the project is being built by MSBuild, you can integrate analysis by PVS-Studio into it, while the common operation mode of PVS-Studio as a plugin doesn't always work correctly in this case, as the extended project model won't be represented in Visual Studio Extensibility API. 4) Since analysis by PVS-Studio is integrated into the build process, you can check a project (while building it) on a system without IDE: for example on the build server during night builds. Disadvantages: 1) Since it is MSBuild that launches the analyzer, it also appears to be responsible for parallelization. MSBuild parallelizes the build process at the project level: an individual MSBuild instance is launched for each project, which in its turn calls an individual PVS-Studio instance. The drawback here is that you can't analyze files within the framework of one project in parallel. 2) Integration into MSBuild requires modifying the project file (*.vcxproj).