1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 00:02:54 +08:00
osu-lazer/build/build.cake

67 lines
2.3 KiB
Plaintext
Raw Normal View History

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