Skip to content

Commit

Permalink
Use FilePath type for Solution argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Marusyk committed Nov 7, 2024
1 parent 28930d6 commit 49e8e19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void Should_Add_Solution_Argument()
var result = fixture.Run();

// Then
Assert.Equal("sln \"ToDo.sln\" list", result.Args);
Assert.Equal("sln \"/Working/ToDo.sln\" list", result.Args);
}

[Fact]
Expand All @@ -96,7 +96,7 @@ public void Should_Add_Additional_Arguments()
var result = fixture.Run();

// Then
var expected = "sln \"ToDo.sln\" list --verbosity diagnostic";
var expected = "sln \"/Working/ToDo.sln\" list --verbosity diagnostic";
Assert.Equal(expected, result.Args);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Common/Tools/DotNet/DotNetAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2927,7 +2927,7 @@ public static IEnumerable<string> DotNetSlnList(this ICakeContext context)
[CakeMethodAlias]
[CakeAliasCategory("Sln")]
[CakeNamespaceImport("Cake.Common.Tools.DotNet.Sln.List")]
public static IEnumerable<string> DotNetSlnList(this ICakeContext context, string solution)
public static IEnumerable<string> DotNetSlnList(this ICakeContext context, FilePath solution)
{
return context.DotNetSlnList(solution, null);
}
Expand Down Expand Up @@ -2957,7 +2957,7 @@ public static IEnumerable<string> DotNetSlnList(this ICakeContext context, strin
[CakeMethodAlias]
[CakeAliasCategory("Sln")]
[CakeNamespaceImport("Cake.Common.Tools.DotNet.Sln.List")]
public static IEnumerable<string> DotNetSlnList(this ICakeContext context, string solution, DotNetSlnListSettings settings)
public static IEnumerable<string> DotNetSlnList(this ICakeContext context, FilePath solution, DotNetSlnListSettings settings)
{
if (context is null)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Cake.Common/Tools/DotNet/Sln/List/DotNetSlnLister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public DotNetSlnLister(
/// <param name="solution">The solution file to use. If not specified, the command searches the current directory for one. If it finds no solution file or multiple solution files, the command fails.</param>
/// <param name="settings">The settings.</param>
/// <returns>The list of project-to-project references.</returns>
public IEnumerable<string> List(string solution, DotNetSlnListSettings settings)
public IEnumerable<string> List(FilePath solution, DotNetSlnListSettings settings)
{
if (settings == null)
{
Expand All @@ -59,16 +59,16 @@ public IEnumerable<string> List(string solution, DotNetSlnListSettings settings)
return ParseResult(result).ToList();
}

private ProcessArgumentBuilder GetArguments(string solution, DotNetSlnListSettings settings)
private ProcessArgumentBuilder GetArguments(FilePath solution, DotNetSlnListSettings settings)
{
var builder = CreateArgumentBuilder(settings);

builder.Append("sln");

// Solution path
if (!string.IsNullOrWhiteSpace(solution))
if (solution != null)
{
builder.AppendQuoted(solution);
builder.AppendQuoted(solution.MakeAbsolute(_environment).FullPath);
}

builder.Append("list");
Expand Down

0 comments on commit 49e8e19

Please sign in to comment.