3

I have set up a Teamcity server for start working with Continous Integration and having daily builds and also when VCS check-in is detected. Me and my team is now working on a videogame, we are using Unity as the game engine and C# as programming language. I have used Gendarme manually on our project and can totally use the benefits it offers. So I was trying to make it run as a build step of Teamcity, but I can seem to figure out how to make it to work. Do someone have some expirience with this combination of tools? Any experience shared is apreciated.

Thanks.

giacomelli
  • 7,287
  • 2
  • 27
  • 31
Jorge
  • 51
  • 5
  • Do you have specific error, logs you could provide – Iain May 08 '13 at 13:52
  • What is the command line you are currently using to run Gendarme on terminal? – giacomelli May 08 '13 at 14:42
  • Thanks for the comments; As far a erro messages I have none, I just don't know how to make it work, I mean send to execute Gendarme as a build step of teamcity. I haven't runned Gendarme on terminal, I have just been acquainted with the software, I used the wizrd to check the assemblies of my project and started searching about using it as a build step of teamcity but finding nothing about it and my blind tries have been without success. – Jorge May 08 '13 at 15:29

1 Answers1

2

Well finally I did ended up finding a solution and I'am posting it here so that anyone interested can see it.

Teamcity has a Command Line build step that can be used for using Gendarme as part of your build process(For the custom scripts I am going to write here in the Workspace property of the Build Step you need to put where each of this .exe's are). Here is the console command needed for it:

gendarme.exe --v --html Your\Path\To\Save\Report\GendarmeReport.html --severity all --confidence all "Path/To/Your/Project/Library/ScriptAssemblies/Assembly-CSharp.dll" "Path/To/Your/Project/Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll" "Path/To/Your/Project/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll"

Probably, if you run this build step after doing the Unity build the Assemblies here would have been erased by Unity, so you need to have another console command build step before the Gendarme step, this one:

Unity.exe -batchmode -nographics -quit

This will make unity re-generate the Library folder contents and running Gendarme build step after that will do the trcik. Finally Gendarme will sometimes throw a 1 exit code as it finishes the report, but the report have been successful and every rule check also, so I think this is probably a minor error, according to the manpages of Gendarme this code is returned when

The runner execution was successful but either some defects where found or no assembly was specified.

If the assemblies are been checked correctky, since you have the step that re-generates them, then you can tell Teamcity to ignore the exit code 1, you can do this going to the Build Failure conditions of Teamcity and unchecking the option build process exit code is not zero and that's all.

Hope this helps someone else that is also interested in something like this.

Jorge
  • 51
  • 5