From 49e8e19235b166130bead026dcd296799223e198 Mon Sep 17 00:00:00 2001 From: Roman Marusyk Date: Thu, 7 Nov 2024 18:02:20 +0200 Subject: [PATCH] Use FilePath type for Solution argument --- .../Unit/Tools/DotNet/Sln/List/DotNetSlnListerTests.cs | 4 ++-- src/Cake.Common/Tools/DotNet/DotNetAliases.cs | 4 ++-- src/Cake.Common/Tools/DotNet/Sln/List/DotNetSlnLister.cs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Cake.Common.Tests/Unit/Tools/DotNet/Sln/List/DotNetSlnListerTests.cs b/src/Cake.Common.Tests/Unit/Tools/DotNet/Sln/List/DotNetSlnListerTests.cs index 080634f5ae..c39a97a093 100644 --- a/src/Cake.Common.Tests/Unit/Tools/DotNet/Sln/List/DotNetSlnListerTests.cs +++ b/src/Cake.Common.Tests/Unit/Tools/DotNet/Sln/List/DotNetSlnListerTests.cs @@ -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] @@ -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); } diff --git a/src/Cake.Common/Tools/DotNet/DotNetAliases.cs b/src/Cake.Common/Tools/DotNet/DotNetAliases.cs index 13fd812c56..8a46139242 100644 --- a/src/Cake.Common/Tools/DotNet/DotNetAliases.cs +++ b/src/Cake.Common/Tools/DotNet/DotNetAliases.cs @@ -2927,7 +2927,7 @@ public static IEnumerable DotNetSlnList(this ICakeContext context) [CakeMethodAlias] [CakeAliasCategory("Sln")] [CakeNamespaceImport("Cake.Common.Tools.DotNet.Sln.List")] - public static IEnumerable DotNetSlnList(this ICakeContext context, string solution) + public static IEnumerable DotNetSlnList(this ICakeContext context, FilePath solution) { return context.DotNetSlnList(solution, null); } @@ -2957,7 +2957,7 @@ public static IEnumerable DotNetSlnList(this ICakeContext context, strin [CakeMethodAlias] [CakeAliasCategory("Sln")] [CakeNamespaceImport("Cake.Common.Tools.DotNet.Sln.List")] - public static IEnumerable DotNetSlnList(this ICakeContext context, string solution, DotNetSlnListSettings settings) + public static IEnumerable DotNetSlnList(this ICakeContext context, FilePath solution, DotNetSlnListSettings settings) { if (context is null) { diff --git a/src/Cake.Common/Tools/DotNet/Sln/List/DotNetSlnLister.cs b/src/Cake.Common/Tools/DotNet/Sln/List/DotNetSlnLister.cs index 063db4c82c..cb60cab9cf 100644 --- a/src/Cake.Common/Tools/DotNet/Sln/List/DotNetSlnLister.cs +++ b/src/Cake.Common/Tools/DotNet/Sln/List/DotNetSlnLister.cs @@ -40,7 +40,7 @@ public DotNetSlnLister( /// 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. /// The settings. /// The list of project-to-project references. - public IEnumerable List(string solution, DotNetSlnListSettings settings) + public IEnumerable List(FilePath solution, DotNetSlnListSettings settings) { if (settings == null) { @@ -59,16 +59,16 @@ public IEnumerable 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");