Skip to content

Commit

Permalink
Make explicit conversion to string with ToString() overload and to ar…
Browse files Browse the repository at this point in the history
…ray of TaskItem
  • Loading branch information
yevhen committed Aug 20, 2014
1 parent 293b6d4 commit bb05a4d
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Nake.csx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var MSBuildExe = @"$ProgramFiles(x86)$\MSBuild\12.0\Bin\MSBuild.exe";
{
Build("Debug", outputPath);

string tests = new FileSet{@"{outputPath}\*.Tests.dll"};
var tests = new FileSet{@"{outputPath}\*.Tests.dll"}.ToString(" ");
Cmd(@"Packages\NUnit.Runners.2.6.2\tools\nunit-console.exe /framework:net-4.0 /noshadow /nologo {tests}");
}

Expand Down
4 changes: 2 additions & 2 deletions Source/ProductAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;

[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0")]
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1")]
[assembly: AssemblyCopyright("Copyright © Yevhen Bobrov 2013-2014")]
37 changes: 24 additions & 13 deletions Source/Utility/FileSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,16 @@ FileSet Transform(Func<Item, Item> transform)
}

/// <summary>
/// Performs an implicit conversion from strign array to <see cref="FileSet"/>.
/// Performs conversion from file set to array of <see cref="ITaskItem"/>.
/// </summary>
/// <returns> The sequence of MSBuild task items </returns>
public ITaskItem[] AsTaskItems()
{
return ((IEnumerable<string>)this).AsTaskItems();
}

/// <summary>
/// Performs an implicit conversion from string array to <see cref="FileSet"/>.
/// </summary>
/// <param name="arg">The argument.</param>
/// <returns>
Expand Down Expand Up @@ -303,23 +312,25 @@ public static implicit operator string[](FileSet arg)
}

/// <summary>
/// Performs an implicit conversion from file set to array of <see cref="ITaskItem"/>.
/// Returns a string that represents the current object.
/// </summary>
/// <param name="arg">The argument.</param>
/// <returns> The sequence of MSBuild task items </returns>
public static implicit operator ITaskItem[](FileSet arg)
/// <returns>
/// A string that represents the current object.
/// </returns>
/// <filterpriority>2</filterpriority>
public override string ToString()
{
return arg.ToArray().AsTaskItems();
}

return ToString(" ");
}
/// <summary>
/// Performs an implicit conversion from file set to string.
/// Returns a string of resolved concatenated file paths using given separator.
/// </summary>
/// <param name="arg">The argument.</param>
/// <returns> The string with space separated list of resolved file set paths </returns>
public static implicit operator string(FileSet arg)
/// <param name="separator">Path separator</param>
/// <returns> The string with resolved file set paths separated by given separator </returns>
public string ToString(string separator)
{
return string.Join(" ", arg);
return string.Join(separator, this); ;
}

class Inclusion
Expand Down
Binary file modified Tools/Nake/Meta.dll
Binary file not shown.
Binary file modified Tools/Nake/Meta.pdb
Binary file not shown.
Binary file modified Tools/Nake/Nake.exe
Binary file not shown.
Binary file modified Tools/Nake/Nake.pdb
Binary file not shown.
Binary file modified Tools/Nake/Utility.dll
Binary file not shown.
Binary file modified Tools/Nake/Utility.pdb
Binary file not shown.

0 comments on commit bb05a4d

Please sign in to comment.