From aef824b13dda77cad2c27946106a8b87e24a3df3 Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 02:12:39 +0200 Subject: [PATCH] Also analyze the code for spaces and warnings. --- .gitignore | 1 + appveyor.yml | 22 +++------------------- build.cake | 22 ++++++++++++++++++++-- cake.config | 2 -- inspectcodereport.xml | 18 ++++++++++++++++++ 5 files changed, 42 insertions(+), 23 deletions(-) delete mode 100644 cake.config create mode 100644 inspectcodereport.xml diff --git a/.gitignore b/.gitignore index be43e1a79c..26a8752b66 100644 --- a/.gitignore +++ b/.gitignore @@ -102,6 +102,7 @@ $tf/ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user +inspectcode # JustCode is a .NET coding add-in .JustCode diff --git a/appveyor.yml b/appveyor.yml index 7c08eb9e9c..68c6725d0c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,24 +1,8 @@ clone_depth: 1 version: '{branch}-{build}' image: Visual Studio 2017 -configuration: Debug -cache: - - C:\ProgramData\chocolatey\bin -> appveyor.yml - - C:\ProgramData\chocolatey\lib -> appveyor.yml +test: off install: - cmd: git submodule update --init --recursive --depth=5 - - cmd: choco install resharper-clt -y - - cmd: choco install nvika -y - - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe -before_build: - - cmd: CodeFileSanity.exe - - cmd: nuget restore -verbosity quiet -environment: - TargetFramework: net471 -build: - project: osu.sln - parallel: true - verbosity: minimal -after_build: - - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors +build_script: +- cmd: PowerShell -Version 2.0 .\build.ps1 diff --git a/build.cake b/build.cake index 98ad292d7b..6d11aade77 100644 --- a/build.cake +++ b/build.cake @@ -1,4 +1,7 @@ #tool "nuget:?package=JetBrains.ReSharper.CommandLineTools" +#tool "nuget:?package=NVika.MSBuild" +var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); +var CodeFileSanityToolPath = DownloadFile("https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe"); /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS @@ -9,7 +12,7 @@ var framework = Argument("framework", "net471"); var configuration = Argument("configuration", "Release"); var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj"); - +var osuSolution = new FilePath("./osu.sln"); var testProjects = GetFiles("**/*.Tests.csproj"); /////////////////////////////////////////////////////////////////////////////// @@ -37,11 +40,26 @@ Task("Test") Task("InspectCode") .Does(() => { - + InspectCode(osuSolution, new InspectCodeSettings { + CachesHome = "inspectcode", + OutputFile = "inspectcodereport.xml", + }); + + StartProcess(NVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); +}); + +Task("CodeFileSanity") +.Does(() => { + var result = StartProcess(CodeFileSanityToolPath); + + if (result != 0) + throw new Exception("Code sanity failed."); }); Task("Build") +.IsDependentOn("CodeFileSanity") .IsDependentOn("Compile") +.IsDependentOn("InspectCode") .IsDependentOn("Test"); RunTarget(target); \ No newline at end of file diff --git a/cake.config b/cake.config deleted file mode 100644 index 9dbafb5e95..0000000000 --- a/cake.config +++ /dev/null @@ -1,2 +0,0 @@ -[Nuget] -UseInProcessClient=false \ No newline at end of file diff --git a/inspectcodereport.xml b/inspectcodereport.xml new file mode 100644 index 0000000000..f4b531f547 --- /dev/null +++ b/inspectcodereport.xml @@ -0,0 +1,18 @@ + + + + + osu.sln + + Solution + + + + + + + + + + + \ No newline at end of file