Quantcast
Channel: Vincent Labatut's Quest » Sonar
Viewing all articles
Browse latest Browse all 3

Sonar build activity for TFS updated

$
0
0

I’ve just committed a few evolutions to the Sonar activity in the Community TFS Build Extensions project (see part1 and part2 for how to integrate Sonar with TFS). It just makes it easier to generate the sonar-project.properties file by adding new variables. I’ve added as well a new way to add or override Sonar properties directly from the build definition.

New variables

The new variables are :

  • BINARIES_DIRECTORY_PATH: the binaries folder of the TFS build (as defined in the build process template)
  • BINARIES_DIRECTORY_PATH_SLASH: same path with slashes instead of backslashes (for Sonar)

Warning: now, you must pass a new activity parameter BinariesDirectory from the build process template to your Sonar activity instance of the build process template.

This will hopefully fix a problem with the assemblies path when the solution was not at the root of your workspace, the path is now absolute and should always work whatever your workspace configuration:

sonar.dotnet.assemblies=%BINARIES_DIRECTORY_PATH_SLASH%/$(AssemblyName).$(OutputType)
sonar.dotnet.test.assemblies=%BINARIES_DIRECTORY_PATH_SLASH%/$(AssemblyName).$(OutputType)

Passing values from the build definition up to Sonar

A new SonarProperties activity property allows you to pass a list a key-value pairs that will be added (or overwritten) to the resulting sonar-project.properties file. It is easy now to pass custom build parameters directly to Sonar for a specific solution to build.

sonar.fxcop.mode=skip
sonar.ndeps.mode=skip
sonar.gallio.it.mode=active

I find it easier to edit this kind of properties list with a String array in the build definition (can be edited as a text block), so I declare a String[] in the build process template arguments list. As the activity needs a StringList, you can convert the array using the following statement:

[If(SonarProperties Is Nothing, Nothing, New StringList(SonarProperties))]

New unit tests

I’ve also added several unit tests for the Sonar activity as well. I used the techniques I talked about in my previous post about unit testing and builds. Feel free to have look, I’d be glad to have your feedback.

Hope this helps! Smile


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images