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