From 64465510439a59ceb1f622d65d6ad726d991d6de Mon Sep 17 00:00:00 2001 From: Taylor Buchanan Date: Mon, 8 Jul 2024 19:55:07 -0500 Subject: [PATCH] fix(tools): tool path for CodecovTasks (#1357) --- source/Nuke.Common/Tools/Codecov/Codecov.json | 2 +- .../Nuke.Common/Tools/Codecov/CodecovTasks.cs | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/source/Nuke.Common/Tools/Codecov/Codecov.json b/source/Nuke.Common/Tools/Codecov/Codecov.json index 08b9b6cb0..2f70d769d 100644 --- a/source/Nuke.Common/Tools/Codecov/Codecov.json +++ b/source/Nuke.Common/Tools/Codecov/Codecov.json @@ -6,7 +6,7 @@ "name": "Codecov", "officialUrl": "https://about.codecov.io/", "help": "Code coverage is a measurement used to express which lines of code were executed by a test suite. We use three primary terms to describe each line executed.Coverage is the ratio of hits / (sum of hit + partial + miss). A code base that has 5 lines executed by tests out of 12 total lines will receive a coverage ratio of 41% (rounding down).Phrased simply, code coverage provides a visual measurement of what source code is being executed by a test suite. This information indicates to the software developer where they should write new tests in an effort to achieve higher coverage.Testing source code helps to prevent bugs and syntax errors by executing each line with a known variable and cross-checking it with an expected output.", - "nugetPackageId": "Codecov.Tool", + "nugetPackageId": "CodecovUploader", "customExecutable": true, "tasks": [ { diff --git a/source/Nuke.Common/Tools/Codecov/CodecovTasks.cs b/source/Nuke.Common/Tools/Codecov/CodecovTasks.cs index b63f68263..1ca823c87 100644 --- a/source/Nuke.Common/Tools/Codecov/CodecovTasks.cs +++ b/source/Nuke.Common/Tools/Codecov/CodecovTasks.cs @@ -2,6 +2,7 @@ // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE +using System; using Nuke.Common.Tooling; namespace Nuke.Common.Tools.Codecov; @@ -10,17 +11,27 @@ partial class CodecovSettings { private string GetProcessToolPath() { - return CodecovTasks.GetToolPath(Framework); + return CodecovTasks.GetToolPath(); } } partial class CodecovTasks { - internal static string GetToolPath(string framework = null) + internal static string GetToolPath() { return NuGetToolPathResolver.GetPackageExecutable( - packageId: "Codecov.Tool", - packageExecutable: "codecov.dll", - framework: framework); + packageId: "CodecovUploader", + packageExecutable: GetPackageExecutable()); + } + + private static string GetPackageExecutable() + { + return EnvironmentInfo.Platform switch + { + PlatformFamily.Windows => "codecov.exe", + PlatformFamily.OSX => "codecov-macos", + PlatformFamily.Linux => "codecov-linux", + _ => throw new ArgumentOutOfRangeException() + }; } }