1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Allow running on mono if possible. (non windows)

This commit is contained in:
miterosan 2018-08-06 22:50:23 +02:00
parent b430cf34e7
commit 580d478dc8

View File

@ -1,4 +1,4 @@
#addin "nuget:?package=CodeFileSanity"
#addin "nuget:http://localhost:8081/repository/hm?package=CodeFileSanity&version=1.0.10"
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools"
#tool "nuget:?package=NVika.MSBuild"
#tool "nuget:?package=NuGet.CommandLine"
@ -38,24 +38,48 @@ Task("Test")
});
});
// windows only because both inspectcore and nvike depend on net45
Task("InspectCode")
.WithCriteria(IsRunningOnWindows())
.IsDependentOn("Compile")
.Does(() => {
var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
var NugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First();
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
var nugetToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First();
StartProcess(NugetToolPath, $"restore {osuSolution}");
if (!IsRunningOnWindows()) {
RunInpectCodeInMono(nVikaToolPath, nugetToolPath);
return;
}
StartProcess(nugetToolPath, $"restore {osuSolution}");
InspectCode(osuSolution, new InspectCodeSettings {
CachesHome = "inspectcode",
OutputFile = "inspectcodereport.xml",
});
StartProcess(NVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
StartProcess(nVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
});
void RunInpectCodeInMono(FilePath nugetToolPath, FilePath nVikaToolPath) {
var inspectcodeToolPath = GetFiles("./tools/NuGet.CommandLine.*/tools/NuGet.exe").First();
if (!FileExists("mono")) {
Information("Running on an os other than windows and mono is not installed. Skipping InpectCode.");
return;
}
StartProcess("mono", $"{nugetToolPath} restore {osuSolution}");
StartProcess("mono", @"--o=""inspectcodereport.xml"" --caches-home=""inspectcode"" ");
InspectCode(osuSolution, new InspectCodeSettings {
CachesHome = "inspectcode",
OutputFile = "inspectcodereport.xml",
});
StartProcess("mono", $@"{nVikaToolPath} parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
}
Task("CodeFileSanity")
.Does(() => {
ValidateCodeSanity(new ValidateCodeSanitySettings {