From 2e64ffc588e6fcdd839a7870b172385815fc4240 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 23 Oct 2019 21:25:14 +0800 Subject: [PATCH] Add dotnet format check in CI. --- .config/dotnet-tools.json | 6 ++++++ build/build.cake | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 1b70c949e..6ba6ae82c 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -7,6 +7,12 @@ "commands": [ "dotnet-cake" ] + }, + "dotnet-format": { + "version": "3.1.37601", + "commands": [ + "dotnet-format" + ] } } } \ No newline at end of file diff --git a/build/build.cake b/build/build.cake index 44d5c9018..0b27345c3 100644 --- a/build/build.cake +++ b/build/build.cake @@ -19,6 +19,7 @@ var rootDirectory = new DirectoryPath(".."); var tempDirectory = new DirectoryPath("temp"); var artifactsDirectory = rootDirectory.Combine("artifacts"); +var sln = rootDirectory.CombineWithFilePath("osu-framework.sln"); var desktopBuilds = rootDirectory.CombineWithFilePath("build/Desktop.proj"); var desktopSlnf = rootDirectory.CombineWithFilePath("osu-framework.Desktop.slnf"); var frameworkProject = rootDirectory.CombineWithFilePath("osu.Framework/osu.Framework.csproj"); @@ -131,6 +132,9 @@ Task("CodeFileSanity") }); }); +Task("DotnetFormat") + .Does(() => DotNetCoreTool(sln.FullPath, "format", "--dry-run --check")); + Task("PackFramework") .Does(() => { DotNetCorePack(frameworkProject.FullPath, new DotNetCorePackSettings{ @@ -212,6 +216,7 @@ Task("Build") .IsDependentOn("Clean") .IsDependentOn("DetermineAppveyorBuildProperties") .IsDependentOn("CodeFileSanity") + .IsDependentOn("DotnetFormat") .IsDependentOn("InspectCode") .IsDependentOn("Test") .IsDependentOn("DetermineAppveyorDeployProperties")