Making plugins for CCNet server or Dashboard¶
Steps:¶
- Create a Class Library project to build the assembly that will contain your custom builder plug-in. The assembly that it produces should be named: ccnet.*.plugin.dll (where the star represents the name you choose).
- Add your new custom builder class.
- The class must implement the ThoughtWorks.CruiseControl.Core.ITask interface (found in the ThoughtWorks.CruiseControl.Core.dll assembly).
- Mark your class with the NetReflector ReflectorType attribute. The name argument supplied to the attribute is the name of the element/attribute that will appear in the configuration file.
- Add any configuration properties that you need, marking them with the NetReflector ReflectorProperty attributes accordingly. Note that the attribute names are case sensitive and must match exactly in the configuration.
- Implement the Run method. The supplied IIntegrationResult should provide you with everything that you need to know about the current build.
- Compile the assembly.
- Copy the assembly into the folder containing the CruiseControl.NET assemblies (or the current directory that you are running the ccnet server from).
ccnet.exe.config and ccservice.exe.config have a setting : PluginLocation which allows you to specify a specific folder containing plugins. - Modify your ccnet.config file in accordance with the sample config file below.
Sample Builder Class¶
1using System;
2using Exortech.NetReflector;
3using ThoughtWorks.CruiseControl.Core;
4
5namespace ThoughtWorks.CruiseControl.Sample.Builder
6{
7 [ReflectorType("mybuilder")]
8 public class NAntBuilder : ITask
9 {
10 public void Run(IIntegrationResult result)
11 {
12 Console.WriteLine("Hello World!");
13 }
14 }
15}
Sample Config File¶
1<cruisecontrol>
2 <project name="myproject">
3 <tasks>
4 <mybuilder>
5 <!-- include custom builder properties here -->
6 </mybuilder>
7 </tasks>
8 </project>
9</cruisecontrol>
Detailed examples :¶
For a more detailed explanation visit this [blog|http://rubenwillems.blogspot.be/search/label/customizing%20code]
Section Customizing Code has multiple posts on how CCNet codes plays along.
Some direct links :