2019-10-10 17:51:56 +09:00
|
|
|
#addin "nuget:?package=CodeFileSanity&version=0.0.33"
|
|
|
|
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2019.2.1"
|
2018-09-11 21:49:10 +02:00
|
|
|
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
|
2019-02-15 23:47:22 +01:00
|
|
|
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
2018-07-29 20:49:26 +02:00
|
|
|
|
2018-07-23 21:28:56 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ARGUMENTS
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-07-26 03:40:28 +02:00
|
|
|
var target = Argument("target", "Build");
|
|
|
|
var configuration = Argument("configuration", "Release");
|
2018-07-23 21:28:56 +02:00
|
|
|
|
2019-02-15 23:47:22 +01:00
|
|
|
var rootDirectory = new DirectoryPath("..");
|
|
|
|
var solution = rootDirectory.CombineWithFilePath("osu.sln");
|
2018-07-23 21:28:56 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TASKS
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
Task("Compile")
|
2018-10-29 12:41:22 -07:00
|
|
|
.Does(() => {
|
2019-02-15 23:47:22 +01:00
|
|
|
DotNetCoreBuild(solution.FullPath, new DotNetCoreBuildSettings {
|
2018-10-29 12:41:22 -07:00
|
|
|
Configuration = configuration,
|
|
|
|
});
|
2018-07-23 21:28:56 +02:00
|
|
|
});
|
|
|
|
|
2018-07-26 03:40:28 +02:00
|
|
|
Task("Test")
|
2018-10-29 12:41:22 -07:00
|
|
|
.IsDependentOn("Compile")
|
|
|
|
.Does(() => {
|
2019-02-15 23:47:22 +01:00
|
|
|
var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll");
|
2018-09-16 16:25:19 +02:00
|
|
|
|
2018-10-29 12:41:22 -07:00
|
|
|
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
|
|
|
|
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
|
|
|
|
Parallel = true,
|
|
|
|
ToolTimeout = TimeSpan.FromMinutes(10),
|
|
|
|
});
|
2018-07-23 21:28:56 +02:00
|
|
|
});
|
|
|
|
|
2018-08-07 22:36:52 +02:00
|
|
|
// windows only because both inspectcore and nvika depend on net45
|
2018-07-29 20:49:26 +02:00
|
|
|
Task("InspectCode")
|
2018-10-29 12:41:22 -07:00
|
|
|
.WithCriteria(IsRunningOnWindows())
|
|
|
|
.IsDependentOn("Compile")
|
|
|
|
.Does(() => {
|
2019-02-15 23:47:22 +01:00
|
|
|
InspectCode(solution, new InspectCodeSettings {
|
2018-10-29 12:41:22 -07:00
|
|
|
CachesHome = "inspectcode",
|
|
|
|
OutputFile = "inspectcodereport.xml",
|
|
|
|
});
|
2018-07-30 02:12:39 +02:00
|
|
|
|
2019-04-03 15:43:36 +09:00
|
|
|
int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
|
2019-04-03 15:37:22 +09:00
|
|
|
if (returnCode != 0)
|
|
|
|
throw new Exception($"inspectcode failed with return code {returnCode}");
|
2018-10-29 12:41:22 -07:00
|
|
|
});
|
2018-07-30 02:12:39 +02:00
|
|
|
|
|
|
|
Task("CodeFileSanity")
|
2018-10-29 12:41:22 -07:00
|
|
|
.Does(() => {
|
|
|
|
ValidateCodeSanity(new ValidateCodeSanitySettings {
|
2019-02-16 00:02:08 +01:00
|
|
|
RootDirectory = rootDirectory.FullPath,
|
2018-10-29 12:41:22 -07:00
|
|
|
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
|
|
|
|
});
|
2018-08-04 00:01:17 +02:00
|
|
|
});
|
2018-07-29 20:49:26 +02:00
|
|
|
|
2018-07-26 03:40:28 +02:00
|
|
|
Task("Build")
|
2018-10-29 12:41:22 -07:00
|
|
|
.IsDependentOn("CodeFileSanity")
|
|
|
|
.IsDependentOn("InspectCode")
|
|
|
|
.IsDependentOn("Test");
|
2018-07-23 21:28:56 +02:00
|
|
|
|
|
|
|
RunTarget(target);
|