1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 08:12:55 +08:00
osu-lazer/build.cake

69 lines
2.1 KiB
Plaintext
Raw Normal View History

2018-07-30 02:49:26 +08:00
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools"
#tool "nuget:?package=NVika.MSBuild"
var NVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
var CodeFileSanityToolPath = DownloadFile("https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe");
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-24 03:28:56 +08:00
var framework = Argument("framework", "net471");
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");
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
});
});
Task("Restore Nuget")
.Does(() => NuGetRestore(osuSolution));
2018-07-30 02:49:26 +08:00
Task("InspectCode")
.IsDependentOn("Restore Nuget")
2018-07-30 02:49:26 +08:00
.Does(() => {
InspectCode(osuSolution, new InspectCodeSettings {
CachesHome = "inspectcode",
OutputFile = "inspectcodereport.xml",
});
StartProcess(NVikaToolPath, @"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors");
});
Task("CodeFileSanity")
.Does(() => {
var result = StartProcess(CodeFileSanityToolPath);
if (result != 0)
throw new Exception("Code sanity failed.");
2018-07-30 02:49:26 +08:00
});
2018-07-26 09:40:28 +08:00
Task("Build")
.IsDependentOn("CodeFileSanity")
2018-07-26 09:40:28 +08:00
.IsDependentOn("Compile")
.IsDependentOn("InspectCode")
2018-07-26 09:40:28 +08:00
.IsDependentOn("Test");
2018-07-24 03:28:56 +08:00
RunTarget(target);