mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
move dotnet-format global tool out of Lifetime (#2109)
This commit is contained in:
@@ -28,7 +28,6 @@ public class Context : FrostingContext
|
||||
|
||||
public Project[] Projects { get; set; }
|
||||
|
||||
public FilePath DotNetFormatToolPath { get; set; }
|
||||
public FilePath GitVersionToolPath { get; set; }
|
||||
|
||||
public DotNetCoreTestSettings GetTestSettings()
|
||||
|
||||
@@ -51,7 +51,6 @@ public class Lifetime : FrostingLifetime<Context>
|
||||
new Project { Name = "Octokit.Tests.Integration", Path = "./Octokit.Tests.Integration/Octokit.Tests.Integration.csproj", IntegrationTests = true }
|
||||
};
|
||||
|
||||
context.DotNetFormatToolPath = ToolInstaller.DotNetCoreToolInstall(context, "dotnet-format", "3.1.37601", "dotnet-format");
|
||||
context.GitVersionToolPath = ToolInstaller.DotNetCoreToolInstall(context, "GitVersion.Tool", "5.1.3", "dotnet-gitversion");
|
||||
|
||||
// Calculate semantic version.
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
using System;
|
||||
using Cake.Common;
|
||||
using Cake.Common.Diagnostics;
|
||||
using Cake.Common.IO;
|
||||
using Cake.Core;
|
||||
using Cake.Core.IO;
|
||||
using Cake.Frosting;
|
||||
|
||||
public sealed class FormatCode : FrostingTask<Context>
|
||||
{
|
||||
public override void Run(Context context)
|
||||
{
|
||||
int result = context.StartProcess(context.DotNetFormatToolPath);
|
||||
if (result != 0)
|
||||
var exitCode = context.StartProcess("dotnet", new ProcessSettings
|
||||
{
|
||||
throw new Exception($"Failed to execute {context.DotNetFormatToolPath} ({result})");
|
||||
Arguments = $"format"
|
||||
});
|
||||
|
||||
if (exitCode != 0)
|
||||
{
|
||||
throw new Exception($"Failed to format code - got exit code '{exitCode}'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user