I put together a little utility that I will add to the build process and distribute with CCNetConfig that will take an assembly that is a plugin for
CruiseControl.NET and build an assembly that can be used with CCNetConfig. I have not really tested a full list of plugins, but i have tested the SVNLabeller and the TFS plugin. I will test more of them when I have time to do so, and if there are any issues, they will be addressed just like any other issue with CCNetConfig.
Here is a sneak peak of the UI. It's nothing too fancy. You select the
CruiseControl.NET plugin assembly, then you can specify some properties for the plugin itself and its properties. You can load multiple
CruiseControl.NET plugin in assemblies and they will all be included in the one generated assembly.
Here i am creating the SVNLabeller and setting a minimum version of
CruiseControl.NET that is supported. I am also setting the Url for any documentation about this plugin.
If we click the build button in the toolbar, the new assembly will be created. It will ask where to save it. I saved it in my CCNetConfig install directory. Now if I start up CCNetConfig and I view the components that are supported in the Options dialog, we see the following:
Clicking on the save button will generate the source files but will not create the assembly. Below is an example of the generated source. You may notice that it looks a lot like the code from the
example on how to write the plugin yourself.
Code
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using CCNetConfig.Core;
5
using CCNetConfig.Core.Components;
6
using System.ComponentModel;
7
using System.Drawing.Design;
8
using System.Xml;
9
10
namespace ccnet.SvnLabeller.plugin ...{
11
[Plugin, MinimumVersion ( "1.2.1.0" ),]
12
public class SvnLabeller : CCNetConfig.Core.Labeller, ICCNetDocumentation ...{
13
public SvnLabeller ( ) : base ( "SvnLabeller" ) ...{ }
14
15
private System.Int32? _MajorVersion;
16
[Category ( "Optional" ),
17
DisplayName ( "MajorVersion" ),
18
DefaultValue ( null ),
19
Description ( "" ),]
20
public System.Int32? MajorVersion ...{
21
get ...{ return _MajorVersion; }
22
set ...{ _MajorVersion = value; }
23
}
24
25
private System.Int32? _MinorVersion;
26
[Category ( "Optional" ),
27
DisplayName ( "MinorVersion" ),
28
DefaultValue ( null ),
29
Description ( "" ),]
30
public System.Int32? MinorVersion ...{
31
get ...{ return _MinorVersion; }
32
set ...{ _MinorVersion = value; }
33
}
34
35
private System.Int32? _BuildNumber;
36
[Category ( "Optional" ),
37
DisplayName ( "BuildNumber" ),
38
DefaultValue ( null ),
39
Description ( "" ),]
40
public System.Int32? BuildNumber ...{
41
get ...{ return _BuildNumber; }
42
set ...{ _BuildNumber = value; }
43
}
44
45
private System.String _executable;
46
[Category ( "Required" ),
47
DisplayName ( "(executable)" ),
48
DefaultValue ( null ),
49
Description ( "" ),]
50
public System.String executable ...{
51
get ...{ return _executable; }
52
set ...{ _executable = CCNetConfig.Core.Util.CheckRequired ( this, "executable", value ); }
53
}
54
55
private System.String _workingDirectory;
56
[Category ( "Required" ),
57
DisplayName ( "(workingDirectory)" ),
58
DefaultValue ( null ),
59
Description ( "" ),]
60
public System.String workingDirectory ...{
61
get ...{ return _workingDirectory; }
62
set ...{ _workingDirectory = CCNetConfig.Core.Util.CheckRequired ( this, "workingDirectory", value ); }
63
}
64
65
public override CCNetConfig.Core.Labeller Clone ( ) ...{
66
SvnLabeller _SvnLabeller = this.MemberwiseClone ( ) as SvnLabeller;
67
_SvnLabeller.executable = this.executable.Clone ( ) as System.String;
68
_SvnLabeller.workingDirectory = this.workingDirectory.Clone ( ) as System.String;
69
return _SvnLabeller;
70
}
71
72
public override void Deserialize ( System.Xml.XmlElement element ) ...{
73
string s = string.Empty;
74
if ( string.Compare ( element.GetAttribute ( "type" ), base.TypeName, false ) != 0 ) ...{
75
throw new InvalidCastException ( string.Format ( "Unable to convert {0} to a {1}",
76
element.GetAttribute ( "type" ), base.TypeName ) );
77
}
78
79
this.MajorVersion = null;
80
s = CCNetConfig.Core.Util.GetElementOrAttributeValue ( "MajorVersion", element );
81
if ( !string.IsNullOrEmpty ( s ) ) ...{
82
int i = 0;
83
if ( int.TryParse ( s, out i ) ) ...{
84
this.MajorVersion = new int? ( i );
85
}
86
}
87
88
this.MinorVersion = null;
89
s = CCNetConfig.Core.Util.GetElementOrAttributeValue ( "MinorVersion", element );
90
if ( !string.IsNullOrEmpty ( s ) ) ...{
91
int i = 0;
92
if ( int.TryParse ( s, out i ) ) ...{
93
this.MinorVersion = new int? ( i );
94
}
95
}
96
97
this.BuildNumber = null;
98
s = CCNetConfig.Core.Util.GetElementOrAttributeValue ( "BuildNumber", element );
99
if ( !string.IsNullOrEmpty ( s ) ) ...{
100
int i = 0;
101
if ( int.TryParse ( s, out i ) ) ...{
102
this.BuildNumber = new int? ( i );
103
}
104
}
105
106
this._executable = null;
107
s = CCNetConfig.Core.Util.GetElementOrAttributeValue ( "executable", element );
108
if ( !string.IsNullOrEmpty ( s ) ) ...{
109
this.executable = s;
110
}
111
112
this._workingDirectory = null;
113
s = CCNetConfig.Core.Util.GetElementOrAttributeValue ( "workingDirectory", element );
114
if ( !string.IsNullOrEmpty ( s ) ) ...{
115
this.workingDirectory = s;
116
}
117
}
118
119
public override System.Xml.XmlElement Serialize ( ) ...{
120
XmlDocument doc = new XmlDocument ( );
121
XmlElement root = doc.CreateElement ( "labeller" );
122
root.SetAttribute ( "type", base.TypeName );
123
124
XmlElement ele = null;
125
126
if ( this.MajorVersion.HasValue ) ...{
127
ele = doc.CreateElement ( "MajorVersion" );
128
ele.InnerText = this.MajorVersion.Value.ToString ( );
129
root.AppendChild ( ele );
130
}
131
132
133