Integrate creation of chocolatey package with build
This commit is contained in:
Родитель
e9f6986456
Коммит
02495fc363
|
@ -174,6 +174,7 @@ deploy
|
|||
lib
|
||||
test-results
|
||||
package
|
||||
output
|
||||
images
|
||||
MockAssemblyResult.xml
|
||||
PortabilityAnalysis*.html
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
VERIFICATION
|
||||
Verification is intended to assist the Chocolatey moderators and community
|
||||
in verifying that this package's contents are trustworthy.
|
||||
|
||||
This package is published by the NUnit Project itself. The binaries are
|
||||
identical to those in the NUnit.Extension.VSProjectLoader nuget package.
|
170
build.cake
170
build.cake
|
@ -1,11 +1,27 @@
|
|||
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.1
|
||||
#tool nuget:?package=NUnit.ConsoleRunner&version=3.7.0
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// PROJECT-SPECIFIC
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// When copying the script to support a different extension, the
|
||||
// main changes needed should be in this section.
|
||||
|
||||
var SOLUTION_FILE = "vs-project-loader.sln";
|
||||
var NUSPEC_FILE = "vs-project-loader.nuspec";
|
||||
var UNIT_TEST_ASSEMBLY = "vs-project-loader.tests.dll";
|
||||
var GITHUB_SITE = "https://github.com/nunit/vs-project-loader";
|
||||
var WIKI_PAGE = "https://github.com/nunit/docs/wiki/Console-Command-Line";
|
||||
var VERSION = "3.6.0";
|
||||
|
||||
// Metadata used in the nuget and chocolatey packages
|
||||
var TITLE = "NUnit 3 - Visual Studio Project Loader Extension";
|
||||
var AUTHORS = new [] { "Charlie Poole" };
|
||||
var OWNERS = new [] { "Charlie Poole" };
|
||||
var DESCRIPTION = "This extension allows NUnit to recognize and load solutions and projects in Visual Studio format. It supports files of type .sln, .csproj, .vbproj, .vjsproj, .vcproj and .fsproj.";
|
||||
var SUMMARY = "NUnit Engine extension for loading Visual Studio formatted projects.";
|
||||
var COPYRIGHT = "Copyright (c) 2016 Charlie Poole";
|
||||
var RELEASE_NOTES = new [] { "See https://raw.githubusercontent.com/nunit/nunit-project-loader/master/CHANGES.txt" };
|
||||
var TAGS = new [] { "nunit", "test", "testing", "tdd", "runner" };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ARGUMENTS
|
||||
|
@ -14,14 +30,21 @@ var UNIT_TEST_ASSEMBLY = "vs-project-loader.tests.dll";
|
|||
var target = Argument("target", "Default");
|
||||
var configuration = Argument("configuration", "Debug");
|
||||
|
||||
// Special (optional) arguments for the script. You pass these
|
||||
// through the Cake bootscrap script via the -ScriptArgs argument
|
||||
// for example:
|
||||
// ./build.ps1 -t RePackageNuget -ScriptArgs --nugetVersion="3.9.9"
|
||||
// ./build.ps1 -t RePackageNuget -ScriptArgs '--binaries="rel3.9.9" --nugetVersion="3.9.9"'
|
||||
var nugetVersion = Argument("nugetVersion", (string)null);
|
||||
var chocoVersion = Argument("chocoVersion", (string)null);
|
||||
var binaries = Argument("binaries", (string)null);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// SET PACKAGE VERSION
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
var version = "3.6.0";
|
||||
|
||||
var dbgSuffix = configuration == "Debug" ? "-dbg" : "";
|
||||
var packageVersion = version + dbgSuffix;
|
||||
var packageVersion = VERSION + dbgSuffix;
|
||||
|
||||
if (BuildSystem.IsRunningOnAppVeyor)
|
||||
{
|
||||
|
@ -39,7 +62,7 @@ if (BuildSystem.IsRunningOnAppVeyor)
|
|||
|
||||
if (branch == "master" && !isPullRequest)
|
||||
{
|
||||
packageVersion = version + "-dev-" + buildNumber + dbgSuffix;
|
||||
packageVersion = VERSION + "-dev-" + buildNumber + dbgSuffix;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -56,7 +79,7 @@ if (BuildSystem.IsRunningOnAppVeyor)
|
|||
|
||||
suffix = suffix.Replace(".", "");
|
||||
|
||||
packageVersion = version + suffix;
|
||||
packageVersion = VERSION + suffix;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,13 +92,21 @@ if (BuildSystem.IsRunningOnAppVeyor)
|
|||
|
||||
// Directories
|
||||
var PROJECT_DIR = Context.Environment.WorkingDirectory.FullPath + "/";
|
||||
var PACKAGE_DIR = PROJECT_DIR + "package/";
|
||||
var BIN_DIR = PROJECT_DIR + "bin/" + configuration + "/";
|
||||
var BIN_SRC = BIN_DIR; // Source of binaries used in packaging
|
||||
var OUTPUT_DIR = PROJECT_DIR + "output/";
|
||||
|
||||
// File PATHS
|
||||
var SOLUTION_PATH = PROJECT_DIR + SOLUTION_FILE;
|
||||
var NUSPEC_PATH = PROJECT_DIR + NUSPEC_FILE;
|
||||
var UNIT_TEST_PATH = BIN_DIR + UNIT_TEST_ASSEMBLY;
|
||||
// Adjust BIN_SRC if --binaries option was given
|
||||
if (binaries != null)
|
||||
{
|
||||
BIN_SRC = binaries;
|
||||
if (!System.IO.Path.IsPathRooted(binaries))
|
||||
{
|
||||
BIN_SRC = PROJECT_DIR + binaries;
|
||||
if (!BIN_SRC.EndsWith("/"))
|
||||
BIN_SRC += "/";
|
||||
}
|
||||
}
|
||||
|
||||
// Package sources for nuget restore
|
||||
var PACKAGE_SOURCE = new string[]
|
||||
|
@ -102,7 +133,7 @@ Task("Clean")
|
|||
Task("NuGetRestore")
|
||||
.Does(() =>
|
||||
{
|
||||
NuGetRestore(SOLUTION_PATH, new NuGetRestoreSettings()
|
||||
NuGetRestore(SOLUTION_FILE, new NuGetRestoreSettings()
|
||||
{
|
||||
Source = PACKAGE_SOURCE
|
||||
});
|
||||
|
@ -116,11 +147,27 @@ Task("Build")
|
|||
.IsDependentOn("NuGetRestore")
|
||||
.Does(() =>
|
||||
{
|
||||
DotNetBuild(SOLUTION_PATH, settings => settings
|
||||
.WithTarget("Build")
|
||||
.SetConfiguration(configuration)
|
||||
.SetVerbosity(Verbosity.Minimal)
|
||||
);
|
||||
if (binaries != null)
|
||||
throw new Exception("The --binaries option may only be specified when re-packaging an existing build.");
|
||||
|
||||
if(IsRunningOnWindows())
|
||||
{
|
||||
MSBuild(SOLUTION_FILE, new MSBuildSettings()
|
||||
.SetConfiguration(configuration)
|
||||
.SetMSBuildPlatform(MSBuildPlatform.Automatic)
|
||||
.SetVerbosity(Verbosity.Minimal)
|
||||
.SetNodeReuse(false)
|
||||
.SetPlatformTarget(PlatformTarget.MSIL)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
XBuild(SOLUTION_FILE, new XBuildSettings()
|
||||
.WithTarget("Build")
|
||||
.WithProperty("Configuration", configuration)
|
||||
.SetVerbosity(Verbosity.Minimal)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -131,27 +178,90 @@ Task("Test")
|
|||
.IsDependentOn("Build")
|
||||
.Does(() =>
|
||||
{
|
||||
NUnit3(UNIT_TEST_PATH);
|
||||
NUnit3(BIN_DIR + UNIT_TEST_ASSEMBLY);
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// PACKAGE
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Package")
|
||||
.IsDependentOn("Build")
|
||||
// Additional package metadata
|
||||
var PROJECT_URL = new Uri("http://nunit.org");
|
||||
var ICON_URL = new Uri("https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png");
|
||||
var LICENSE_URL = new Uri("http://nunit.org/nuget/nunit3-license.txt");
|
||||
var PROJECT_SOURCE_URL = new Uri( GITHUB_SITE );
|
||||
var PACKAGE_SOURCE_URL = new Uri( GITHUB_SITE );
|
||||
var BUG_TRACKER_URL = new Uri(GITHUB_SITE + "/issues");
|
||||
var DOCS_URL = new Uri(WIKI_PAGE);
|
||||
var MAILING_LIST_URL = new Uri("https://groups.google.com/forum/#!forum/nunit-discuss");
|
||||
|
||||
Task("RePackageNuGet")
|
||||
.Does(() =>
|
||||
{
|
||||
CreateDirectory(PACKAGE_DIR);
|
||||
CreateDirectory(OUTPUT_DIR);
|
||||
|
||||
NuGetPack(NUSPEC_PATH, new NuGetPackSettings()
|
||||
NuGetPack(new NuGetPackSettings()
|
||||
{
|
||||
Version = packageVersion,
|
||||
BasePath = BIN_DIR,
|
||||
OutputDirectory = PACKAGE_DIR
|
||||
Id = "NUnit.Extension.NUnitProjectLoader",
|
||||
Version = nugetVersion ?? packageVersion,
|
||||
Title = TITLE,
|
||||
Authors = AUTHORS,
|
||||
Owners = OWNERS,
|
||||
Description = DESCRIPTION,
|
||||
Summary = SUMMARY,
|
||||
ProjectUrl = PROJECT_URL,
|
||||
IconUrl = ICON_URL,
|
||||
LicenseUrl = LICENSE_URL,
|
||||
RequireLicenseAcceptance = false,
|
||||
Copyright = COPYRIGHT,
|
||||
ReleaseNotes = RELEASE_NOTES,
|
||||
Tags = TAGS,
|
||||
//Language = "en-US",
|
||||
OutputDirectory = OUTPUT_DIR,
|
||||
Files = new [] {
|
||||
new NuSpecContent { Source = PROJECT_DIR + "LICENSE.txt" },
|
||||
new NuSpecContent { Source = BIN_SRC + "vs-project-loader.dll", Target = "tools" }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Task("RePackageChocolatey")
|
||||
.Does(() =>
|
||||
{
|
||||
CreateDirectory(OUTPUT_DIR);
|
||||
|
||||
ChocolateyPack(
|
||||
new ChocolateyPackSettings()
|
||||
{
|
||||
Id = "nunit-extension-vs-project-loader",
|
||||
Version = chocoVersion ?? packageVersion,
|
||||
Title = TITLE,
|
||||
Authors = AUTHORS,
|
||||
Owners = OWNERS,
|
||||
Description = DESCRIPTION,
|
||||
Summary = SUMMARY,
|
||||
ProjectUrl = PROJECT_URL,
|
||||
IconUrl = ICON_URL,
|
||||
LicenseUrl = LICENSE_URL,
|
||||
RequireLicenseAcceptance = false,
|
||||
Copyright = COPYRIGHT,
|
||||
ProjectSourceUrl = PROJECT_SOURCE_URL,
|
||||
DocsUrl= DOCS_URL,
|
||||
BugTrackerUrl = BUG_TRACKER_URL,
|
||||
PackageSourceUrl = PACKAGE_SOURCE_URL,
|
||||
MailingListUrl = MAILING_LIST_URL,
|
||||
ReleaseNotes = RELEASE_NOTES,
|
||||
Tags = TAGS,
|
||||
//Language = "en-US",
|
||||
OutputDirectory = OUTPUT_DIR,
|
||||
Files = new [] {
|
||||
new ChocolateyNuSpecContent { Source = PROJECT_DIR + "LICENSE.txt", Target = "tools" },
|
||||
new ChocolateyNuSpecContent { Source = PROJECT_DIR + "VERIFICATION.txt", Target = "tools" },
|
||||
new ChocolateyNuSpecContent { Source = BIN_SRC + "vs-project-loader.dll", Target = "tools" }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TASK TARGETS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -160,6 +270,14 @@ Task("Rebuild")
|
|||
.IsDependentOn("Clean")
|
||||
.IsDependentOn("Build");
|
||||
|
||||
Task("Package")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("RePackage");
|
||||
|
||||
Task("RePackage")
|
||||
.IsDependentOn("RePackageNuGet")
|
||||
.IsDependentOn("RePackageChocolatey");
|
||||
|
||||
Task("Appveyor")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("Test")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit.Engine.Api" version="3.5.0-dev-03211" targetFramework="net20" />
|
||||
<package id="NUnit.Engine.Api" version="3.7.0" targetFramework="net20" />
|
||||
</packages>
|
|
@ -33,7 +33,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.engine.api, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.Engine.Api.3.5.0-dev-03211\lib\nunit.engine.api.dll</HintPath>
|
||||
<HintPath>..\..\packages\NUnit.Engine.Api.3.7.0\lib\nunit.engine.api.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.4.1" targetFramework="net20" />
|
||||
<package id="NUnit.Engine.Api" version="3.5.0-dev-03211" targetFramework="net20" />
|
||||
<package id="NUnit" version="3.7.1" targetFramework="net20" />
|
||||
<package id="NUnit.Engine.Api" version="3.7.0" targetFramework="net20" />
|
||||
</packages>
|
|
@ -31,15 +31,15 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.engine.api, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.Engine.Api.3.5.0-dev-03211\lib\nunit.engine.api.dll</HintPath>
|
||||
<HintPath>..\..\packages\NUnit.Engine.Api.3.7.0\lib\nunit.engine.api.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.3.4.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.3.7.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq, Version=0.2.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.3.4.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Reference Include="NUnit.System.Linq, Version=0.6.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NUnit.3.7.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
@ -54,7 +54,6 @@
|
|||
<Compile Include="VSProjectTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<EmbeddedResource Include="resources\cpp-default-library.vcproj" />
|
||||
<EmbeddedResource Include="resources\cpp-sample.vcproj" />
|
||||
<EmbeddedResource Include="resources\fsharp-sample.fsproj" />
|
||||
|
@ -95,6 +94,9 @@
|
|||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
Загрузка…
Ссылка в новой задаче