Skip to content

Commit

Permalink
Merge pull request #447 from reisenberger/v601rtm
Browse files Browse the repository at this point in the history
v6 release-to-market
  • Loading branch information
joelhulen authored May 6, 2018
2 parents 87f2659 + 31fe683 commit dc4a804
Show file tree
Hide file tree
Showing 30 changed files with 178 additions and 1,932 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 6.0.1
- Version 6 RTM, for integration to ASPNET Core 2.1 IHttpClientFactory

## 6.0.0-v6alpha
- Publish as strong-named package only (discontinue non-strong-named versions)
- Add .NetStandard 2.0 tfm
- Provide .NET4.5 support via .NetStandard 1.1 tfm
- Discontinue .NET4.0 support
- Remove methods marked as deprecated in v5.9.0

## 5.9.0
- Allow Timeout.InfiniteTimeSpan (no timeout) for TimeoutPolicy.
- Add .AsPolicy<TResult> and .AsAsyncPolicy<TResult> methods for converting non-generic policies to generic policies.
Expand Down
2 changes: 1 addition & 1 deletion GitVersionConfig.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
next-version: 5.9.0
next-version: 6.0.1
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.

Polly targets .NET 4.0, .NET 4.5 and .NET Standard 1.1 ([coverage](https://github.com/dotnet/standard/blob/master/docs/versions.md): .NET Core, Mono, Xamarin.iOS, Xamarin.Android, UWP, WP8.1+).
Polly targets .NET Standard 1.1 ([coverage](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support): .NET Framework 4.5-4.6.1, .NET Core 1.0, Mono, Xamarin, UWP, WP8.1+) and .NET Standard 2.0+ ([coverage](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support): .NET Framework 4.6.1, .NET Core 2.0+, and later Mono, Xamarin and UWP targets).

[<img align="right" src="https://github.com/dotnet/swag/raw/master/logo/dotnetfoundation_v4_small.png" width="100" />](https://www.dotnetfoundation.org/)
We are now a member of the [.NET Foundation](https://www.dotnetfoundation.org/about)!
We are a member of the [.NET Foundation](https://www.dotnetfoundation.org/about)!

**Keep up to date with new feature announcements, tips & tricks, and other news through [www.thepollyproject.org](http://www.thepollyproject.org)**

Expand All @@ -17,15 +17,6 @@ We are now a member of the [.NET Foundation](https://www.dotnetfoundation.org/ab

Install-Package Polly

You can install the Strongly Named version via:

Install-Package Polly-Signed

.NET4.0 support is provided via the packages:

Install-Package Polly.Net40Async
Install-Package Polly.Net40Async-Signed


# Resilience policies

Expand Down Expand Up @@ -916,10 +907,15 @@ This allows collections of similar kinds of policy to be treated as one - for ex
For more detail see: [Polly and interfaces](https://github.com/App-vNext/Polly/wiki/Polly-and-interfaces) on wiki.
# .NET4.5 support

From Polly v6.0.0, .NET4.5 support is provided [via the .Net Standard 1.1 target](https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support).
Polly versions up to [v5.9.0](https://www.nuget.org/packages/Polly/5.9.0) have direct target support for .NET Framework 4.5.
# .NET4.0 support

The .NET4.0 package uses `Microsoft.Bcl.Async` to add async support. To minimise dependencies on the main Polly nuget package, the .NET4.0 version is available as separate Nuget packages `Polly.Net40Async` and `Polly.Net40Async-signed`.
The last version of Polly to support .NET4.0 is [v5.9.0](https://www.nuget.org/packages/Polly.Net40Async/5.9.0). The .NET4.0 package uses `Microsoft.Bcl.Async` to add async support. To minimise dependencies on the main Polly nuget package, the .NET4.0 version is available as separate Nuget packages `Polly.Net40Async` and `Polly.Net40Async-signed`.
# .NET3.5 support

Expand All @@ -934,9 +930,9 @@ For details of changes by release see the [change log](https://github.com/App-vN
* [Fluent Assertions](https://github.com/fluentassertions/fluentassertions) - A set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test | [Apache License 2.0 (Apache)](https://github.com/dennisdoomen/fluentassertions/blob/develop/LICENSE)
* [xUnit.net](https://github.com/xunit/xunit) - Free, open source, community-focused unit testing tool for the .NET Framework | [Apache License 2.0 (Apache)](https://github.com/xunit/xunit/blob/master/license.txt)
* [Ian Griffith's TimedLock](http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking)
* [Steven van Deursen's ReadOnlyDictionary](http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=29) (until v5.0.6)
* [Stephen Cleary's AsyncEx library](https://github.com/StephenCleary/AsyncEx) for AsyncSemaphore (supports BulkheadAsync policy for .NET4.0 only) | [MIT license](https://github.com/StephenCleary/AsyncEx/blob/master/LICENSE)
* [@theraot](https://github.com/theraot)'s [ExceptionDispatchInfo implementation for .NET4.0](https://stackoverflow.com/a/31226509/) (supports Timeout policy for .NET4.0 only) including also a contribution by [@migueldeicaza](https://github.com/migueldeicaza) | Licensed under and distributed under [Creative Commons Attribution Share Alike license](https://creativecommons.org/licenses/by-sa/3.0/) per [StackExchange Terms of Service](https://stackexchange.com/legal)
* [Steven van Deursen's ReadOnlyDictionary](http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=29) (until Polly v5.0.6)
* [Stephen Cleary's AsyncEx library](https://github.com/StephenCleary/AsyncEx) for AsyncSemaphore (supports BulkheadAsync policy for .NET4.0 only) (until Polly v5.9.0) | [MIT license](https://github.com/StephenCleary/AsyncEx/blob/master/LICENSE)
* [@theraot](https://github.com/theraot)'s [ExceptionDispatchInfo implementation for .NET4.0](https://stackoverflow.com/a/31226509/) (supports Timeout policy for .NET4.0 only) (until Polly v5.9.0) including also a contribution by [@migueldeicaza](https://github.com/migueldeicaza) | Licensed under and distributed under [Creative Commons Attribution Share Alike license](https://creativecommons.org/licenses/by-sa/3.0/) per [StackExchange Terms of Service](https://stackexchange.com/legal)
* Build powered by [Cake](http://cakebuild.net/) and [GitVersionTask](https://github.com/GitTools/GitVersion).
# Acknowledgements
Expand Down Expand Up @@ -993,6 +989,7 @@ For details of changes by release see the [change log](https://github.com/App-vN
* [@erickhouse](https://github.com/erickhouse) - Add a new onBreak overload that provides the prior state on a transition to an open state.
* [@benagain](https://github.com/benagain) - Bug fix: RelativeTtl in CachePolicy now always returns a ttl relative to time item is cached.
* [@urig](https://github.com/urig) - Allow TimeoutPolicy to be configured with Timeout.InfiniteTimeSpan.
* [@reisenberger](https://github.com/reisenberger) - Integration with [IHttpClientFactory](https://github.com/aspnet/HttpClientFactory/) for ASPNET Core 2.1.
# Sample Projects

Expand Down
173 changes: 59 additions & 114 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ using System.Text.Json;
///////////////////////////////////////////////////////////////////////////////

var projectName = "Polly";
var net40AsyncProjectName = "Polly.Net40Async";
var keyName = "Polly.snk";

var solutions = GetFiles("./**/*.sln");
Expand All @@ -39,27 +38,26 @@ var testResultsDir = artifactsDir + Directory("test-results");

// NuGet
var nuspecFilename = projectName + ".nuspec";
var net40AsyncNuspecFilename = net40AsyncProjectName + ".nuspec";
var nuspecSrcFile = srcDir + File(nuspecFilename);
var nuspecDestFile = buildDir + File(nuspecFilename);
var net40AsyncNuspecSrcFile = srcDir + File(net40AsyncNuspecFilename);
var net40AsyncNuspecDestFile = buildDir + Directory(net40AsyncProjectName) + File(net40AsyncNuspecFilename);
var nupkgDestDir = artifactsDir + Directory("nuget-package");
var snkFile = srcDir + File(keyName);

var projectToNugetFolderMap = new Dictionary<string, string[]>() {
{ "Net45" , new [] {"net45"} },
{ "NetStandard11", new [] {"netstandard1.1"} },
};

var net40AsyncProjectToNugetFolderMap = new Dictionary<string, string[]>() {
{ "Net40Async" , new [] {"net40"} },
{ "NetStandard20", new [] {"netstandard2.0"} },
};

// Gitversion
var gitVersionPath = ToolsExePath("GitVersion.exe");
Dictionary<string, object> gitVersionOutput;

// Versioning
string nugetVersion;
string appveyorBuildNumber;
string assemblyVersion;
string assemblySemver;

// StrongNameSigner
var strongNameSignerPath = ToolsExePath("StrongNameSigner.Console.exe");

Expand Down Expand Up @@ -134,31 +132,62 @@ Task("__UpdateAssemblyVersionInformation")
gitVersionOutput = new JsonParser().Parse<Dictionary<string, object>>(output);

Information("Updated GlobalAssemblyInfo");
Information("AssemblyVersion -> {0}", gitVersionOutput["AssemblySemVer"]);
Information("AssemblyFileVersion -> {0}", gitVersionOutput["MajorMinorPatch"]);
Information("AssemblyInformationalVersion -> {0}", gitVersionOutput["InformationalVersion"]);

Information("");
Information("Obtained raw version info for package versioning:");
Information("NuGetVersion -> {0}", gitVersionOutput["NuGetVersion"]);
Information("FullSemVer -> {0}", gitVersionOutput["FullSemVer"]);
Information("AssemblySemVer -> {0}", gitVersionOutput["AssemblySemVer"]);

appveyorBuildNumber = gitVersionOutput["FullSemVer"].ToString();
nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
assemblyVersion = gitVersionOutput["Major"].ToString() + ".0.0.0";
assemblySemver = gitVersionOutput["AssemblySemVer"].ToString();

Information("");
Information("Mapping versioning information to:");
Information("Appveyor build number -> {0}", appveyorBuildNumber);
Information("Nuget package version -> {0}", nugetVersion);
Information("AssemblyVersion -> {0}", assemblyVersion);
Information("AssemblyFileVersion -> {0}", assemblySemver);
Information("AssemblyInformationalVersion -> {0}", assemblySemver);
});

Task("__UpdateDotNetStandardAssemblyVersionNumber")
.Does(() =>
{
// NOTE: TEMPORARY fix only, while GitVersionTask does not support .Net Standard assemblies. See https://github.com/App-vNext/Polly/issues/176.
// This build Task can be removed when GitVersionTask supports .Net Standard assemblies.
var assemblySemVer = gitVersionOutput["AssemblySemVer"].ToString();
Information("Updating NetStandard1.1 AssemblyVersion to {0}", assemblySemVer);
var replacedFiles = ReplaceRegexInFiles("./src/Polly.NetStandard11/Properties/AssemblyInfo.cs", "AssemblyVersion[(]\".*\"[)]", "AssemblyVersion(\"" + assemblySemVer +"\")");
if (!replacedFiles.Any())
{
Information("NetStandard1.1 AssemblyVersion could not be updated.");
Information("Updating Assembly Version Information");

var attributeToValueMap = new Dictionary<string, string>() {
{ "AssemblyVersion", assemblyVersion },
{ "AssemblyFileVersion", assemblySemver },
{ "AssemblyInformationalVersion", assemblySemver },
};

var assemblyInfosToUpdate = GetFiles("./src/**/Properties/AssemblyInfo.cs")
.Select(f => f.FullPath)
.Where(f => !f.Contains("Specs"));

foreach(var attributeMap in attributeToValueMap) {
var attribute = attributeMap.Key;
var value = attributeMap.Value;

foreach(var assemblyInfo in assemblyInfosToUpdate) {
var replacedFiles = ReplaceRegexInFiles(assemblyInfo, attribute + "[(]\".*\"[)]", attribute + "(\"" + value +"\")");
if (!replacedFiles.Any())
{
throw new Exception($"{attribute} attribute could not be updated in {assemblyInfo}.");
}
}
}

});

Task("__UpdateAppVeyorBuildNumber")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
var fullSemVer = gitVersionOutput["FullSemVer"].ToString();
AppVeyor.UpdateBuildVersion(fullSemVer);
AppVeyor.UpdateBuildVersion(appveyorBuildNumber);
});

Task("__BuildSolutions")
Expand All @@ -181,19 +210,12 @@ Task("__BuildSolutions")
Task("__RunTests")
.Does(() =>
{
XUnit2("./src/**/bin/" + configuration + "/**/*.Net4*.Specs.dll", new XUnit2Settings {
OutputDirectory = testResultsDir,
XmlReportV1 = true
});
});

Task("__RunDotnetTests")
.Does(() =>
{
DotNetCoreTest("./src/Polly.NetStandard11.Specs/Polly.NetStandard11.Specs.csproj", new DotNetCoreTestSettings {
Configuration = configuration,
NoBuild = true
});
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) {
DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings {
Configuration = configuration,
NoBuild = true
});
}
});

Task("__CopyOutputToNugetFolder")
Expand All @@ -213,59 +235,6 @@ Task("__CopyOutputToNugetFolder")
CopyFile(nuspecSrcFile, nuspecDestFile);
});

Task("__CopyNet40AsyncOutputToNugetFolder")
.Does(() =>
{
foreach(var project in net40AsyncProjectToNugetFolderMap.Keys) {
var sourceDir = srcDir + Directory(projectName + "." + project) + Directory("bin") + Directory(configuration);

foreach(var targetFolder in net40AsyncProjectToNugetFolderMap[project]) {
var destDir = buildDir + Directory(net40AsyncProjectName) + Directory("lib");

Information("Copying {0} -> {1}.", sourceDir, destDir);
CopyDirectory(sourceDir, destDir);
}
}

CopyFile(net40AsyncNuspecSrcFile, net40AsyncNuspecDestFile);
});

Task("__CreateNugetPackage")
.Does(() =>
{
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
var packageName = projectName;

Information("Building {0}.{1}.nupkg", packageName, nugetVersion);

var nuGetPackSettings = new NuGetPackSettings {
Id = packageName,
Title = packageName,
Version = nugetVersion,
OutputDirectory = nupkgDestDir
};

NuGetPack(nuspecDestFile, nuGetPackSettings);
});

Task("__CreateNet40AsyncNugetPackage")
.Does(() =>
{
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
var packageName = net40AsyncProjectName;

Information("Building {0}.{1}.nupkg", packageName, nugetVersion);

var nuGetPackSettings = new NuGetPackSettings {
Id = packageName,
Title = packageName,
Version = nugetVersion,
OutputDirectory = nupkgDestDir
};

NuGetPack(net40AsyncNuspecDestFile, nuGetPackSettings);
});

Task("__StronglySignAssemblies")
.Does(() =>
{
Expand All @@ -285,8 +254,7 @@ Task("__StronglySignAssemblies")
Task("__CreateSignedNugetPackage")
.Does(() =>
{
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
var packageName = projectName + "-Signed";
var packageName = projectName;

Information("Building {0}.{1}.nupkg", packageName, nugetVersion);

Expand All @@ -300,24 +268,6 @@ Task("__CreateSignedNugetPackage")
NuGetPack(nuspecDestFile, nuGetPackSettings);
});

Task("__CreateSignedNet40AsyncNugetPackage")
.Does(() =>
{
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
var packageName = net40AsyncProjectName + "-Signed";

Information("Building {0}.{1}.nupkg", packageName, nugetVersion);

var nuGetPackSettings = new NuGetPackSettings {
Id = packageName,
Title = packageName,
Version = nugetVersion,
OutputDirectory = nupkgDestDir
};

NuGetPack(net40AsyncNuspecDestFile, nuGetPackSettings);
});

//////////////////////////////////////////////////////////////////////
// BUILD TASKS
//////////////////////////////////////////////////////////////////////
Expand All @@ -330,14 +280,9 @@ Task("Build")
.IsDependentOn("__UpdateAppVeyorBuildNumber")
.IsDependentOn("__BuildSolutions")
.IsDependentOn("__RunTests")
.IsDependentOn("__RunDotnetTests")
.IsDependentOn("__CopyOutputToNugetFolder")
.IsDependentOn("__CopyNet40AsyncOutputToNugetFolder")
.IsDependentOn("__CreateNugetPackage")
.IsDependentOn("__CreateNet40AsyncNugetPackage")
.IsDependentOn("__StronglySignAssemblies")
.IsDependentOn("__CreateSignedNugetPackage")
.IsDependentOn("__CreateSignedNet40AsyncNugetPackage");
.IsDependentOn("__CreateSignedNugetPackage");

///////////////////////////////////////////////////////////////////////////////
// PRIMARY TARGETS
Expand Down
47 changes: 0 additions & 47 deletions src/Polly.Net40Async.Specs/Polly.Net40Async.Specs.csproj

This file was deleted.

5 changes: 0 additions & 5 deletions src/Polly.Net40Async.Specs/Properties/AssemblyInfo.cs

This file was deleted.

Loading

0 comments on commit dc4a804

Please sign in to comment.