mirror of
https://github.com/ppy/osu.git
synced 2024-12-18 02:43:22 +08:00
67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
|
|
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2019.1.1"
|
|
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
|
|
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// ARGUMENTS
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
var target = Argument("target", "Build");
|
|
var configuration = Argument("configuration", "Release");
|
|
|
|
var rootDirectory = new DirectoryPath("..");
|
|
var solution = rootDirectory.CombineWithFilePath("osu.sln");
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// TASKS
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
Task("Compile")
|
|
.Does(() => {
|
|
DotNetCoreBuild(solution.FullPath, new DotNetCoreBuildSettings {
|
|
Configuration = configuration,
|
|
});
|
|
});
|
|
|
|
Task("Test")
|
|
.IsDependentOn("Compile")
|
|
.Does(() => {
|
|
var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll");
|
|
|
|
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
|
|
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
|
|
Parallel = true,
|
|
ToolTimeout = TimeSpan.FromMinutes(10),
|
|
});
|
|
});
|
|
|
|
// windows only because both inspectcore and nvika depend on net45
|
|
Task("InspectCode")
|
|
.WithCriteria(IsRunningOnWindows())
|
|
.IsDependentOn("Compile")
|
|
.Does(() => {
|
|
InspectCode(solution, new InspectCodeSettings {
|
|
CachesHome = "inspectcode",
|
|
OutputFile = "inspectcodereport.xml",
|
|
});
|
|
|
|
int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
|
|
if (returnCode != 0)
|
|
throw new Exception($"inspectcode failed with return code {returnCode}");
|
|
});
|
|
|
|
Task("CodeFileSanity")
|
|
.Does(() => {
|
|
ValidateCodeSanity(new ValidateCodeSanitySettings {
|
|
RootDirectory = rootDirectory.FullPath,
|
|
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
|
|
});
|
|
});
|
|
|
|
Task("Build")
|
|
.IsDependentOn("CodeFileSanity")
|
|
.IsDependentOn("InspectCode")
|
|
.IsDependentOn("Test");
|
|
|
|
RunTarget(target); |