Skip to content

Commit dc4a804

Browse files
authored
Merge pull request #447 from reisenberger/v601rtm
v6 release-to-market
2 parents 87f2659 + 31fe683 commit dc4a804

30 files changed

Lines changed: 178 additions & 1932 deletions

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 6.0.1
2+
- Version 6 RTM, for integration to ASPNET Core 2.1 IHttpClientFactory
3+
4+
## 6.0.0-v6alpha
5+
- Publish as strong-named package only (discontinue non-strong-named versions)
6+
- Add .NetStandard 2.0 tfm
7+
- Provide .NET4.5 support via .NetStandard 1.1 tfm
8+
- Discontinue .NET4.0 support
9+
- Remove methods marked as deprecated in v5.9.0
10+
111
## 5.9.0
212
- Allow Timeout.InfiniteTimeSpan (no timeout) for TimeoutPolicy.
313
- Add .AsPolicy<TResult> and .AsAsyncPolicy<TResult> methods for converting non-generic policies to generic policies.

GitVersionConfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
next-version: 5.9.0
1+
next-version: 6.0.1

README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
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.
44

5-
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+).
5+
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).
66

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

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

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

1818
Install-Package Polly
1919

20-
You can install the Strongly Named version via:
21-
22-
Install-Package Polly-Signed
23-
24-
.NET4.0 support is provided via the packages:
25-
26-
Install-Package Polly.Net40Async
27-
Install-Package Polly.Net40Async-Signed
28-
2920

3021
# Resilience policies
3122

@@ -916,10 +907,15 @@ This allows collections of similar kinds of policy to be treated as one - for ex
916907
917908
For more detail see: [Polly and interfaces](https://github.com/App-vNext/Polly/wiki/Polly-and-interfaces) on wiki.
918909
910+
# .NET4.5 support
911+
912+
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).
913+
914+
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.
919915
920916
# .NET4.0 support
921917

922-
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`.
918+
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`.
923919
924920
# .NET3.5 support
925921

@@ -934,9 +930,9 @@ For details of changes by release see the [change log](https://github.com/App-vN
934930
* [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)
935931
* [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)
936932
* [Ian Griffith's TimedLock](http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking)
937-
* [Steven van Deursen's ReadOnlyDictionary](http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=29) (until v5.0.6)
938-
* [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)
939-
* [@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)
933+
* [Steven van Deursen's ReadOnlyDictionary](http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=29) (until Polly v5.0.6)
934+
* [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)
935+
* [@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)
940936
* Build powered by [Cake](http://cakebuild.net/) and [GitVersionTask](https://github.com/GitTools/GitVersion).
941937
942938
# Acknowledgements
@@ -993,6 +989,7 @@ For details of changes by release see the [change log](https://github.com/App-vN
993989
* [@erickhouse](https://github.com/erickhouse) - Add a new onBreak overload that provides the prior state on a transition to an open state.
994990
* [@benagain](https://github.com/benagain) - Bug fix: RelativeTtl in CachePolicy now always returns a ttl relative to time item is cached.
995991
* [@urig](https://github.com/urig) - Allow TimeoutPolicy to be configured with Timeout.InfiniteTimeSpan.
992+
* [@reisenberger](https://github.com/reisenberger) - Integration with [IHttpClientFactory](https://github.com/aspnet/HttpClientFactory/) for ASPNET Core 2.1.
996993
997994
# Sample Projects
998995

build.cake

Lines changed: 59 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ using System.Text.Json;
2626
///////////////////////////////////////////////////////////////////////////////
2727

2828
var projectName = "Polly";
29-
var net40AsyncProjectName = "Polly.Net40Async";
3029
var keyName = "Polly.snk";
3130

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

4039
// NuGet
4140
var nuspecFilename = projectName + ".nuspec";
42-
var net40AsyncNuspecFilename = net40AsyncProjectName + ".nuspec";
4341
var nuspecSrcFile = srcDir + File(nuspecFilename);
4442
var nuspecDestFile = buildDir + File(nuspecFilename);
45-
var net40AsyncNuspecSrcFile = srcDir + File(net40AsyncNuspecFilename);
46-
var net40AsyncNuspecDestFile = buildDir + Directory(net40AsyncProjectName) + File(net40AsyncNuspecFilename);
4743
var nupkgDestDir = artifactsDir + Directory("nuget-package");
4844
var snkFile = srcDir + File(keyName);
4945

5046
var projectToNugetFolderMap = new Dictionary<string, string[]>() {
51-
{ "Net45" , new [] {"net45"} },
5247
{ "NetStandard11", new [] {"netstandard1.1"} },
53-
};
54-
55-
var net40AsyncProjectToNugetFolderMap = new Dictionary<string, string[]>() {
56-
{ "Net40Async" , new [] {"net40"} },
48+
{ "NetStandard20", new [] {"netstandard2.0"} },
5749
};
5850

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

55+
// Versioning
56+
string nugetVersion;
57+
string appveyorBuildNumber;
58+
string assemblyVersion;
59+
string assemblySemver;
60+
6361
// StrongNameSigner
6462
var strongNameSignerPath = ToolsExePath("StrongNameSigner.Console.exe");
6563

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

136134
Information("Updated GlobalAssemblyInfo");
137-
Information("AssemblyVersion -> {0}", gitVersionOutput["AssemblySemVer"]);
138-
Information("AssemblyFileVersion -> {0}", gitVersionOutput["MajorMinorPatch"]);
139-
Information("AssemblyInformationalVersion -> {0}", gitVersionOutput["InformationalVersion"]);
135+
136+
Information("");
137+
Information("Obtained raw version info for package versioning:");
138+
Information("NuGetVersion -> {0}", gitVersionOutput["NuGetVersion"]);
139+
Information("FullSemVer -> {0}", gitVersionOutput["FullSemVer"]);
140+
Information("AssemblySemVer -> {0}", gitVersionOutput["AssemblySemVer"]);
141+
142+
appveyorBuildNumber = gitVersionOutput["FullSemVer"].ToString();
143+
nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
144+
assemblyVersion = gitVersionOutput["Major"].ToString() + ".0.0.0";
145+
assemblySemver = gitVersionOutput["AssemblySemVer"].ToString();
146+
147+
Information("");
148+
Information("Mapping versioning information to:");
149+
Information("Appveyor build number -> {0}", appveyorBuildNumber);
150+
Information("Nuget package version -> {0}", nugetVersion);
151+
Information("AssemblyVersion -> {0}", assemblyVersion);
152+
Information("AssemblyFileVersion -> {0}", assemblySemver);
153+
Information("AssemblyInformationalVersion -> {0}", assemblySemver);
140154
});
141155

142156
Task("__UpdateDotNetStandardAssemblyVersionNumber")
143157
.Does(() =>
144158
{
145-
// NOTE: TEMPORARY fix only, while GitVersionTask does not support .Net Standard assemblies. See https://github.com/App-vNext/Polly/issues/176.
146-
// This build Task can be removed when GitVersionTask supports .Net Standard assemblies.
147-
var assemblySemVer = gitVersionOutput["AssemblySemVer"].ToString();
148-
Information("Updating NetStandard1.1 AssemblyVersion to {0}", assemblySemVer);
149-
var replacedFiles = ReplaceRegexInFiles("./src/Polly.NetStandard11/Properties/AssemblyInfo.cs", "AssemblyVersion[(]\".*\"[)]", "AssemblyVersion(\"" + assemblySemVer +"\")");
150-
if (!replacedFiles.Any())
151-
{
152-
Information("NetStandard1.1 AssemblyVersion could not be updated.");
159+
Information("Updating Assembly Version Information");
160+
161+
var attributeToValueMap = new Dictionary<string, string>() {
162+
{ "AssemblyVersion", assemblyVersion },
163+
{ "AssemblyFileVersion", assemblySemver },
164+
{ "AssemblyInformationalVersion", assemblySemver },
165+
};
166+
167+
var assemblyInfosToUpdate = GetFiles("./src/**/Properties/AssemblyInfo.cs")
168+
.Select(f => f.FullPath)
169+
.Where(f => !f.Contains("Specs"));
170+
171+
foreach(var attributeMap in attributeToValueMap) {
172+
var attribute = attributeMap.Key;
173+
var value = attributeMap.Value;
174+
175+
foreach(var assemblyInfo in assemblyInfosToUpdate) {
176+
var replacedFiles = ReplaceRegexInFiles(assemblyInfo, attribute + "[(]\".*\"[)]", attribute + "(\"" + value +"\")");
177+
if (!replacedFiles.Any())
178+
{
179+
throw new Exception($"{attribute} attribute could not be updated in {assemblyInfo}.");
180+
}
181+
}
153182
}
183+
154184
});
155185

156186
Task("__UpdateAppVeyorBuildNumber")
157187
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
158188
.Does(() =>
159189
{
160-
var fullSemVer = gitVersionOutput["FullSemVer"].ToString();
161-
AppVeyor.UpdateBuildVersion(fullSemVer);
190+
AppVeyor.UpdateBuildVersion(appveyorBuildNumber);
162191
});
163192

164193
Task("__BuildSolutions")
@@ -181,19 +210,12 @@ Task("__BuildSolutions")
181210
Task("__RunTests")
182211
.Does(() =>
183212
{
184-
XUnit2("./src/**/bin/" + configuration + "/**/*.Net4*.Specs.dll", new XUnit2Settings {
185-
OutputDirectory = testResultsDir,
186-
XmlReportV1 = true
187-
});
188-
});
189-
190-
Task("__RunDotnetTests")
191-
.Does(() =>
192-
{
193-
DotNetCoreTest("./src/Polly.NetStandard11.Specs/Polly.NetStandard11.Specs.csproj", new DotNetCoreTestSettings {
194-
Configuration = configuration,
195-
NoBuild = true
196-
});
213+
foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj")) {
214+
DotNetCoreTest(specsProj.FullPath, new DotNetCoreTestSettings {
215+
Configuration = configuration,
216+
NoBuild = true
217+
});
218+
}
197219
});
198220

199221
Task("__CopyOutputToNugetFolder")
@@ -213,59 +235,6 @@ Task("__CopyOutputToNugetFolder")
213235
CopyFile(nuspecSrcFile, nuspecDestFile);
214236
});
215237

216-
Task("__CopyNet40AsyncOutputToNugetFolder")
217-
.Does(() =>
218-
{
219-
foreach(var project in net40AsyncProjectToNugetFolderMap.Keys) {
220-
var sourceDir = srcDir + Directory(projectName + "." + project) + Directory("bin") + Directory(configuration);
221-
222-
foreach(var targetFolder in net40AsyncProjectToNugetFolderMap[project]) {
223-
var destDir = buildDir + Directory(net40AsyncProjectName) + Directory("lib");
224-
225-
Information("Copying {0} -> {1}.", sourceDir, destDir);
226-
CopyDirectory(sourceDir, destDir);
227-
}
228-
}
229-
230-
CopyFile(net40AsyncNuspecSrcFile, net40AsyncNuspecDestFile);
231-
});
232-
233-
Task("__CreateNugetPackage")
234-
.Does(() =>
235-
{
236-
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
237-
var packageName = projectName;
238-
239-
Information("Building {0}.{1}.nupkg", packageName, nugetVersion);
240-
241-
var nuGetPackSettings = new NuGetPackSettings {
242-
Id = packageName,
243-
Title = packageName,
244-
Version = nugetVersion,
245-
OutputDirectory = nupkgDestDir
246-
};
247-
248-
NuGetPack(nuspecDestFile, nuGetPackSettings);
249-
});
250-
251-
Task("__CreateNet40AsyncNugetPackage")
252-
.Does(() =>
253-
{
254-
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
255-
var packageName = net40AsyncProjectName;
256-
257-
Information("Building {0}.{1}.nupkg", packageName, nugetVersion);
258-
259-
var nuGetPackSettings = new NuGetPackSettings {
260-
Id = packageName,
261-
Title = packageName,
262-
Version = nugetVersion,
263-
OutputDirectory = nupkgDestDir
264-
};
265-
266-
NuGetPack(net40AsyncNuspecDestFile, nuGetPackSettings);
267-
});
268-
269238
Task("__StronglySignAssemblies")
270239
.Does(() =>
271240
{
@@ -285,8 +254,7 @@ Task("__StronglySignAssemblies")
285254
Task("__CreateSignedNugetPackage")
286255
.Does(() =>
287256
{
288-
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
289-
var packageName = projectName + "-Signed";
257+
var packageName = projectName;
290258

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

@@ -300,24 +268,6 @@ Task("__CreateSignedNugetPackage")
300268
NuGetPack(nuspecDestFile, nuGetPackSettings);
301269
});
302270

303-
Task("__CreateSignedNet40AsyncNugetPackage")
304-
.Does(() =>
305-
{
306-
var nugetVersion = gitVersionOutput["NuGetVersion"].ToString();
307-
var packageName = net40AsyncProjectName + "-Signed";
308-
309-
Information("Building {0}.{1}.nupkg", packageName, nugetVersion);
310-
311-
var nuGetPackSettings = new NuGetPackSettings {
312-
Id = packageName,
313-
Title = packageName,
314-
Version = nugetVersion,
315-
OutputDirectory = nupkgDestDir
316-
};
317-
318-
NuGetPack(net40AsyncNuspecDestFile, nuGetPackSettings);
319-
});
320-
321271
//////////////////////////////////////////////////////////////////////
322272
// BUILD TASKS
323273
//////////////////////////////////////////////////////////////////////
@@ -330,14 +280,9 @@ Task("Build")
330280
.IsDependentOn("__UpdateAppVeyorBuildNumber")
331281
.IsDependentOn("__BuildSolutions")
332282
.IsDependentOn("__RunTests")
333-
.IsDependentOn("__RunDotnetTests")
334283
.IsDependentOn("__CopyOutputToNugetFolder")
335-
.IsDependentOn("__CopyNet40AsyncOutputToNugetFolder")
336-
.IsDependentOn("__CreateNugetPackage")
337-
.IsDependentOn("__CreateNet40AsyncNugetPackage")
338284
.IsDependentOn("__StronglySignAssemblies")
339-
.IsDependentOn("__CreateSignedNugetPackage")
340-
.IsDependentOn("__CreateSignedNet40AsyncNugetPackage");
285+
.IsDependentOn("__CreateSignedNugetPackage");
341286

342287
///////////////////////////////////////////////////////////////////////////////
343288
// PRIMARY TARGETS

src/Polly.Net40Async.Specs/Polly.Net40Async.Specs.csproj

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/Polly.Net40Async.Specs/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)