зеркало из
1
0
Форкнуть 0

Merge pull request #6 from nunit/enable_building_with_vs2019

Enable building with VS2019
This commit is contained in:
Chris Maddock 2019-05-30 09:25:54 +01:00 коммит произвёл GitHub
Родитель 31de00f4de 0693cfdfee
Коммит f0cacd0204
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 33 добавлений и 25 удалений

Просмотреть файл

@ -1,4 +1,6 @@
build_script:
image: Visual Studio 2019
build_script:
- ps: .\build.ps1 -Target "Appveyor"
# disable built-in tests.

Просмотреть файл

@ -42,6 +42,7 @@ Task("DiscoverSolutions")
//////////////////////////////////////////////////////////////////////
// CLEAN
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
Task("Clean")
.IsDependentOn("DiscoverSolutions")
@ -78,9 +79,9 @@ Task("Build")
try
{
BuildProject(proj, configuration);
MSBuild(proj, CreateSettings());
}
catch (Exception e)
catch
{
// Just record and continue, since samples are independent
ErrorDetail.Add(" * " + projName + " build failed.");
@ -88,6 +89,30 @@ Task("Build")
}
});
// Workaround until Cake 0.34 (https://github.com/cake-build/cake/issues/2546#issuecomment-490756492)
MSBuildSettings CreateSettings()
{
var settings = new MSBuildSettings { Verbosity = Verbosity.Minimal, Configuration = configuration };
if (IsRunningOnWindows())
{
var vsLatest = VSWhereLatest();
var msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
if (msBuildPath != null && !FileExists(msBuildPath))
msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe");
if (!FileExists(msBuildPath))
throw new Exception($"Failed to find MSBuild: {msBuildPath}");
settings.ToolPath = msBuildPath;
}
else
settings.ToolPath = Context.Tools.Resolve("msbuild");
return settings;
}
//////////////////////////////////////////////////////////////////////
// TEST
//////////////////////////////////////////////////////////////////////
@ -121,7 +146,7 @@ Task("Test")
// TEARDOWN TASK
//////////////////////////////////////////////////////////////////////
Teardown(() =>
Teardown(context =>
{
CheckForError(ref ErrorDetail);
});
@ -142,25 +167,6 @@ void CheckForError(ref List<string> errorDetail)
// HELPER METHODS
//////////////////////////////////////////////////////////////////////
void BuildProject(string projPath, string configuration)
{
if (IsRunningOnWindows())
{
MSBuild(projPath, new MSBuildSettings()
.SetConfiguration(configuration)
.SetMSBuildPlatform(MSBuildPlatform.Automatic)
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));
}
else
{
XBuild(projPath, new XBuildSettings()
.WithTarget("Build")
.WithProperty("Configuration", configuration)
.SetVerbosity(Verbosity.Minimal));
}
}
string DirFrom(string filePath)
{
return System.IO.Path.GetDirectoryName(filePath);

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.20.0" />
<package id="NUnit.ConsoleRunner" version="3.6.1" />
<package id="Cake" version="0.33.0" />
<package id="NUnit.ConsoleRunner" version="3.10.0" />
</packages>