Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for TFS team builds (MSBuild .SonarQube.Runner) #616

Closed
Bertk opened this issue Aug 24, 2015 · 20 comments
Closed

Support for TFS team builds (MSBuild .SonarQube.Runner) #616

Bertk opened this issue Aug 24, 2015 · 20 comments
Assignees

Comments

@Bertk
Copy link
Contributor

Bertk commented Aug 24, 2015

@guwirth, @wenns, @jmecosta: Shouldn't we add this to the Wiki?
The new SQ tool “MSBuild SonarQube Runner” simplifies the TFS Team build integration and I could successfully analyze the CppCheck C++ sources using the C++ Community plug-in. I followed the installation description form Microsoft ALM rangers SonarQube Setup Guide For .NET Users and used for my tests the TFS 2015 Express edition.
My goal was to use MSVC++, PC-lint, CppCheck, RATS and Vera++ reports for a daily build scenario. All tool reports are created and stored in the SQ DB with one build and after a small modification to support the MSVC++ solution log (df04208) also the compiler warnings showed up. The SQ instance has now a multi-module project based on the Visual Studio solution file 😁
I used the following C++ VS property file for the MS-Build configuration “SonarQube.StaticAnalysis.props”:

SonarQube.StaticAnalysis.props was replaced with updated version - see below

I added this property file to the folder with the solution file and added the reference to the usual import groups settings of the visual studio project:

...
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
    <Import Project="$(SolutionDir)\SonarQube.StaticAnalysis.props" />
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
  </ImportGroup>
...

Final statement ->

This works also for C++

and the TFS build report shows this:
capture

@guwirth
Copy link
Collaborator

guwirth commented Aug 27, 2015

Sounds also interesting for others and should be documented.

@jmecosta
Copy link
Member

I have a few ideas on how to improve this, I will comment later as soon as
I find the time to work on this on our projects

On Thu, Aug 27, 2015, 16:44 Günter Wirth [email protected] wrote:

Sounds also interesting for others and should be documented.


Reply to this email directly or view it on GitHub
#616 (comment).

@Bertk
Copy link
Contributor Author

Bertk commented Aug 27, 2015

@jmecosta: What kind of improvement do you have in mind? I want to replace the windows batch with MSBuild commands in SonarQube.StaticAnalysis.props. I plan to do this some when in October.

@jmecosta
Copy link
Member

I have msbuild tasks and nuget packages for all those commands. see

https://github.com/jmecosta/MSBuild-SonarQube-CXX

i might add those ones to gallery so you can try... in the end you just
need to install the packages for the projects you want to analyse and the
tools run after the build

On Thu, Aug 27, 2015, 21:41 Bert [email protected] wrote:

@jmecosta https://github.com/jmecosta: What kind of improvement do you
have in mind? I want to replace the windows batch with MSBuild commands in
SonarQube.StaticAnalysis.props. I plan to do this some when in October.


Reply to this email directly or view it on GitHub
#616 (comment).

@Bertk
Copy link
Contributor Author

Bertk commented Aug 27, 2015

I see - I did not use F# until now and thought about a simple MSBuild core functionality but anyway if you have a solution this is highly appreciated.
Do you have also a solution for the project related include folders located above the project root folder? I also wanted to use a "before build copy task" and tweak the include folder list to get this stored in the DB.

@jmecosta
Copy link
Member

You mean automatically generate the includes based on the project file? I
would for this create a logger task and use it to generate the list of
includes and defines, should be doable

Why do you need to before the build target?

I will try to work on this in September I hope I can put a small working
scenario and include it in repository.

On Thu, Aug 27, 2015, 22:31 Bert [email protected] wrote:

I see - I did not use F# until now and thought about a simple MSBuild core
functionality but anyway if you have a solution this is highly appreciated.
Do you have also a solution for the project related include folders
located above the project root folder? I also wanted to use a "before build
copy task" and tweak the include folder list to get this stored in the DB.


Reply to this email directly or view it on GitHub
#616 (comment).

@guwirth guwirth added this to the M 0.9.4 milestone Sep 3, 2015
@guwirth guwirth removed this from the M 0.9.4 milestone Oct 19, 2015
@Bertk
Copy link
Contributor Author

Bertk commented Dec 29, 2015

I enhanced the MS-Build configuration SonarQube.StaticAnalysis.props and now the batch file is obsolete. This is still not perfect but usable 😉

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup Label="UserMacros">
        <SQLogLevel>INFO</SQLogLevel>
        <SQCompiler>Visual C++</SQCompiler>
        <SQCompilerLog>$(SolutionDir)$(SolutionName).log</SQCompilerLog>
        <SQCompilerFF>UTF-16</SQCompilerFF>
        <SQProjectFile>$(MSBuildProjectFullPath.Replace('\', '\\'))</SQProjectFile>
        <!-- regex for VS log file without parallel build parameter "/maxcpucount:xx" -->
        <SQCompilerRegEx>^(.*)\((\d+)\)\x20*:\x20warning\x20(C\d+):\x20(.*)\x20\[$(SQProjectFile)\]$</SQCompilerRegEx>
        <SQCppCheckReport>cppcheck-report.xml</SQCppCheckReport>
        <SQPClintReport>pclint-report.xml</SQPClintReport>
        <SQVeraReport>vera-report.xml</SQVeraReport>
        <SQRatsReport>rats-report.xml</SQRatsReport>
        <SQCoverageReport>$(MSBuildProjectName).coveragexml</SQCoverageReport>
        <SQTestReport>$(MSBuildProjectName).trx</SQTestReport>
        <SQTestPattern>.*[ui]Test.*|Test.*|.*Tests?</SQTestPattern>
        <SQSourceFiles>.cc,.cpp,.c,.cu</SQSourceFiles>
        <SQHeaderFiles>.h,.hh,.hpp,.inl,.cuh,.inc,.cuinc</SQHeaderFiles>
        <SQForceInclude>sonar-defines.h</SQForceInclude>
        <CppCheckFast>true</CppCheckFast>
        <!--ToDo adapt tool installation path -->
        <SQInclude>../../src/_Globals/Include</SQInclude>
        <!--PC-lint does not support C++11 yet -->
        <PCLINT_SETTING>..\..\src\_Globals\PC-lint\VS2012.lnt</PCLINT_SETTING>
        <SQTools>D:\sonar-tools</SQTools>
        <PCLINT_ROOT>$(SQTools)\PC-Lint9</PCLINT_ROOT>
        <CPPCHECK_ROOT>$(SQTools)\Cppcheck</CPPCHECK_ROOT>
        <VERA_ROOT>$(SQTools)\Vera++-1.3.0.win</VERA_ROOT>
        <RATS_ROOT>$(SQTools)\rats-2.3</RATS_ROOT>
    </PropertyGroup>
<!--
***********************************************************************************************
SonarQube.StaticAnalysis.props

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

***********************************************************************************************
-->
    <!-- Specify the ItemGroups to be analyzed
  <PropertyGroup Condition=" $(SonarQubeTempPath) != '' ">
    <SQAnalysisFileItemTypes>Compile;Content;EmbeddedResource;None;ClCompile;ClInclude;CudaCompile;Page;TypeScriptCompile</SQAnalysisFileItemTypes>
  </PropertyGroup>
 -->
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <RunCodeAnalysis>true</RunCodeAnalysis>
    <CodeAnalysisRuleSet>$(SolutionDir)_Globals\SCA\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <RunCodeAnalysis>true</RunCodeAnalysis>
    <CodeAnalysisRuleSet>$(SolutionDir)_Globals\SCA\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
    <!-- Define the list of files for analysis -->
    <ItemGroup>
        <CppFiles Include="**/*.cpp" />
        <CppFiles Include="**/*.c" />
        <CppFiles Include="**/*.inl" />
        <CppFiles Include="**/*.h" />
        <CppFiles Include="**/*.hpp" />
    </ItemGroup>

    <PropertyGroup>
        <CppCheckInclude>CppCheck.includes</CppCheckInclude>
        <LintMacros>mac-msc.cpp.lnt</LintMacros>
        <LintProject>$(ProjectDir)$(ProjectName).lnt</LintProject>
        <LintStdAfx>StdAfx.lph</LintStdAfx>
    </PropertyGroup>     

    <Target Name="PC-lint" Condition="'$(BuildCmd)'!='Clean' And Exists('$(PCLINT_ROOT)')" AfterTargets="Build" Outputs="$(ProjectDir)$(SQPClintReport)" DependsOnTargets="UnitTestCheck">
        <PropertyGroup>
           <LintDefines>-D$([System.String]::Copy(&quot;%(ClCompile.PreprocessorDefinitions)&quot;).TrimEnd(';').Replace(&quot;;&quot;,&quot; -D&quot;)) </LintDefines>
        </PropertyGroup>
        <Message Text="LintDefines = $(LintDefines)"/>
        <!-- delete old report file -->
        <Delete Files="$(ProjectDir)$(SQPClintReport)" Condition="'$(IsUnitTest)'=='False'" />
        <!-- create a project lint file -->
        <Delete Files="$(LintProject)" Condition="'$(IsUnitTest)'=='False'" />
        <WriteLinesToFile Condition="'@(ClCompile)' != ''" File="$(LintProject)" Lines="%(ClCompile.RelativeDir)%(ClCompile.Filename)%(ClCompile.Extension)" Overwrite="false" Encoding="ASCII"/>
        <!-- create lint defines from macros -->
        <Exec Condition="'@(ClCompile)' != '' And '$(IsUnitTest)'=='False'" Command="cl.exe /EP /C /MD /GR /EHsc $(PCLINT_ROOT)\macros-msc.cpp &gt;&quot;$(LintMacros)&quot;" />
        <!-- add include folders -->
        <WriteLinesToFile Condition="'$(Include)' != '' And '$(IsUnitTest)'=='False'" File="$(LintMacros)" Lines="-i&quot;$(Include.TrimEnd(';').replace(`;`, `&quot;%0a-i&quot;`))&quot;" Overwrite="false" Encoding="ASCII"/>
        <WriteLinesToFile Condition="'%(ClCompile.AdditionalIncludeDirectories)' != ''" File="$(LintMacros)" Lines="-i&quot;$([System.String]::Copy(&quot;%(ClCompile.AdditionalIncludeDirectories)&quot;).TrimEnd(';').Replace(&quot;;&quot;,&quot;%22%0a-i%22&quot;))&quot;" Overwrite="false" Encoding="ASCII"/>
        <RemoveDupLine FilePath='$(LintMacros)' ContinueOnError='true'/>
        <!-- execute pclint analysis -->
        <Exec Condition="'@(ClCompile)' != '' And '$(IsUnitTest)'=='False'" Command="$(PCLINT_ROOT)\LINT-NT.EXE -i&quot;$(PCLINT_ROOT)&quot; -i&quot;$([System.IO.Path]::GetDirectoryName($(PCLINT_SETTING)))&quot; $(PCLINT_SETTING) &quot;$(LintMacros)&quot; $(LintDefines) -i$(IntDir) -pch(stdafx.h) &quot;$(LintProject)&quot;" IgnoreExitCode="yes" />
        <!-- remove temp file -->
        <Delete Files="$(ProjectDir)$(LintStdAfx)" Condition="'$(IsUnitTest)'=='False'" />
    </Target>

    <Choose>
        <When Condition=" '$(Platform)'=='x64' ">
            <PropertyGroup>
                <CppCheckPlatform>win64</CppCheckPlatform>
            </PropertyGroup>
        </When>
        <When Condition=" '$(Platform)'=='win32' ">
            <Choose>
                <When Condition=" '$(Characterset)'=='Unicode'">
                    <PropertyGroup>
                        <CppCheckPlatform>win32W</CppCheckPlatform>
                    </PropertyGroup>
                </When>
                <When Condition=" '$(Characterset)'=='MultiByte'">
                    <PropertyGroup>
                        <CppCheckPlatform>win32W</CppCheckPlatform>
                    </PropertyGroup>
                </When>
                <Otherwise>
                    <PropertyGroup>
                        <CppCheckPlatform>win32A</CppCheckPlatform>
                    </PropertyGroup>
                </Otherwise>
            </Choose>
        </When>
        <Otherwise>
            <PropertyGroup>
                <CppCheckPlatform>native</CppCheckPlatform>
            </PropertyGroup>
        </Otherwise>
    </Choose>

    <Target Name="CppCheck" Condition="'$(BuildCmd)'!='Clean' And Exists('$(CPPCHECK_ROOT)')" AfterTargets="Build" Outputs="$(ProjectDir)$(SQCppCheckReport)" DependsOnTargets="UnitTestCheck">
        <PropertyGroup>
          <CppDefines>-D$([System.String]::Copy(&quot;%(ClCompile.PreprocessorDefinitions)&quot;).TrimEnd(';').Replace(&quot;;&quot;,&quot; -D&quot;)) </CppDefines>
        </PropertyGroup>
        <Delete Files="$(CppCheckInclude)" Condition="'$(IsUnitTest)'=='False'"/>
        <WriteLinesToFile Condition="'$(Include)' != '' And '$(CppCheckFast)' != 'true' And '$(IsUnitTest)'=='False'" File="$(CppCheckInclude)" Lines="$(Include.replace(`;`, `%0a`))" Overwrite="false" Encoding="ASCII"/>
        <WriteLinesToFile Condition="'%(ClCompile.AdditionalIncludeDirectories)' != '' And '$(IsUnitTest)'=='False'" File="$(CppCheckInclude)" Lines="%(ClCompile.AdditionalIncludeDirectories)" Overwrite="false" Encoding="ASCII"/>
        <WriteLinesToFile Condition="'%(ClCompile.AdditionalIncludeDirectories)' == '' And '$(IsUnitTest)'=='False'" File="$(CppCheckInclude)" Lines="%0a" Overwrite="false" Encoding="ASCII"/>
        <RemoveLine FilePath='$(CppCheckInclude)' SearchText='..\..\..\boost\include' ContinueOnError='true'/>
        <RemoveDupLine FilePath='$(CppCheckInclude)' ContinueOnError='true'/>
        <Exec Condition="'@(ClCompile)' != '' And '$(IsUnitTest)'=='False'" Command="$(CPPCHECK_ROOT)\cppcheck.exe -v -q --platform=$(CppCheckPlatform) --enable=all --xml-version=2 --includes-file=$(CppCheckInclude) $(CppDefines) @(CppFiles->'%(Identity)', ' ') 2&gt;&quot;$(ProjectDir)$(SQCppCheckReport)&quot;" IgnoreExitCode="yes" />
    </Target>

    <Target Name="Vera" Condition="'$(BuildCmd)'!='Clean' And Exists('$(VERA_ROOT)')" AfterTargets="Build" Outputs="$(ProjectDir)$(SQVeraReport)" DependsOnTargets="UnitTestCheck">
        <Exec Condition="@(CppFiles)!='' And '$(IsUnitTest)'=='False'" Command="dir /s /B *.c *.cpp *.h *.hpp *.inl *.inc | $(VERA_ROOT)\bin\vera++.exe --root $(VERA_ROOT)\lib\vera++ --profile full --no-duplicate --show-rule --checkstyle-report &quot;$(ProjectDir)$(SQVeraReport)&quot;" ContinueOnError='true' IgnoreExitCode="yes" />
    </Target>

    <Target Name="Rats" Condition="'$(BuildCmd)'!='Clean' And Exists('$(RATS_ROOT)')" AfterTargets="Build" Outputs="$(ProjectDir)$(SQRatsReport)" DependsOnTargets="UnitTestCheck">
        <Exec Condition="@(CppFiles)!='' And '$(IsUnitTest)'=='False'" Command="$(RATS_ROOT)\rats.exe -w 3 --xml @(CppFiles->'%(Identity)', ' ') &gt;&quot;$(ProjectDir)$(SQRatsReport)&quot;" Timeout="300000" ContinueOnError='true' IgnoreExitCode="yes" />
    </Target>

    <Target Name = "UnitTestCheck" AfterTargets="Build">
        <PropertyGroup>
            <IsUnitTest>False</IsUnitTest>
        </PropertyGroup>
        <PropertyGroup Condition="'$([System.Text.RegularExpressions.Regex]::Match($(ProjectName), $(SQTestPattern)))' != ''">
            <IsUnitTest>True</IsUnitTest>
        </PropertyGroup>
        <Message Text="IsUnitTest = $(IsUnitTest)"/>
    </Target>
    
    <Target Name = "SQEnvCheck" AfterTargets="Build">
        <Message Text="sonar.log.level               = $(SQLogLevel)"/>
        <Message Text="sonar.cxx.compiler.reportPath = $(SQCompilerLog)"/>
        <Message Text="sonar.cxx.compiler.parser     = $(SQCompiler)"/>
        <Message Text="sonar.cxx.compiler.charset    = $(SQCompilerFF)"/>
        <Message Text="sonar.cxx.compiler.regex      = $(SQCompilerRegEx)"/>
        <Message Text="sonar.cxx.cppcheck.reportPath = $(SQCppCheckReport)"/>
        <Message Text="sonar.cxx.pclint.reportPath   = $(SQPClintReport)"/>
        <Message Text="sonar.cxx.vera.reportPath     = $(SQVeraReport)"/>
        <Message Text="sonar.cxx.rats.reportPath     = $(SQRatsReport)"/>
        <Message Text="sonar.cxx.coverage.reportPath = $(SQCoverageReport)"/>
        <Message Text="sonar.cxx.vstest.reportPaths  = $(SQTestReport)"/>
        <Message Text="sonar.cxx.suffixes.sources    = $(SQSourceFiles)"/>
        <Message Text="sonar.cxx.suffixes.headers    = $(SQHeaderFiles)"/>
        <Message Text="sonar.cxx.forceIncludes       = $(SQForceInclude)"/>
        <RemoveDuplicates Inputs="@(ClCompile->'%(AdditionalIncludeDirectories)')">
            <Output
                TaskParameter="Filtered"
                ItemName="FilteredItems"/>
        </RemoveDuplicates>         
        <PropertyGroup Label="UserMacros">        
            <AddIncludes>@(FilteredItems)</AddIncludes>
            <SQIncludeDirectories Condition="'$(AddIncludes)'!=''">$(IncludePath.TrimEnd(';').replace(';', ',').replace('\','/')),$(AddIncludes.TrimEnd(';').replace(';',',').replace('\','/')),$(SQInclude)</SQIncludeDirectories>
        <SQIncludeDirectories Condition="'$(AddIncludes)'==''">$(IncludePath.TrimEnd(';').replace(';', ',').replace('\','/')),$(SQInclude)</SQIncludeDirectories>
        </PropertyGroup>
        <ItemGroup>
          <SonarQubeSetting Include="sonar.cxx.includeDirectories">
            <Value>$(SQIncludeDirectories)</Value>
          </SonarQubeSetting>
        </ItemGroup>
        <Message Text="sonar.cxx.includeDirectories  = $(SQIncludeDirectories)"/>
    </Target>
	
    <PropertyGroup>
        <MSBuildTaskAssembly Condition="'$(MSBuildToolsVersion)'&lt;'14.0'" >$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll</MSBuildTaskAssembly>
        <MSBuildTaskAssembly Condition="'$(MSBuildToolsVersion)'&gt;='14.0'" >$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll</MSBuildTaskAssembly>
    </PropertyGroup>

  <UsingTask TaskName="RemoveLine" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildTaskAssembly)">
    <ParameterGroup>
      <!--The file path is the full path to the text file-->
      <FilePath ParameterType="System.String" Required="true" />
      <!--The searchText will be removed-->
      <SearchText ParameterType="System.String" Required="true" />
    </ParameterGroup>
    <Task>
      <Code Type="Fragment" Language="cs">
        <![CDATA[
        if (System.IO.File.Exists(FilePath))
        {
            Log.LogMessage("Remove string '{0}'.", SearchText);
            var content = string.Empty;
            using (System.IO.StreamReader reader = new StreamReader(FilePath))
            {
                content = reader.ReadToEnd();
                reader.Close();
            }

            content = content.Replace(SearchText, "");

            using (System.IO.StreamWriter writer = new StreamWriter(FilePath))
            {
                writer.Write(content);
                writer.Close();
            }
        }
  ]]>
      </Code>
    </Task>
  </UsingTask>

  <UsingTask TaskName="RemoveDupLine" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildTaskAssembly)">
  <ParameterGroup>
      <!--The file path is the full path to the text file-->
      <FilePath ParameterType="System.String" Required="true" />
    </ParameterGroup>
    <Task>
      <Code Type="Fragment" Language="cs">
        <![CDATA[
  if (System.IO.File.Exists(FilePath))
    {
    string tempName = System.IO.Path.GetFileNameWithoutExtension(FilePath) + ".bak";
    System.IO.File.Copy(FilePath, tempName, true);
    System.IO.File.Delete(FilePath);
    
    var sr = new  System.IO.StreamReader(tempName);
    var sw = new  System.IO.StreamWriter(FilePath);
    var lines = new System.Collections.Generic.HashSet<int>();
    while (!sr.EndOfStream)
    {
        string line = sr.ReadLine();
        if (line.Length == 0)
            continue;
        int hc = line.GetHashCode();
        if(lines.Contains(hc))
            continue;

        lines.Add(hc);
        sw.WriteLine(line);
    }
    sw.Flush();
    sw.Close();
    sr.Close();
    }
  ]]>
      </Code>
    </Task>
  </UsingTask>  
 
    <ItemGroup>
        <SonarQubeSetting Include="sonar.log.level">
            <Value>$(SQLogLevel)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.compiler.reportPath">
            <Value>$(SQCompilerLog)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.compiler.parser">
            <Value>$(SQCompiler)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.compiler.charset">
            <Value>$(SQCompilerFF)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.compiler.regex">
            <Value>$(SQCompilerRegEx)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.cppcheck.reportPath">
            <Value>$(SQCppCheckReport)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.pclint.reportPath">
            <Value>$(SQPClintReport)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.vera.reportPath">
            <Value>$(SQVeraReport)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.rats.reportPath">
            <Value>$(SQRatsReport)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.coverage.reportPath">
            <Value>$(SQCoverageReport)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.vstest.reportPaths">
            <Value>$(SQTestReport)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.suffixes.sources">
            <Value>$(SQSourceFiles)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.suffixes.headers">
            <Value>$(SQHeaderFiles)</Value>
        </SonarQubeSetting>
        <SonarQubeSetting Include="sonar.cxx.forceIncludes">
            <Value>$(SQForceInclude)</Value>
        </SonarQubeSetting>
    </ItemGroup>

    <ItemGroup>
        <BuildMacro Include="SQCompiler">
            <Value>$(SQCompiler)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQProjectFile">
            <Value>$(SQProjectFile)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro> 
        <BuildMacro Include="SQCompilerLog">
            <Value>$(SQCompilerLog)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQCompilerFF">
            <Value>$(SQCompilerFF)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQCompilerRegEx">
            <Value>$(SQCompilerRegEx)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQCppCheckReport">
            <Value>$(SQCppCheckReport)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQPClintReport">
            <Value>$(SQPClintReport)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQVeraReport">
            <Value>$(SQVeraReport)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQRatsReport">
            <Value>$(SQRatsReport)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQCoverageReport">
            <Value>$(SQCoverageReport)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQTestReport">
            <Value>$(SQTestReport)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQSourceFiles">
            <Value>$(SQSourceFiles)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="SQHeaderFiles">
            <Value>$(SQHeaderFiles)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
        <BuildMacro Include="PCLINT_ROOT">
            <Value>$(PCLINT_ROOT)</Value>
            <EnvironmentVariable>true</EnvironmentVariable>
        </BuildMacro>
    </ItemGroup>
</Project>

@jmecosta
Copy link
Member

@Bertk did you tried the https://github.com/jmecsoftware/sonar-cxx-msbuild-tasks/releases ? the reason i mention this is that you dont need to patch anything in the SonarQube.StaticAnalysis.props (it will do it for you). perhaps you could try and try to merge some of the missing things you have defined above

@Bertk
Copy link
Contributor Author

Bertk commented Dec 30, 2015

@jmecosta I just tried to install the Nuget packages for CppCheck, RatsCheck and VeraCheck but VS freezes while the installation for the projects is done and only a small number of projects is initialized.
I use VS2015 Update 1 with enabled C++ experimental features on a Hyper-V Windows 10 system (2 cores). Looks like a synchronizing issue and I used the CUDA 7.5 samples with 143 projects.

@jmecosta
Copy link
Member

You don't need to install the nuget packages. You can use the 1.3 of the
cxxmsbuildwrapper to do everything .

Anyway for the nugets try installing from vs console with detailed info,
the packages they just install a target file. They don't do anything
special that would cause the freeze

On Wed, Dec 30, 2015, 08:34 Bert [email protected] wrote:

@jmecosta https://github.com/jmecosta I just tried to install the Nuget
packages for CppCheck, RatsCheck and VeraCheck but VS freezes while the
installation for the projects is done and only a small number of projects
is initialized.
I use VS2015 Update 1 with enabled C++ experimental features on a Hyper-V
Windows 10 system (2 cores). Looks like a synchronizing issue and I used
the CUDA 7.5 samples with 143 projects.


Reply to this email directly or view it on GitHub
#616 (comment)
.

@Bertk
Copy link
Contributor Author

Bertk commented Dec 30, 2015

The NuGet manager updates the project file for example with:

  <ImportGroup Label="ExtensionTargets">
    <Import Project="$(CUDAPropsPath)\CUDA 7.5.targets" />
    <Import Project="..\..\packages\VeraTask.1.0.4\build\VeraTask.targets" Condition="Exists('..\..\packages\VeraTask.1.0.4\build\VeraTask.targets')" />
  </ImportGroup>
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\..\packages\VeraTask.1.0.4\build\VeraTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\VeraTask.1.0.4\build\VeraTask.targets'))" />
  </Target>

The 3 packages are installed already but without this entries the package dependency is not defined?
I will check it tomorrow.

@jmecosta
Copy link
Member

That is what is suppose to do. Just adds those target files. Not sure what
you mean by package dependency. There shouldn't be any

On Wed, Dec 30, 2015, 11:56 Bert [email protected] wrote:

The NuGet manager updates the project file for example with:

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.

The 3 packages are installed already but without this entries the package
dependency is not defined?
I will check it tomorrow.


Reply to this email directly or view it on GitHub
#616 (comment)
.

@Bertk
Copy link
Contributor Author

Bertk commented Dec 31, 2015

@jmecosta I created some issues for sonar-cxx-msbuild-tasks and will continue testing next week. Further results will be available here https://github.com/jmecsoftware/sonar-cxx-msbuild-tasks.

I should have been more precise - at least the build depends on the packages in regards to static code analysis results.

@jmecosta
Copy link
Member

@Bertk you mean for example vera++ does not get installed with the nuget package. its kind of one purpose, you need to install those and pass the paths as arguments to the build.

thats the reason, why i prefer the runner since its installs everything for you.

we use those nuget packages because we have a main configuration.props that contains those definitions.

i am ensure if even i can redistribute those with the nuget package i am ensure about the licensing on those

@Bertk
Copy link
Contributor Author

Bertk commented Apr 17, 2016

@guwirth @jmecosta I suggest to close this topic but want to keep the information. Should I add this in the Wiki and where should I add this?

@guwirth
Copy link
Collaborator

guwirth commented Apr 17, 2016

@bert would create a new item under HowTo.

Am 17.04.2016 um 10:19 schrieb Bert [email protected]:

@guwirth @jmecosta I suggest to close this topic but want to keep the information. Should I add this in the Wiki and where should I add this?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@jmecosta
Copy link
Member

@bert what are you planning to document, can we combine it with my wrapper

On Sun, 17 Apr 2016 11:50 Günter Wirth, [email protected] wrote:

@bert would create a new item under HowTo.

Am 17.04.2016 um 10:19 schrieb Bert [email protected]:

@guwirth @jmecosta I suggest to close this topic but want to keep the
information. Should I add this in the Wiki and where should I add this?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#616 (comment)

@Bertk
Copy link
Contributor Author

Bertk commented Apr 23, 2016

@jmecosta I would like to bring the VS props file to the wiki or a folder as a template for other static analysis tools. The MSbuild task defined in the VS props file are executed after the build and the report files are created. This is just another scripting solution to generate the report files. In fact, I also extended the script for automatic unit test execution. Unfortunately the unit testing is not a generic solution.

@guwirth
Copy link
Collaborator

guwirth commented Jul 17, 2016

@Bertk can we close this?

@Bertk
Copy link
Contributor Author

Bertk commented Jul 31, 2016

Yes, can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants