2018-07-30 02:49:26 +08:00
|
|
|
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools"
|
2018-07-30 08:12:39 +08:00
|
|
|
#tool "nuget:?package=NVika.MSBuild"
|
2018-08-04 06:01:17 +08:00
|
|
|
#addin "nuget:?package=CodeFileSanity"
|
2018-07-30 08:12:39 +08:00
|
|
|
var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
2018-07-30 02:49:26 +08:00
|
|
|
|
2018-07-24 03:28:56 +08:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ARGUMENTS
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-07-26 09:40:28 +08:00
|
|
|
var target = Argument("target", "Build");
|
2018-07-31 03:45:15 +08:00
|
|
|
var framework = Argument("framework", "netcoreapp2.1");
|
2018-07-26 09:40:28 +08:00
|
|
|
var configuration = Argument("configuration", "Release");
|
2018-07-24 03:28:56 +08:00
|
|
|
|
|
|
|
var osuDesktop = new FilePath("./osu.Desktop/osu.Desktop.csproj");
|
2018-07-30 08:12:39 +08:00
|
|
|
var osuSolution = new FilePath("./osu.sln");
|
2018-07-26 09:40:28 +08:00
|
|
|
var testProjects = GetFiles("**/*.Tests.csproj");
|
2018-07-24 03:28:56 +08:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TASKS
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
Task("Compile")
|
|
|
|
.Does(() => {
|
|
|
|
DotNetCoreBuild(osuDesktop.FullPath, new DotNetCoreBuildSettings {
|
|
|
|
Framework = framework,
|
2018-07-26 09:40:28 +08:00
|
|
|
Configuration = configuration
|
2018-07-24 03:28:56 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-07-26 09:40:28 +08:00
|
|
|
Task("Test")
|
|
|
|
.ContinueOnError()
|
2018-07-24 03:28:56 +08:00
|
|
|
.DoesForEach(testProjects, testProject => {
|
2018-07-30 02:49:26 +08:00
|
|
|
DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings {
|
2018-07-26 09:40:28 +08:00
|
|
|
Framework = framework,
|
|
|
|
Configuration = configuration,
|
|
|
|
Logger = $"trx;LogFileName={testProject.GetFilename()}.trx",
|
|
|
|
ResultsDirectory = "./TestResults/"
|
2018-07-24 03:28:56 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-07-30 08:23:31 +08:00
|
|
|
Task("Restore Nuget")
|
|
|
|
.Does(() => NuGetRestore(osuSolution));
|
|
|
|
|
2018-07-30 02:49:26 +08:00
|
|
|
Task("InspectCode")
|
2018-07-30 08:23:31 +08:00
|
|
|
.IsDependentOn("Restore Nuget")
|
2018-08-04 06:02:31 +08:00
|
|
|
.IsDependentOn("Compile")
|
2018-07-30 02:49:26 +08:00
|
|
|
.Does(() => {
|
2018-07-30 08:12:39 +08:00
|
|
|
InspectCode(osuSolution, new InspectCodeSettings {
|
|
|
|
CachesHome = "inspectcode",
|
|
|
|
OutputFile = "inspectcodereport.xml",
|
|
|
|
});
|
|
|
|
|
|
|
|
StartProcess(NVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
|
|
|
|
});
|
|
|
|
|
|
|
|
Task("CodeFileSanity")
|
|
|
|
.Does(() => {
|
2018-08-04 06:01:17 +08:00
|
|
|
ValidateCodeSanity(new ValidateCodeSanitySettings {
|
|
|
|
RootDirectory = ".",
|
|
|
|
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
|
|
|
|
});
|
2018-07-30 02:49:26 +08:00
|
|
|
});
|
|
|
|
|
2018-07-26 09:40:28 +08:00
|
|
|
Task("Build")
|
2018-07-30 08:12:39 +08:00
|
|
|
.IsDependentOn("CodeFileSanity")
|
|
|
|
.IsDependentOn("InspectCode")
|
2018-07-26 09:40:28 +08:00
|
|
|
.IsDependentOn("Test");
|
2018-07-24 03:28:56 +08:00
|
|
|
|
|
|
|
RunTarget(target);
|