2015-11-23 08:00:18 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ARGUMENTS
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
var target = Argument("target", "Default");
|
|
|
|
var configuration = Argument("configuration", "Debug");
|
2016-02-10 18:12:25 +03:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// SET ERROR LEVELS
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2016-04-06 22:58:27 +03:00
|
|
|
|
2016-02-10 19:04:01 +03:00
|
|
|
var ErrorDetail = new List<string>();
|
2016-02-14 06:18:57 +03:00
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// SET PACKAGE VERSION
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2016-02-10 18:12:25 +03:00
|
|
|
|
2016-06-25 21:04:34 +03:00
|
|
|
var version = "3.5.0";
|
2016-06-23 02:44:28 +03:00
|
|
|
var modifier = "";
|
2015-12-11 22:58:14 +03:00
|
|
|
|
2016-03-10 05:03:36 +03:00
|
|
|
var isCompactFrameworkInstalled = FileExists(Environment.GetEnvironmentVariable("windir") + "\\Microsoft.NET\\Framework\\v3.5\\Microsoft.CompactFramework.CSharp.targets");
|
2016-04-25 11:28:37 +03:00
|
|
|
|
|
|
|
//Find program files on 32-bit or 64-bit Windows
|
|
|
|
var programFiles = Environment.GetEnvironmentVariable("ProgramFiles(x86)") ?? Environment.GetEnvironmentVariable("ProgramFiles");
|
|
|
|
var isSilverlightSDKInstalled = FileExists(programFiles + "\\MSBuild\\Microsoft\\Silverlight\\v5.0\\Microsoft.Silverlight.CSharp.targets");
|
|
|
|
|
2015-12-23 07:01:41 +03:00
|
|
|
var isAppveyor = BuildSystem.IsRunningOnAppVeyor;
|
|
|
|
var dbgSuffix = configuration == "Debug" ? "-dbg" : "";
|
|
|
|
var packageVersion = version + modifier + dbgSuffix;
|
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// SUPPORTED FRAMEWORKS
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
var WindowsFrameworks = new string[] {
|
2016-04-13 00:50:42 +03:00
|
|
|
"net-4.5", "net-4.0", "net-3.5", "net-2.0", "portable", "sl-5.0", "netcf-3.5" };
|
2015-12-11 22:58:14 +03:00
|
|
|
|
|
|
|
var LinuxFrameworks = new string[] {
|
2016-04-13 00:50:42 +03:00
|
|
|
"net-4.5", "net-4.0", "net-3.5", "net-2.0" };
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2015-12-12 05:02:51 +03:00
|
|
|
var AllFrameworks = IsRunningOnWindows() ? WindowsFrameworks : LinuxFrameworks;
|
2016-03-06 00:09:11 +03:00
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2015-12-11 22:58:14 +03:00
|
|
|
// DEFINE RUN CONSTANTS
|
2015-11-23 08:00:18 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-25 06:19:54 +03:00
|
|
|
var PROJECT_DIR = Context.Environment.WorkingDirectory.FullPath + "/";
|
|
|
|
var PACKAGE_DIR = PROJECT_DIR + "package/";
|
|
|
|
var BIN_DIR = PROJECT_DIR + "bin/" + configuration + "/";
|
|
|
|
var IMAGE_DIR = PROJECT_DIR + "images/";
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2016-06-12 17:51:41 +03:00
|
|
|
var SOLUTION_FILE = IsRunningOnWindows()
|
|
|
|
? "./nunit.sln"
|
|
|
|
: "./nunit.linux.sln";
|
|
|
|
|
|
|
|
// Package sources for nuget restore
|
|
|
|
var PACKAGE_SOURCE = new string[]
|
|
|
|
{
|
|
|
|
"https://www.nuget.org/api/v2",
|
|
|
|
"https://www.myget.org/F/nunit/api/v2"
|
|
|
|
};
|
2016-06-12 16:48:33 +03:00
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
// Test Runners
|
2015-12-11 22:58:14 +03:00
|
|
|
var NUNIT3_CONSOLE = BIN_DIR + "nunit3-console.exe";
|
2015-12-22 08:18:05 +03:00
|
|
|
var NUNITLITE_RUNNER = "nunitlite-runner.exe";
|
2015-11-23 08:00:18 +03:00
|
|
|
|
|
|
|
// Test Assemblies
|
|
|
|
var FRAMEWORK_TESTS = "nunit.framework.tests.dll";
|
2016-03-09 01:07:16 +03:00
|
|
|
var EXECUTABLE_FRAMEWORK_TESTS = "nunit.framework.tests.exe";
|
|
|
|
var NUNITLITE_TESTS = "nunitlite.tests.dll";
|
|
|
|
var EXECUTABLE_NUNITLITE_TESTS = "nunitlite.tests.exe";
|
2015-11-23 08:00:18 +03:00
|
|
|
var ENGINE_TESTS = "nunit.engine.tests.dll";
|
|
|
|
var ADDIN_TESTS = "addins/tests/addin-tests.dll";
|
2016-06-21 20:54:47 +03:00
|
|
|
var V2_DRIVER_TESTS = "addins/v2-tests/nunit.v2.driver.tests.dll";
|
2015-11-23 08:00:18 +03:00
|
|
|
var CONSOLE_TESTS = "nunit3-console.tests.dll";
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
// Packages
|
2015-12-23 07:01:41 +03:00
|
|
|
var SRC_PACKAGE = PACKAGE_DIR + "NUnit-" + version + modifier + "-src.zip";
|
|
|
|
var ZIP_PACKAGE = PACKAGE_DIR + "NUnit-" + packageVersion + ".zip";
|
2015-12-25 07:15:36 +03:00
|
|
|
var ZIP_PACKAGE_SL = PACKAGE_DIR + "NUnitSL-" + packageVersion + ".zip";
|
2015-12-25 21:05:53 +03:00
|
|
|
var ZIP_PACKAGE_CF = PACKAGE_DIR + "NUnitCF-" + packageVersion + ".zip";
|
2015-11-23 08:00:18 +03:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2015-12-11 22:58:14 +03:00
|
|
|
// CLEAN
|
2015-11-23 08:00:18 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
Task("Clean")
|
|
|
|
.Does(() =>
|
2016-03-09 01:07:16 +03:00
|
|
|
{
|
|
|
|
CleanDirectory(BIN_DIR);
|
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2015-12-23 07:01:41 +03:00
|
|
|
// INITIALIZE FOR BUILD
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-23 07:01:41 +03:00
|
|
|
Task("InitializeBuild")
|
2015-11-23 08:00:18 +03:00
|
|
|
.Does(() =>
|
2016-03-09 01:07:16 +03:00
|
|
|
{
|
2016-06-12 17:51:41 +03:00
|
|
|
NuGetRestore(SOLUTION_FILE, new NuGetRestoreSettings()
|
|
|
|
{
|
|
|
|
Source = PACKAGE_SOURCE
|
|
|
|
});
|
|
|
|
|
|
|
|
if (BuildSystem.IsRunningOnAppVeyor)
|
|
|
|
{
|
|
|
|
var tag = AppVeyor.Environment.Repository.Tag;
|
|
|
|
|
|
|
|
if (tag.IsTag)
|
|
|
|
{
|
|
|
|
packageVersion = tag.Name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var buildNumber = AppVeyor.Environment.Build.Number;
|
2016-06-23 03:24:33 +03:00
|
|
|
|
|
|
|
var suffix = "-CI-" + buildNumber + dbgSuffix;
|
|
|
|
|
2016-06-12 17:51:41 +03:00
|
|
|
if (AppVeyor.Environment.PullRequest.IsPullRequest)
|
2016-06-23 03:24:33 +03:00
|
|
|
suffix += "-PR-" + AppVeyor.Environment.PullRequest.Number;
|
2016-06-12 17:51:41 +03:00
|
|
|
else if (AppVeyor.Environment.Repository.Branch.StartsWith("release", StringComparison.OrdinalIgnoreCase))
|
2016-06-23 03:24:33 +03:00
|
|
|
suffix += "-PRE-" + buildNumber;
|
2016-06-12 17:51:41 +03:00
|
|
|
else
|
2016-06-23 03:24:33 +03:00
|
|
|
suffix += "-" + AppVeyor.Environment.Repository.Branch;
|
|
|
|
|
2016-07-15 20:01:23 +03:00
|
|
|
// Nuget limits "special version part" to 20 chars. Add one for the hyphen.
|
|
|
|
if (suffix.Length > 21)
|
|
|
|
suffix = suffix.Substring(0, 21);
|
|
|
|
|
2016-06-23 03:24:33 +03:00
|
|
|
packageVersion = version + suffix;
|
2016-06-12 17:51:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
AppVeyor.UpdateBuildVersion(packageVersion);
|
|
|
|
}
|
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2016-07-24 04:14:40 +03:00
|
|
|
// BUILD FRAMEWORKS
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-03-17 04:21:28 +03:00
|
|
|
Task("Build45")
|
2015-11-23 08:00:18 +03:00
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
BuildProject("src/NUnitFramework/framework/nunit.framework-4.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite/nunitlite-4.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/mock-assembly/mock-assembly-4.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/testdata/nunit.testdata-4.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/slow-tests/slow-nunit-tests-4.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/tests/nunit.framework.tests-4.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite.tests/nunitlite.tests-4.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite-runner/nunitlite-runner-4.5.csproj", configuration);
|
|
|
|
});
|
2015-12-11 22:58:14 +03:00
|
|
|
|
2016-03-17 04:21:28 +03:00
|
|
|
Task("Build40")
|
2015-12-11 22:58:14 +03:00
|
|
|
.Does(() =>
|
2015-11-23 08:00:18 +03:00
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
BuildProject("src/NUnitFramework/framework/nunit.framework-4.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite/nunitlite-4.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/mock-assembly/mock-assembly-4.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/testdata/nunit.testdata-4.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/slow-tests/slow-nunit-tests-4.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/tests/nunit.framework.tests-4.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite.tests/nunitlite.tests-4.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite-runner/nunitlite-runner-4.0.csproj", configuration);
|
|
|
|
});
|
2016-03-17 04:21:28 +03:00
|
|
|
|
2016-04-13 00:50:42 +03:00
|
|
|
Task("Build35")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
BuildProject("src/NUnitFramework/framework/nunit.framework-3.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite/nunitlite-3.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/mock-assembly/mock-assembly-3.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/testdata/nunit.testdata-3.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/slow-tests/slow-nunit-tests-3.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/tests/nunit.framework.tests-3.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite.tests/nunitlite.tests-3.5.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite-runner/nunitlite-runner-3.5.csproj", configuration);
|
|
|
|
});
|
|
|
|
|
2016-03-17 04:21:28 +03:00
|
|
|
Task("Build20")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
BuildProject("src/NUnitFramework/framework/nunit.framework-2.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite/nunitlite-2.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/mock-assembly/mock-assembly-2.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/testdata/nunit.testdata-2.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/slow-tests/slow-nunit-tests-2.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/tests/nunit.framework.tests-2.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite.tests/nunitlite.tests-2.0.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite-runner/nunitlite-runner-2.0.csproj", configuration);
|
|
|
|
});
|
2016-03-17 04:21:28 +03:00
|
|
|
|
|
|
|
Task("BuildPortable")
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithCriteria(IsRunningOnWindows())
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
BuildProject("src/NUnitFramework/framework/nunit.framework-portable.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite/nunitlite-portable.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/mock-assembly/mock-assembly-portable.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/testdata/nunit.testdata-portable.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/tests/nunit.framework.tests-portable.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite.tests/nunitlite.tests-portable.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite-runner/nunitlite-runner-portable.csproj", configuration);
|
|
|
|
});
|
2016-03-17 04:21:28 +03:00
|
|
|
|
|
|
|
Task("BuildSL")
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithCriteria(IsRunningOnWindows())
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
if(isSilverlightSDKInstalled)
|
2016-04-06 22:55:42 +03:00
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
BuildProject("src/NUnitFramework/framework/nunit.framework-sl-5.0.csproj", configuration, MSBuildPlatform.x86);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite/nunitlite-sl-5.0.csproj", configuration, MSBuildPlatform.x86);
|
|
|
|
BuildProject("src/NUnitFramework/mock-assembly/mock-assembly-sl-5.0.csproj", configuration, MSBuildPlatform.x86);
|
|
|
|
BuildProject("src/NUnitFramework/testdata/nunit.testdata-sl-5.0.csproj", configuration, MSBuildPlatform.x86);
|
|
|
|
BuildProject("src/NUnitFramework/tests/nunit.framework.tests-sl-5.0.csproj", configuration, MSBuildPlatform.x86);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite.tests/nunitlite.tests-sl-5.0.csproj", configuration, MSBuildPlatform.x86);
|
|
|
|
BuildProject("src/NUnitFramework/nunitlite-runner/nunitlite-runner-sl-5.0.csproj", configuration, MSBuildPlatform.x86);
|
|
|
|
}
|
2016-04-06 22:55:42 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Warning("Silverlight build skipped because files were not present.");
|
2016-04-19 18:42:04 +03:00
|
|
|
if(isAppveyor)
|
2016-04-06 22:55:42 +03:00
|
|
|
throw new Exception("Running Build on Appveyor, but Silverlight not found.");
|
|
|
|
}
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2016-03-17 04:21:28 +03:00
|
|
|
|
|
|
|
Task("BuildCF")
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithCriteria(IsRunningOnWindows())
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-03-17 04:21:28 +03:00
|
|
|
if(isCompactFrameworkInstalled)
|
|
|
|
{
|
|
|
|
BuildProjectCF("src/NUnitFramework/framework/nunit.framework-netcf-3.5.csproj", configuration);
|
|
|
|
BuildProjectCF("src/NUnitFramework/mock-assembly/mock-assembly-netcf-3.5.csproj", configuration);
|
|
|
|
BuildProjectCF("src/NUnitFramework/testdata/nunit.testdata-netcf-3.5.csproj", configuration);
|
|
|
|
BuildProjectCF("src/NUnitFramework/tests/nunit.framework.tests-netcf-3.5.csproj", configuration);
|
|
|
|
BuildProjectCF("src/NUnitFramework/slow-tests/slow-nunit-tests-netcf-3.5.csproj", configuration);
|
|
|
|
BuildProjectCF("src/NUnitFramework/nunitlite/nunitlite-netcf-3.5.csproj", configuration);
|
|
|
|
BuildProjectCF("src/NUnitFramework/nunitlite.tests/nunitlite.tests-netcf-3.5.csproj", configuration);
|
|
|
|
BuildProjectCF("src/NUnitFramework/nunitlite-runner/nunitlite-runner-netcf-3.5.csproj", configuration);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Warning("Compact framework build skipped because files were not present.");
|
2016-04-19 18:42:04 +03:00
|
|
|
if(isAppveyor)
|
2016-03-17 04:21:28 +03:00
|
|
|
throw new Exception("Running Build on Appveyor, but CF not installed, please check that the appveyor-tools.ps1 script ran correctly.");
|
|
|
|
}
|
2015-12-11 22:58:14 +03:00
|
|
|
});
|
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// BUILD ENGINE
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
Task("BuildEngine")
|
2015-12-23 07:01:41 +03:00
|
|
|
.IsDependentOn("InitializeBuild")
|
2015-12-11 22:58:14 +03:00
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
// Engine Commponents
|
|
|
|
BuildProject("./src/NUnitEngine/nunit.engine.api/nunit.engine.api.csproj", configuration);
|
|
|
|
BuildProject("./src/NUnitEngine/nunit.engine/nunit.engine.csproj", configuration);
|
|
|
|
BuildProject("./src/NUnitEngine/nunit-agent/nunit-agent.csproj", configuration);
|
|
|
|
BuildProject("./src/NUnitEngine/nunit-agent/nunit-agent-x86.csproj", configuration);
|
|
|
|
|
|
|
|
// Engine tests
|
|
|
|
BuildProject("./src/NUnitEngine/nunit.engine.tests/nunit.engine.tests.csproj", configuration);
|
|
|
|
|
|
|
|
// Addins
|
|
|
|
BuildProject("./src/NUnitEngine/Addins/nunit-project-loader/nunit-project-loader.csproj", configuration);
|
|
|
|
BuildProject("./src/NUnitEngine/Addins/vs-project-loader/vs-project-loader.csproj", configuration);
|
|
|
|
BuildProject("./src/NUnitEngine/Addins/nunit-v2-result-writer/nunit-v2-result-writer.csproj", configuration);
|
|
|
|
BuildProject("./src/NUnitEngine/Addins/nunit.v2.driver/nunit.v2.driver.csproj", configuration);
|
|
|
|
|
|
|
|
// Addin tests
|
|
|
|
BuildProject("./src/NUnitEngine/Addins/addin-tests/addin-tests.csproj", configuration);
|
|
|
|
BuildProject("./src/NUnitEngine/Addins/nunit.v2.driver.tests/nunit.v2.driver.tests.csproj", configuration);
|
2015-12-11 22:58:14 +03:00
|
|
|
});
|
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// BUILD CONSOLE
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
Task("BuildConsole")
|
2015-12-23 07:01:41 +03:00
|
|
|
.IsDependentOn("InitializeBuild")
|
2015-12-11 22:58:14 +03:00
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
BuildProject("src/NUnitConsole/nunit3-console/nunit3-console.csproj", configuration);
|
|
|
|
BuildProject("src/NUnitConsole/nunit3-console.tests/nunit3-console.tests.csproj", configuration);
|
2015-12-11 22:58:14 +03:00
|
|
|
});
|
2015-12-25 21:05:53 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// BUILD C++ TESTS
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-25 21:05:53 +03:00
|
|
|
Task("BuildCppTestFiles")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("InitializeBuild")
|
|
|
|
.WithCriteria(IsRunningOnWindows)
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2015-12-25 21:05:53 +03:00
|
|
|
MSBuild("./src/NUnitEngine/mock-cpp-clr/mock-cpp-clr-x86.vcxproj", new MSBuildSettings()
|
|
|
|
.SetConfiguration(configuration)
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithProperty("Platform", "x86")
|
2015-12-25 21:05:53 +03:00
|
|
|
.SetVerbosity(Verbosity.Minimal)
|
|
|
|
.SetNodeReuse(false)
|
|
|
|
);
|
|
|
|
MSBuild("./src/NUnitEngine/mock-cpp-clr/mock-cpp-clr-x64.vcxproj", new MSBuildSettings()
|
|
|
|
.SetConfiguration(configuration)
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithProperty("Platform", "x64")
|
2015-12-25 21:05:53 +03:00
|
|
|
.SetVerbosity(Verbosity.Minimal)
|
|
|
|
.SetNodeReuse(false)
|
|
|
|
);
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2016-03-06 00:09:11 +03:00
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// TEST
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2016-02-13 06:32:02 +03:00
|
|
|
|
|
|
|
Task("CheckForError")
|
2016-02-19 05:55:31 +03:00
|
|
|
.Does(() => CheckForError(ref ErrorDetail));
|
2016-02-13 06:32:02 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// TEST FRAMEWORK
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-03-09 01:07:16 +03:00
|
|
|
Task("Test45")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("Build45")
|
2016-04-06 22:58:27 +03:00
|
|
|
.OnError(exception => {ErrorDetail.Add(exception.Message); })
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var runtime = "net-4.5";
|
|
|
|
var dir = BIN_DIR + runtime + "/";
|
|
|
|
RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
|
|
|
|
RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
|
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2016-03-09 01:07:16 +03:00
|
|
|
Task("Test40")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("Build40")
|
2016-04-06 22:58:27 +03:00
|
|
|
.OnError(exception => {ErrorDetail.Add(exception.Message); })
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var runtime = "net-4.0";
|
|
|
|
var dir = BIN_DIR + runtime + "/";
|
|
|
|
RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
|
|
|
|
RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
|
|
|
|
});
|
2015-12-22 08:18:05 +03:00
|
|
|
|
2016-04-13 00:50:42 +03:00
|
|
|
Task("Test35")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("Build35")
|
2016-04-13 00:50:42 +03:00
|
|
|
.OnError(exception => {ErrorDetail.Add(exception.Message); })
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var runtime = "net-3.5";
|
|
|
|
var dir = BIN_DIR + runtime + "/";
|
|
|
|
RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
|
|
|
|
RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
|
|
|
|
});
|
|
|
|
|
2016-03-09 01:07:16 +03:00
|
|
|
Task("Test20")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("Build20")
|
2016-04-06 22:58:27 +03:00
|
|
|
.OnError(exception => {ErrorDetail.Add(exception.Message); })
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var runtime = "net-2.0";
|
|
|
|
var dir = BIN_DIR + runtime + "/";
|
|
|
|
RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
|
|
|
|
RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
|
|
|
|
});
|
2016-03-09 01:07:16 +03:00
|
|
|
|
|
|
|
Task("TestPortable")
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithCriteria(IsRunningOnWindows())
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("BuildPortable")
|
2016-04-06 22:58:27 +03:00
|
|
|
.OnError(exception => {ErrorDetail.Add(exception.Message); })
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var runtime = "portable";
|
|
|
|
var dir = BIN_DIR + runtime + "/";
|
|
|
|
RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
|
|
|
|
RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
|
|
|
|
});
|
2016-03-09 01:07:16 +03:00
|
|
|
|
|
|
|
Task("TestSL")
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithCriteria(IsRunningOnWindows())
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("BuildSL")
|
2016-04-06 22:58:27 +03:00
|
|
|
.OnError(exception => {ErrorDetail.Add(exception.Message); })
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
if(isSilverlightSDKInstalled)
|
2016-04-06 22:55:42 +03:00
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
var runtime = "sl-5.0";
|
|
|
|
var dir = BIN_DIR + runtime + "/";
|
|
|
|
RunTest(dir + NUNITLITE_RUNNER, dir, FRAMEWORK_TESTS, runtime, ref ErrorDetail);
|
|
|
|
RunTest(dir + NUNITLITE_RUNNER, dir, NUNITLITE_TESTS, runtime, ref ErrorDetail);
|
|
|
|
}
|
2016-04-06 22:55:42 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Warning("Silverlight tests skipped because files were not present.");
|
|
|
|
}
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2016-03-09 01:07:16 +03:00
|
|
|
|
|
|
|
Task("TestCF")
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithCriteria(IsRunningOnWindows())
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("BuildCF")
|
2016-04-06 22:58:27 +03:00
|
|
|
.OnError(exception => {ErrorDetail.Add(exception.Message); })
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-03-13 10:26:20 +03:00
|
|
|
if(isCompactFrameworkInstalled)
|
|
|
|
{
|
|
|
|
var runtime = "netcf-3.5";
|
|
|
|
var dir = BIN_DIR + runtime + "/";
|
|
|
|
RunTest(dir + EXECUTABLE_FRAMEWORK_TESTS, dir, runtime, ref ErrorDetail);
|
|
|
|
RunTest(dir + EXECUTABLE_NUNITLITE_TESTS, dir, runtime, ref ErrorDetail);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Warning("Compact framework tests skipped because files were not present.");
|
|
|
|
}
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// TEST ENGINE
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
Task("TestEngine")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build")
|
2016-03-09 01:07:16 +03:00
|
|
|
.OnError(exception => { ErrorDetail.Add(exception.Message); })
|
2016-04-06 22:58:27 +03:00
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
RunTest(NUNIT3_CONSOLE, BIN_DIR, ENGINE_TESTS, "TestEngine", ref ErrorDetail);
|
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
|
|
|
Task("TestAddins")
|
2016-03-09 01:07:16 +03:00
|
|
|
.OnError(exception => { ErrorDetail.Add(exception.Message); })
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
RunTest(NUNIT3_CONSOLE, BIN_DIR, ADDIN_TESTS,"TestAddins", ref ErrorDetail);
|
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
|
|
|
Task("TestV2Driver")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build")
|
2016-03-09 01:07:16 +03:00
|
|
|
.OnError(exception => { ErrorDetail.Add(exception.Message); })
|
2016-04-06 22:58:27 +03:00
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-06-21 20:54:47 +03:00
|
|
|
RunTest(NUNIT3_CONSOLE, BIN_DIR, V2_DRIVER_TESTS,"TestV2Driver", ref ErrorDetail);
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// TEST CONSOLE
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
Task("TestConsole")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build")
|
2016-03-09 01:07:16 +03:00
|
|
|
.OnError(exception => { ErrorDetail.Add(exception.Message); })
|
2016-04-06 22:58:27 +03:00
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
RunTest(NUNIT3_CONSOLE, BIN_DIR, CONSOLE_TESTS, "TestConsole", ref ErrorDetail);
|
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2015-12-11 22:58:14 +03:00
|
|
|
// PACKAGE
|
2015-11-23 08:00:18 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
var RootFiles = new FilePath[]
|
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
"LICENSE.txt",
|
|
|
|
"NOTICES.txt",
|
|
|
|
"CHANGES.txt",
|
|
|
|
"nunit.ico"
|
2015-12-11 22:58:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
var BinFiles = new FilePath[]
|
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
"ConsoleTests.nunit",
|
|
|
|
"EngineTests.nunit",
|
|
|
|
"mock-assembly.exe",
|
|
|
|
"Mono.Cecil.dll",
|
|
|
|
"nunit-agent-x86.exe",
|
|
|
|
"nunit-agent-x86.exe.config",
|
|
|
|
"nunit-agent.exe",
|
|
|
|
"nunit-agent.exe.config",
|
|
|
|
"nunit.engine.addin.xml",
|
|
|
|
"nunit.engine.addins",
|
|
|
|
"nunit.engine.api.dll",
|
|
|
|
"nunit.engine.api.xml",
|
|
|
|
"nunit.engine.dll",
|
|
|
|
"nunit.engine.tests.dll",
|
|
|
|
"nunit.engine.tests.dll.config",
|
|
|
|
"nunit.framework.dll",
|
|
|
|
"nunit.framework.xml",
|
2016-06-25 20:41:02 +03:00
|
|
|
"NUnit.System.Linq.dll",
|
2016-04-06 22:58:27 +03:00
|
|
|
"NUnit2TestResult.xsd",
|
|
|
|
"nunit3-console.exe",
|
|
|
|
"nunit3-console.exe.config",
|
|
|
|
"nunit3-console.tests.dll",
|
2016-06-24 13:22:09 +03:00
|
|
|
"TestListWithEmptyLine.tst",
|
2016-04-06 22:58:27 +03:00
|
|
|
"nunitlite.dll",
|
|
|
|
"TextSummary.xslt",
|
|
|
|
"addins/nunit-project-loader.dll",
|
|
|
|
"addins/nunit-v2-result-writer.dll",
|
|
|
|
"addins/nunit.core.dll",
|
|
|
|
"addins/nunit.core.interfaces.dll",
|
|
|
|
"addins/nunit.v2.driver.dll",
|
|
|
|
"addins/vs-project-loader.dll",
|
|
|
|
"addins/tests/addin-tests.dll",
|
|
|
|
"addins/tests/nunit-project-loader.dll",
|
|
|
|
"addins/tests/nunit.engine.api.dll",
|
|
|
|
"addins/tests/nunit.engine.api.xml",
|
|
|
|
"addins/tests/nunit.framework.dll",
|
|
|
|
"addins/tests/nunit.framework.xml",
|
|
|
|
"addins/tests/vs-project-loader.dll",
|
|
|
|
"addins/v2-tests/nunit.framework.dll",
|
|
|
|
"addins/v2-tests/nunit.framework.xml",
|
2016-06-21 20:54:47 +03:00
|
|
|
"addins/v2-tests/nunit.v2.driver.tests.dll"
|
2015-12-11 22:58:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
// Not all of these are present in every framework
|
2016-04-19 16:47:33 +03:00
|
|
|
// The Microsoft and System assemblies are part of the BCL
|
2016-06-12 19:22:37 +03:00
|
|
|
// used by the .NET 4.0 framework. 4.0 tests will not run without them.
|
|
|
|
// NUnit.System.Linq is only present for the .NET 2.0 build.
|
2015-12-11 22:58:14 +03:00
|
|
|
var FrameworkFiles = new FilePath[]
|
2015-11-23 08:00:18 +03:00
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
"AppManifest.xaml",
|
|
|
|
"mock-assembly.dll",
|
|
|
|
"mock-assembly.exe",
|
|
|
|
"nunit.framework.dll",
|
|
|
|
"nunit.framework.xml",
|
2016-06-12 19:22:37 +03:00
|
|
|
"NUnit.System.Linq.dll",
|
2016-04-06 22:58:27 +03:00
|
|
|
"nunit.framework.tests.dll",
|
|
|
|
"nunit.framework.tests.xap",
|
|
|
|
"nunit.framework.tests_TestPage.html",
|
|
|
|
"nunit.testdata.dll",
|
|
|
|
"nunitlite.dll",
|
|
|
|
"nunitlite.tests.exe",
|
|
|
|
"nunitlite.tests.dll",
|
|
|
|
"slow-nunit-tests.dll",
|
2016-04-19 16:47:33 +03:00
|
|
|
"nunitlite-runner.exe",
|
|
|
|
"Microsoft.Threading.Tasks.dll",
|
|
|
|
"Microsoft.Threading.Tasks.Extensions.Desktop.dll",
|
|
|
|
"Microsoft.Threading.Tasks.Extensions.dll",
|
|
|
|
"System.IO.dll",
|
|
|
|
"System.Runtime.dll",
|
|
|
|
"System.Threading.Tasks.dll"
|
2015-12-11 22:58:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
Task("PackageSource")
|
|
|
|
.Does(() =>
|
2016-04-06 22:58:27 +03:00
|
|
|
{
|
|
|
|
CreateDirectory(PACKAGE_DIR);
|
|
|
|
RunGitCommand(string.Format("archive -o {0} HEAD", SRC_PACKAGE));
|
|
|
|
});
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
Task("CreateImage")
|
2016-04-06 22:58:27 +03:00
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";
|
|
|
|
var imageBinDir = currentImageDir + "bin/";
|
|
|
|
|
|
|
|
CleanDirectory(currentImageDir);
|
|
|
|
|
|
|
|
CopyFiles(RootFiles, currentImageDir);
|
|
|
|
|
|
|
|
CreateDirectory(imageBinDir);
|
|
|
|
Information("Created directory " + imageBinDir);
|
|
|
|
|
|
|
|
foreach(FilePath file in BinFiles)
|
|
|
|
{
|
|
|
|
if (FileExists(BIN_DIR + file))
|
|
|
|
{
|
|
|
|
CreateDirectory(imageBinDir + file.GetDirectory());
|
|
|
|
CopyFile(BIN_DIR + file, imageBinDir + file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var runtime in AllFrameworks)
|
|
|
|
{
|
|
|
|
var targetDir = imageBinDir + Directory(runtime);
|
|
|
|
var sourceDir = BIN_DIR + Directory(runtime);
|
|
|
|
CreateDirectory(targetDir);
|
|
|
|
foreach (FilePath file in FrameworkFiles)
|
|
|
|
{
|
|
|
|
var sourcePath = sourceDir + "/" + file;
|
|
|
|
if (FileExists(sourcePath))
|
|
|
|
CopyFileToDirectory(sourcePath, targetDir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-12-11 22:58:14 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
Task("PackageFramework")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("CreateImage")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";
|
|
|
|
|
|
|
|
CreateDirectory(PACKAGE_DIR);
|
|
|
|
|
|
|
|
NuGetPack("nuget/framework/nunit.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-04-06 22:58:27 +03:00
|
|
|
NuGetPack("nuget/framework/nunitSL.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR
|
|
|
|
});
|
|
|
|
|
|
|
|
NuGetPack("nuget/nunitlite/nunitlite.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-04-06 22:58:27 +03:00
|
|
|
NuGetPack("nuget/nunitlite/nunitliteSL.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
});
|
2016-04-06 22:58:27 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
Task("PackageEngine")
|
|
|
|
.IsDependentOn("CreateImage")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";
|
2016-06-23 09:59:15 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
CreateDirectory(PACKAGE_DIR);
|
2016-04-06 22:58:27 +03:00
|
|
|
|
2016-07-21 21:41:20 +03:00
|
|
|
NuGetPack("nuget/engine/nunit.engine.api.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-04-06 22:58:27 +03:00
|
|
|
NuGetPack("nuget/engine/nunit.engine.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-04-06 22:58:27 +03:00
|
|
|
NuGetPack("nuget/engine/nunit.engine.tool.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
Task("PackageExtensions")
|
|
|
|
.IsDependentOn("CreateImage")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";
|
|
|
|
|
|
|
|
CreateDirectory(PACKAGE_DIR);
|
2016-04-06 22:58:27 +03:00
|
|
|
|
|
|
|
NuGetPack("nuget/extensions/nunit-project-loader.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-04-06 22:58:27 +03:00
|
|
|
NuGetPack("nuget/extensions/vs-project-loader.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-04-06 22:58:27 +03:00
|
|
|
NuGetPack("nuget/extensions/nunit-v2-result-writer.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-04-06 22:58:27 +03:00
|
|
|
NuGetPack("nuget/extensions/nunit.v2.driver.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
2016-05-25 02:34:24 +03:00
|
|
|
});
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2015-12-11 22:58:14 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
Task("PackageConsole")
|
|
|
|
.IsDependentOn("CreateImage")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";
|
|
|
|
|
|
|
|
CreateDirectory(PACKAGE_DIR);
|
|
|
|
|
|
|
|
NuGetPack("nuget/runners/nunit.console-runner.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
|
|
|
|
2016-07-24 22:02:47 +03:00
|
|
|
NuGetPack("nuget/runners/nunit.console-runner-with-extensions.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
|
2016-07-24 22:02:47 +03:00
|
|
|
NuGetPack("nuget/runners/nunit.runners.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR,
|
|
|
|
NoPackageAnalysis = true
|
|
|
|
});
|
2016-07-24 04:14:40 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
Task("PackageZip")
|
|
|
|
.IsDependentOn("CreateImage")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
CreateDirectory(PACKAGE_DIR);
|
|
|
|
|
|
|
|
var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";
|
|
|
|
|
|
|
|
var zipFiles =
|
|
|
|
GetFiles(currentImageDir + "*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/addins/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/addins/tests/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/addins/v2-tests/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/net-2.0/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/net-3.5/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/net-4.0/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/net-4.5/*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/portable/*.*");
|
|
|
|
Zip(currentImageDir, File(ZIP_PACKAGE), zipFiles);
|
|
|
|
|
|
|
|
zipFiles =
|
|
|
|
GetFiles(currentImageDir + "*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/sl-5.0/*.*");
|
|
|
|
Zip(currentImageDir, File(ZIP_PACKAGE_SL), zipFiles);
|
|
|
|
});
|
|
|
|
|
2015-12-23 23:31:19 +03:00
|
|
|
Task("PackageMsi")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("CreateImage")
|
|
|
|
.WithCriteria(IsRunningOnWindows)
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2016-07-27 22:34:11 +03:00
|
|
|
MSBuild("install/nunit/nunit.wixproj", new MSBuildSettings()
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithTarget("Rebuild")
|
2015-12-23 23:31:19 +03:00
|
|
|
.SetConfiguration(configuration)
|
2016-04-06 22:58:27 +03:00
|
|
|
.WithProperty("PackageVersion", packageVersion)
|
|
|
|
.WithProperty("DisplayVersion", version)
|
|
|
|
.WithProperty("OutDir", PACKAGE_DIR)
|
|
|
|
.WithProperty("InstallImage", IMAGE_DIR + "NUnit-" + packageVersion)
|
|
|
|
.SetMSBuildPlatform(MSBuildPlatform.x86)
|
2015-12-23 23:31:19 +03:00
|
|
|
.SetNodeReuse(false)
|
|
|
|
);
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2015-12-11 22:58:14 +03:00
|
|
|
|
2015-12-25 21:05:53 +03:00
|
|
|
Task("PackageCF")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("CreateImage")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
CreateDirectory(PACKAGE_DIR);
|
|
|
|
|
|
|
|
var currentImageDir = IMAGE_DIR + "NUnit-" + packageVersion + "/";
|
|
|
|
|
|
|
|
var zipFiles =
|
|
|
|
GetFiles(currentImageDir + "*.*") +
|
|
|
|
GetFiles(currentImageDir + "bin/netcf-3.5/*.*");
|
|
|
|
|
|
|
|
Zip(currentImageDir, File(ZIP_PACKAGE_CF), zipFiles);
|
|
|
|
|
|
|
|
NuGetPack("nuget/framework/nunitCF.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR
|
|
|
|
});
|
|
|
|
NuGetPack("nuget/nunitlite/nunitLiteCF.nuspec", new NuGetPackSettings()
|
|
|
|
{
|
|
|
|
Version = packageVersion,
|
|
|
|
BasePath = currentImageDir,
|
|
|
|
OutputDirectory = PACKAGE_DIR
|
|
|
|
});
|
|
|
|
});
|
2015-12-25 21:05:53 +03:00
|
|
|
|
2016-02-10 18:39:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// SETUP AND TEARDOWN TASKS
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
Setup(() =>
|
|
|
|
{
|
|
|
|
// Executed BEFORE the first task.
|
2016-04-06 22:58:27 +03:00
|
|
|
});
|
2016-02-10 18:39:14 +03:00
|
|
|
|
|
|
|
Teardown(() =>
|
|
|
|
{
|
|
|
|
// Executed AFTER the last task.
|
2016-02-14 06:18:57 +03:00
|
|
|
CheckForError(ref ErrorDetail);
|
2016-02-10 18:39:14 +03:00
|
|
|
});
|
2016-03-09 01:07:16 +03:00
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2016-03-09 01:07:16 +03:00
|
|
|
// HELPER METHODS - GENERAL
|
2015-12-11 22:58:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-03-09 01:07:16 +03:00
|
|
|
void RunGitCommand(string arguments)
|
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
StartProcess("git", new ProcessSettings()
|
|
|
|
{
|
|
|
|
Arguments = arguments
|
|
|
|
});
|
2016-03-09 01:07:16 +03:00
|
|
|
}
|
|
|
|
|
2016-02-14 06:18:57 +03:00
|
|
|
void CheckForError(ref List<string> errorDetail)
|
2016-02-13 06:32:02 +03:00
|
|
|
{
|
2016-03-06 00:09:11 +03:00
|
|
|
if(errorDetail.Count != 0)
|
2016-02-14 07:00:12 +03:00
|
|
|
{
|
|
|
|
var copyError = new List<string>();
|
|
|
|
copyError = errorDetail.Select(s => s).ToList();
|
|
|
|
errorDetail.Clear();
|
2016-03-10 13:36:50 +03:00
|
|
|
throw new Exception("One or more unit tests failed, breaking the build.\n"
|
2016-02-14 07:00:12 +03:00
|
|
|
+ copyError.Aggregate((x,y) => x + "\n" + y));
|
|
|
|
}
|
2016-02-13 06:32:02 +03:00
|
|
|
}
|
|
|
|
|
2016-03-09 01:07:16 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// HELPER METHODS - BUILD
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
void BuildProject(string projectPath, string configuration)
|
2015-12-12 06:34:40 +03:00
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
BuildProject(projectPath, configuration, MSBuildPlatform.Automatic);
|
2015-12-12 06:34:40 +03:00
|
|
|
}
|
|
|
|
|
2016-03-01 09:55:17 +03:00
|
|
|
void BuildProjectCF(string projectPath, string configuration)
|
|
|
|
{
|
|
|
|
if(IsRunningOnWindows())
|
|
|
|
{
|
|
|
|
// Use MSBuild
|
|
|
|
MSBuild(projectPath, new MSBuildSettings()
|
|
|
|
.SetConfiguration(configuration)
|
2016-04-06 22:58:27 +03:00
|
|
|
.SetMSBuildPlatform(MSBuildPlatform.x86)
|
2016-03-01 09:55:17 +03:00
|
|
|
.SetVerbosity(Verbosity.Minimal)
|
|
|
|
.SetNodeReuse(false)
|
|
|
|
.UseToolVersion(MSBuildToolVersion.VS2008)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-12 06:34:40 +03:00
|
|
|
void BuildProject(string projectPath, string configuration, MSBuildPlatform buildPlatform)
|
2015-12-11 22:58:14 +03:00
|
|
|
{
|
|
|
|
if(IsRunningOnWindows())
|
|
|
|
{
|
|
|
|
// Use MSBuild
|
|
|
|
MSBuild(projectPath, new MSBuildSettings()
|
|
|
|
.SetConfiguration(configuration)
|
2016-04-06 22:58:27 +03:00
|
|
|
.SetMSBuildPlatform(buildPlatform)
|
2015-12-11 22:58:14 +03:00
|
|
|
.SetVerbosity(Verbosity.Minimal)
|
|
|
|
.SetNodeReuse(false)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Use XBuild
|
|
|
|
XBuild(projectPath, new XBuildSettings()
|
|
|
|
.WithTarget("Build")
|
|
|
|
.WithProperty("Configuration", configuration)
|
|
|
|
.SetVerbosity(Verbosity.Minimal)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2016-03-06 00:09:11 +03:00
|
|
|
|
2016-03-09 01:07:16 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// HELPER METHODS - TEST
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-02-14 06:18:57 +03:00
|
|
|
void RunTest(FilePath exePath, DirectoryPath workingDir, string framework, ref List<string> errorDetail)
|
2015-12-11 22:58:14 +03:00
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
int rc = StartProcess(
|
|
|
|
MakeAbsolute(exePath),
|
|
|
|
new ProcessSettings()
|
|
|
|
{
|
|
|
|
WorkingDirectory = workingDir
|
|
|
|
});
|
|
|
|
|
|
|
|
if (rc > 0)
|
2016-02-14 06:18:57 +03:00
|
|
|
errorDetail.Add(string.Format("{0}: {1} tests failed",framework, rc));
|
2016-04-06 22:58:27 +03:00
|
|
|
else if (rc < 0)
|
2016-02-14 06:18:57 +03:00
|
|
|
errorDetail.Add(string.Format("{0} returned rc = {1}", exePath, rc));
|
2015-11-23 08:00:18 +03:00
|
|
|
}
|
|
|
|
|
2016-02-14 06:18:57 +03:00
|
|
|
void RunTest(FilePath exePath, DirectoryPath workingDir, string arguments, string framework, ref List<string> errorDetail)
|
2015-11-23 08:00:18 +03:00
|
|
|
{
|
2016-04-06 22:58:27 +03:00
|
|
|
int rc = StartProcess(
|
|
|
|
MakeAbsolute(exePath),
|
|
|
|
new ProcessSettings()
|
|
|
|
{
|
|
|
|
Arguments = arguments,
|
|
|
|
WorkingDirectory = workingDir
|
|
|
|
});
|
|
|
|
|
|
|
|
if (rc > 0)
|
2016-02-14 06:18:57 +03:00
|
|
|
errorDetail.Add(string.Format("{0}: {1} tests failed",framework, rc));
|
2016-04-06 22:58:27 +03:00
|
|
|
else if (rc < 0)
|
2016-02-14 06:18:57 +03:00
|
|
|
errorDetail.Add(string.Format("{0} returned rc = {1}", exePath, rc));
|
2015-11-23 08:00:18 +03:00
|
|
|
}
|
|
|
|
|
2016-06-23 09:59:15 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
2015-11-23 08:00:18 +03:00
|
|
|
// TASK TARGETS
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
Task("Build")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("BuildFramework")
|
2015-12-11 22:58:14 +03:00
|
|
|
.IsDependentOn("BuildEngine")
|
|
|
|
.IsDependentOn("BuildConsole");
|
2016-03-06 00:09:11 +03:00
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
Task("Rebuild")
|
2016-03-09 01:07:16 +03:00
|
|
|
.IsDependentOn("Clean")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build");
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
Task("BuildFramework")
|
2016-03-17 04:21:28 +03:00
|
|
|
.IsDependentOn("InitializeBuild")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build45")
|
|
|
|
.IsDependentOn("Build40")
|
2016-04-13 00:50:42 +03:00
|
|
|
.IsDependentOn("Build35")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build20")
|
2016-03-17 04:21:28 +03:00
|
|
|
// NOTE: The following tasks use Criteria and will be skipped on Linux
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("BuildPortable")
|
|
|
|
.IsDependentOn("BuildSL")
|
|
|
|
.IsDependentOn("BuildCF");
|
2016-03-17 04:21:28 +03:00
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
Task("TestAll")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("TestFramework")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("TestEngine")
|
|
|
|
.IsDependentOn("TestAddins")
|
|
|
|
.IsDependentOn("TestV2Driver")
|
|
|
|
.IsDependentOn("TestConsole");
|
2016-03-09 01:07:16 +03:00
|
|
|
|
2016-04-19 18:42:04 +03:00
|
|
|
// NOTE: Test has been changed to now be a synonym of TestAll
|
2015-11-23 08:00:18 +03:00
|
|
|
Task("Test")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("TestFramework")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("TestEngine")
|
|
|
|
.IsDependentOn("TestAddins")
|
|
|
|
.IsDependentOn("TestV2Driver")
|
|
|
|
.IsDependentOn("TestConsole");
|
2015-11-23 08:00:18 +03:00
|
|
|
|
2016-07-24 04:14:40 +03:00
|
|
|
Task("TestFramework")
|
|
|
|
.IsDependentOn("BuildFramework")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Test45")
|
|
|
|
.IsDependentOn("Test40")
|
2016-04-13 00:50:42 +03:00
|
|
|
.IsDependentOn("Test35")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Test20")
|
2016-03-09 01:07:16 +03:00
|
|
|
// NOTE: The following tasks use Criteria and will be skipped on Linux
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("TestPortable")
|
|
|
|
.IsDependentOn("TestSL")
|
|
|
|
.IsDependentOn("TestCF");
|
2016-03-09 01:07:16 +03:00
|
|
|
|
2015-12-11 22:58:14 +03:00
|
|
|
Task("Package")
|
2016-02-13 06:32:02 +03:00
|
|
|
.IsDependentOn("CheckForError")
|
2016-07-24 04:14:40 +03:00
|
|
|
.IsDependentOn("PackageFramework")
|
|
|
|
.IsDependentOn("PackageEngine")
|
|
|
|
.IsDependentOn("PackageExtensions")
|
|
|
|
.IsDependentOn("PackageConsole")
|
2016-07-27 22:34:11 +03:00
|
|
|
.IsDependentOn("PackageMsi")
|
|
|
|
//PackageZip includes framework, engine and console components
|
|
|
|
.IsDependentOn("PackageZip");
|
2015-12-11 22:58:14 +03:00
|
|
|
|
|
|
|
Task("Appveyor")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build")
|
|
|
|
.IsDependentOn("TestAll")
|
|
|
|
.IsDependentOn("Package");
|
2015-12-11 22:58:14 +03:00
|
|
|
|
|
|
|
Task("Travis")
|
2016-04-06 22:58:27 +03:00
|
|
|
.IsDependentOn("Build")
|
|
|
|
.IsDependentOn("TestAll");
|
2015-12-11 22:58:14 +03:00
|
|
|
|
2015-11-23 08:00:18 +03:00
|
|
|
Task("Default")
|
|
|
|
.IsDependentOn("Build"); // Rebuild?
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// EXECUTION
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
RunTarget(target);
|