Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ported changes to documentation for package publisher and bug fix to …

…DynamicValueUtility to 1.6 branch.
  • Loading branch information...
commit ade1ec886474f29b6341959faf39e394f5b231ce 1 parent 84aeb0d
@csut017 csut017 authored
View
2  pages.xml
@@ -181,7 +181,7 @@
<page title="NUnit Task" id="625" url="http://confluence.public.thoughtworks.org//display/CCNET/NUnit+Task" parentId="1756" source="nunit.wiki"/>
<page title="Ohloh Project Plugin" id="34013214" url="http://confluence.public.thoughtworks.org//display/CCNET/Ohloh+Project+Plugin" parentId="2973" source="ohlohProjectPlugin.wiki" />
<page title="Or Condition" id="34701717" url="http://confluence.public.thoughtworks.org//display/CCNET/Or+Condition" parentId="34701711" source="orCondition.wiki" />
- <page title="Package Publisher" id="26247208" url="http://confluence.public.thoughtworks.org//display/CCNET/Package+Publisher" parentId="1756" />
+ <page title="Package Publisher" id="26247208" url="http://confluence.public.thoughtworks.org//display/CCNET/Package+Publisher" parentId="1756" source="package.wiki" />
<page title="Packaging a Release" id="21004316" url="http://confluence.public.thoughtworks.org//display/CCNET/Packaging+a+Release" parentId="115" />
<page title="Parallel Task" id="28475398" url="http://confluence.public.thoughtworks.org//display/CCNET/Parallel+Task" parentId="1756" />
<page title="Parameter Trigger" id="31097547" url="http://confluence.public.thoughtworks.org//display/CCNET/Parameter+Trigger" parentId="1750" />
View
104 project/ccnet.xsd
@@ -7019,56 +7019,130 @@
</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="baseDirectory" type="String" minOccurs="0" maxOccurs="1">
+ <xs:element name="manifest" type="ManifestGenerator" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
- The directory to base all the file locations from.
+ The manifest generator to be used.
</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="manifest" type="ManifestGenerator" minOccurs="0" maxOccurs="1">
+ <xs:element name="packageList" type="PackageItems" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>
- The manifest generator to be used.
+ The list of files and folders to include in the package.
</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="files" minOccurs="1" maxOccurs="1">
+ <xs:element name="outputDir" type="String" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
- The files to include in the package.
+ The location to output the package to.
</xs:documentation>
</xs:annotation>
- <xs:complexType>
+ </xs:element>
+ <xs:element name="dynamicValues" type="DynamicValues" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ The dynamic values to use for the task.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="description" type="String" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ Description used for the visualisation of the buildstage, if left empty the process name will be shown.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="environment" type="EnvironmentVariables" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ A set of environment variables set for commands that are executed.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:all>
+ </xs:complexType>
+
+ <xs:complexType name="PackageItems">
<xs:choice minOccurs="1" maxOccurs="unbounded">
- <xs:element name="file" type="String">
+ <xs:element name="packageFile" type="packageFile">
<xs:annotation>
<xs:documentation>
- The name of the file.
+ Includes the file in the package.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="packageFolder" type="packageFolder">
+ <xs:annotation>
+ <xs:documentation>
+ Includes the folder and its contents into the package.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
+
+ <xs:complexType name="packageFile">
+ <xs:all>
+ <xs:element name="sourceFile" type="String" minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ The name and path of the file to store into the package
+ </xs:documentation>
+ </xs:annotation>
</xs:element>
- <xs:element name="outputDir" type="String" minOccurs="0" maxOccurs="1">
+ <xs:element name="targetFileName" type="String" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
- The location to output the package to.
+ The name of the file that is to be saved.
</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="dynamicValues" type="DynamicValues" minOccurs="0" maxOccurs="1">
+ <xs:element name="targetFolder" type="String" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
- The dynamic values to use for the task.
+ The name of the folder in the package that the file will be saved under
</xs:documentation>
</xs:annotation>
</xs:element>
- <xs:element name="description" type="String" minOccurs="0" maxOccurs="1">
+ </xs:all>
+ </xs:complexType>
+
+ <xs:complexType name="packageFolder">
+ <xs:all>
+ <xs:element name="sourceFolder" type="String" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>
- Description used for the visualisation of the buildstage, if left empty the process name will be shown.
+ The name of the folder to store into the package
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="fileFilter" type="String" minOccurs="1" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ The filename filter to apply
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="targetFolder" type="String" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ The name of the folder in the package that the file will be saved under
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="includeSubFolders" type="xs:boolean" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ Recursively save files
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="flatten" type="xs:boolean" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>
+ Flatten the hierachy
</xs:documentation>
</xs:annotation>
</xs:element>
View
1  project/core/publishers/IPackageItem.cs
@@ -6,6 +6,7 @@ namespace ThoughtWorks.CruiseControl.Core.Publishers
/// <summary>
/// Defines an item that can be packaged.
/// </summary>
+ /// <title>Package Item</title>
public interface IPackageItem
{
/// <summary>
View
21 project/core/publishers/PackagePublisher.cs
@@ -27,17 +27,28 @@ namespace ThoughtWorks.CruiseControl.Core.Publishers
/// <title>Package Publisher</title>
/// <version>1.4.4</version>
/// <example>
+ /// <code title="Minimalist example">
+ /// &lt;package&gt;
+ /// &lt;name&gt;Example&lt;/name&gt;
+ /// &lt;packageList&gt;
+ /// &lt;packageFile&gt;
+ /// &lt;sourceFile&gt;results.txt&lt;/sourceFile&gt;
+ /// &lt;/packageFile&gt;
+ /// &lt;/packageList&gt;
+ /// &lt;/package&gt;
+ /// </code>
/// <code title="Full example">
/// &lt;package&gt;
/// &lt;name&gt;Example&lt;/name&gt;
/// &lt;compression&gt;9&lt;/compression&gt;
/// &lt;always&gt;true&lt;/always&gt;
/// &lt;flatten&gt;true&lt;/flatten&gt;
- /// &lt;baseDirectory&gt;C:\Builds\CC.Net&lt;/baseDirectory&gt;
- /// &lt;manifest type="defaultManifestGenerator" /&gt;
- /// &lt;files&gt;
- /// &lt;file&gt;Results.txt&lt;/file&gt;
- /// &lt;/files&gt;
+ /// &lt;manifest type="defaultManifestGenerator"/&gt;
+ /// &lt;packageList&gt;
+ /// &lt;packageFile&gt;
+ /// &lt;sourceFile&gt;results.txt&lt;/sourceFile&gt;
+ /// &lt;/packageFile&gt;
+ /// &lt;/packageList&gt;
/// &lt;/package&gt;
/// </code>
/// </example>
View
71 project/core/tasks/DynamicValueUtility.cs
@@ -18,8 +18,8 @@ namespace ThoughtWorks.CruiseControl.Core.Tasks
public static class DynamicValueUtility
{
#region Private fields
- private static Regex parameterRegex = new Regex(@"\$\[[^\]]*\]", RegexOptions.Compiled);
- private static Regex paramPartRegex = new Regex(@"(?<!\\)\|", RegexOptions.Compiled);
+ private static readonly Regex parameterRegex = new Regex(@"\$\[[^\]]*\]", RegexOptions.Compiled);
+ private static readonly Regex paramPartRegex = new Regex(@"(?<!\\)\|", RegexOptions.Compiled);
#endregion
#region Public methods
@@ -120,7 +120,7 @@ public static MemberInfo FindActualProperty(object value, string reflectorProper
// Get the name of the property
string name = null;
var attrib = attribute as ReflectorPropertyAttribute;
- if (attrib !=null)
+ if (attrib != null)
{
name = attrib.Name;
}
@@ -284,27 +284,17 @@ public static object ConvertValue(string parameterName, string inputValue, IEnum
{
try
{
- if (inputValue == null)
- {
- actualValue = parameter.Convert(parameter.DefaultValue);
- }
- else
- {
- actualValue = parameter.Convert(inputValue);
- }
+ actualValue = parameter.Convert(inputValue ?? parameter.DefaultValue);
}
catch (InvalidCastException)
{
- if (actualValue == null)
- {
- throw new CruiseControlException(
- "Unable to set dynamic value for " + parameterName + ", unable to find a valid default value");
- }
- else
- {
- throw new CruiseControlException(
- "Unable to set dynamic value for " + parameterName + ", unable to convert value");
- }
+ throw actualValue == null
+ ? new CruiseControlException(
+ "Unable to set dynamic value for " + parameterName +
+ ", unable to find a valid default value")
+ : new CruiseControlException(
+ "Unable to set dynamic value for " + parameterName +
+ ", unable to convert value");
}
break;
}
@@ -369,7 +359,7 @@ public static XmlNode ConvertXmlToDynamicValues(NetReflectorTypeTable typeTable,
parametersEl.AppendChild(dynamicValueEl);
// Generate the replacement
- lastReplacement = string.Format(System.Globalization.CultureInfo.CurrentCulture,"{{{0}{1}}}",
+ lastReplacement = string.Format(CultureInfo.CurrentCulture, "{{{0}{1}}}",
index++,
parts.Length > 2 ? ":" + parts[2].Replace("\\|", "|") : string.Empty);
return lastReplacement;
@@ -478,7 +468,7 @@ private static object GetValue(MemberInfo member, object source)
object value = null;
var pi = member as PropertyInfo;
- if (pi !=null)
+ if (pi != null)
{
value = pi.GetValue(source, new object[0]);
}
@@ -541,9 +531,9 @@ private static bool CheckForExclusion(XmlNode node, string[] exclusions)
/// </summary>
public class PropertyValue
{
- private object mySource;
- private MemberInfo myProperty;
- private int myArrayIndex;
+ private readonly object mySource;
+ private readonly MemberInfo myProperty;
+ private readonly int myArrayIndex;
internal PropertyValue(object source, MemberInfo property, int arrayIndex)
{
@@ -573,16 +563,10 @@ public MemberInfo Property
/// </summary>
public object Value
{
- get
- {
- if (myProperty is PropertyInfo)
- {
- return (myProperty as PropertyInfo).GetValue(mySource, new object[0]);
- }
- else
- {
- return (myProperty as FieldInfo).GetValue(mySource);
- }
+ get {
+ return myProperty is PropertyInfo
+ ? (myProperty as PropertyInfo).GetValue(mySource, new object[0])
+ : (myProperty as FieldInfo).GetValue(mySource);
}
}
@@ -608,20 +592,20 @@ public void ChangeProperty(object value)
/// <param name="value"></param>
private void ChangePropertyValue(object value)
{
- object actualValue = value;
- object[] index = new object[0];
- PropertyInfo property = (myProperty as PropertyInfo);
+ var actualValue = value;
+ var index = new object[0];
+ var property = (myProperty as PropertyInfo);
// If it is an array then reset the index and use the array item type instead
if (property.PropertyType.IsArray)
{
- index = new object[] {
- myArrayIndex
- };
if (property.PropertyType.GetElementType() != value.GetType())
{
actualValue = Convert.ChangeType(value, property.PropertyType.GetElementType(), CultureInfo.CurrentCulture);
}
+
+ var array = property.GetValue(mySource, index) as Array;
+ array.SetValue(actualValue, myArrayIndex);
}
else
{
@@ -658,8 +642,9 @@ private void ChangePropertyValue(object value)
actualValue = Convert.ChangeType(value, property.PropertyType, CultureInfo.CurrentCulture);
}
}
+
+ property.SetValue(mySource, actualValue, index);
}
- property.SetValue(mySource, actualValue, index);
}
/// <summary>
Please sign in to comment.
Something went wrong with that request. Please try again.