diff --git a/CHANGELOG.md b/CHANGELOG.md index a4d84d5..5d5eb87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.0.0 +- Version compatible with ASPNET Core 3.0 and Polly v7.1.0 +- Add SourceLink support +- Rationalise solution layout + ## 2.0.1 - Version 2 RTM, for integration to ASPNET Core 2.1 IHttpClientFactory diff --git a/GitVersionConfig.yaml b/GitVersionConfig.yaml index 58c9946..aade6b1 100644 --- a/GitVersionConfig.yaml +++ b/GitVersionConfig.yaml @@ -1 +1 @@ -next-version: 2.0.1 \ No newline at end of file +next-version: 3.0.0 \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 3dd6b59..07750e5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,6 +9,7 @@ test: off artifacts: - path: artifacts\nuget-package\*.nupkg + - path: artifacts\nuget-package\*.snupkg environment: # Skip dotnet package caching on build servers diff --git a/build.cake b/build.cake index c94a056..5cbe6fa 100644 --- a/build.cake +++ b/build.cake @@ -11,7 +11,6 @@ var configuration = Argument("configuration", "Release"); #Tool "xunit.runner.console" #Tool "GitVersion.CommandLine" -#Tool "Brutal.Dev.StrongNameSigner" ////////////////////////////////////////////////////////////////////// // EXTERNAL NUGET LIBRARIES @@ -19,6 +18,8 @@ var configuration = Argument("configuration", "Release"); #addin "Cake.FileHelpers" #addin "System.Text.Json" +#addin nuget:?package=Cake.Yaml +#addin nuget:?package=YamlDotNet&version=5.2.1 using System.Text.Json; /////////////////////////////////////////////////////////////////////////////// @@ -26,32 +27,21 @@ using System.Text.Json; /////////////////////////////////////////////////////////////////////////////// var projectName = "Polly.Extensions.Http"; -var keyName = "Polly.snk"; var solutions = GetFiles("./**/*.sln"); var solutionPaths = solutions.Select(solution => solution.GetDirectory()); var srcDir = Directory("./src"); -var buildDir = Directory("./build"); var artifactsDir = Directory("./artifacts"); var testResultsDir = artifactsDir + Directory("test-results"); // NuGet -var nuspecExtension = ".nuspec"; -var nuspecFolder = "nuget-package"; -var nuspecSrcFile = srcDir + File(projectName + nuspecExtension); -var nuspecDestFile = buildDir + File(projectName + nuspecExtension); -var nupkgDestDir = artifactsDir + Directory(nuspecFolder); -var snkFile = srcDir + File(keyName); - -var projectToNugetFolderMap = new Dictionary() { - { "NetStandard11", new [] {"netstandard1.1"} }, - { "NetStandard20", new [] {"netstandard2.0"} }, -}; +var nupkgDestDir = artifactsDir + Directory("nuget-package"); // Gitversion var gitVersionPath = ToolsExePath("GitVersion.exe"); Dictionary gitVersionOutput; +var gitVersionConfigFilePath = "./GitVersionConfig.yaml"; // Versioning string nugetVersion; @@ -59,9 +49,13 @@ string appveyorBuildNumber; string assemblyVersion; string assemblySemver; -// StrongNameSigner -var strongNameSignerPath = ToolsExePath("StrongNameSigner.Console.exe"); - +/////////////////////////////////////////////////////////////////////////////// +// INNER CLASSES +/////////////////////////////////////////////////////////////////////////////// +class GitVersionConfigYaml +{ + public string NextVersion { get; set; } +} /////////////////////////////////////////////////////////////////////////////// // SETUP / TEARDOWN @@ -91,7 +85,6 @@ Task("__Clean") .Does(() => { DirectoryPath[] cleanDirectories = new DirectoryPath[] { - buildDir, testResultsDir, nupkgDestDir, artifactsDir @@ -104,8 +97,7 @@ Task("__Clean") foreach(var path in solutionPaths) { Information("Cleaning {0}", path); - CleanDirectories(path + "/**/bin/" + configuration); - CleanDirectories(path + "/**/obj/" + configuration); + DotNetCoreClean(path.ToString()); } }); @@ -115,7 +107,7 @@ Task("__RestoreNugetPackages") foreach(var solution in solutions) { Information("Restoring NuGet Packages for {0}", solution); - NuGetRestore(solution); + DotNetCoreRestore(solution.ToString()); } }); @@ -125,13 +117,29 @@ Task("__UpdateAssemblyVersionInformation") var gitVersionSettings = new ProcessSettings() .SetRedirectStandardOutput(true); - IEnumerable outputLines; - StartProcess(gitVersionPath, gitVersionSettings, out outputLines); + try { + IEnumerable outputLines; + StartProcess(gitVersionPath, gitVersionSettings, out outputLines); + + var output = string.Join("\n", outputLines); + gitVersionOutput = new JsonParser().Parse>(output); + } + catch + { + Information("Error reading git version information. Build may be running outside of a git repo. Falling back to version specified in " + gitVersionConfigFilePath); + + string gitVersionYamlString = System.IO.File.ReadAllText(gitVersionConfigFilePath); + GitVersionConfigYaml deserialized = DeserializeYaml(gitVersionYamlString.Replace("next-version", "NextVersion")); + string gitVersionConfig = deserialized.NextVersion; - var output = string.Join("\n", outputLines); - gitVersionOutput = new JsonParser().Parse>(output); + gitVersionOutput = new Dictionary{ + { "NuGetVersion", gitVersionConfig + "-NotFromGitRepo" }, + { "FullSemVer", gitVersionConfig }, + { "AssemblySemVer", gitVersionConfig }, + { "Major", gitVersionConfig.Split('.')[0] }, + }; - Information("Updated GlobalAssemblyInfo"); + } Information(""); Information("Obtained raw version info for package versioning:"); @@ -160,24 +168,22 @@ Task("__UpdateDotNetStandardAssemblyVersionNumber") var attributeToValueMap = new Dictionary() { { "AssemblyVersion", assemblyVersion }, - { "AssemblyFileVersion", assemblySemver }, - { "AssemblyInformationalVersion", assemblySemver }, + { "FileVersion", assemblySemver }, + { "InformationalVersion", assemblySemver }, + { "Version", nugetVersion }, + { "PackageVersion", nugetVersion }, }; - var assemblyInfosToUpdate = GetFiles("./src/**/Properties/AssemblyInfo.cs") - .Select(f => f.FullPath) - .Where(f => !f.Contains("Specs")); + var csproj = File("./src/" + projectName + "/" + projectName + ".csproj"); 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}."); - } + var replacedFiles = ReplaceRegexInFiles(csproj, $@"\<{attribute}\>[^\<]*\", $@"<{attribute}>{value}"); + if (!replacedFiles.Any()) + { + throw new Exception($"{attribute} version could not be updated in {csproj}."); } } @@ -197,13 +203,14 @@ Task("__BuildSolutions") { Information("Building {0}", solution); - MSBuild(solution, settings => - settings - .SetConfiguration(configuration) - .WithProperty("TreatWarningsAsErrors", "true") - .UseToolVersion(MSBuildToolVersion.VS2017) - .SetVerbosity(Verbosity.Minimal) - .SetNodeReuse(false)); + var dotNetCoreBuildSettings = new DotNetCoreBuildSettings { + Configuration = configuration, + Verbosity = DotNetCoreVerbosity.Minimal, + NoRestore = true, + MSBuildSettings = new DotNetCoreMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error } + }; + + DotNetCoreBuild(solution.ToString(), dotNetCoreBuildSettings); } }); @@ -218,39 +225,6 @@ Task("__RunTests") } }); -Task("__CopyOutputToNugetFolder") - .Does(() => -{ - foreach(var project in projectToNugetFolderMap.Keys) { - var sourceDir = srcDir + Directory(projectName + "." + project) + Directory("bin") + Directory(configuration); - - foreach(var targetFolder in projectToNugetFolderMap[project]) { - var destDir = buildDir + Directory("lib"); - - Information("Copying {0} -> {1}.", sourceDir, destDir); - CopyDirectory(sourceDir, destDir); - } - } - - CopyFile(nuspecSrcFile, nuspecDestFile); -}); - -Task("__StronglySignAssemblies") - .Does(() => -{ - //see: https://github.com/brutaldev/StrongNameSigner - var strongNameSignerSettings = new ProcessSettings() - .WithArguments(args => args - .Append("-in") - .AppendQuoted(buildDir) - .Append("-k") - .AppendQuoted(snkFile) - .Append("-l") - .AppendQuoted("Changes")); - - StartProcess(strongNameSignerPath, strongNameSignerSettings); -}); - Task("__CreateSignedNugetPackage") .Does(() => { @@ -258,14 +232,13 @@ Task("__CreateSignedNugetPackage") Information("Building {0}.{1}.nupkg", packageName, nugetVersion); - var nuGetPackSettings = new NuGetPackSettings { - Id = packageName, - Title = packageName, - Version = nugetVersion, + var dotNetCorePackSettings = new DotNetCorePackSettings { + Configuration = configuration, + NoBuild = true, OutputDirectory = nupkgDestDir }; - NuGetPack(nuspecDestFile, nuGetPackSettings); + DotNetCorePack($@"{srcDir}\{projectName}.sln", dotNetCorePackSettings); }); ////////////////////////////////////////////////////////////////////// @@ -280,8 +253,6 @@ Task("Build") .IsDependentOn("__UpdateAppVeyorBuildNumber") .IsDependentOn("__BuildSolutions") .IsDependentOn("__RunTests") - .IsDependentOn("__CopyOutputToNugetFolder") - .IsDependentOn("__StronglySignAssemblies") .IsDependentOn("__CreateSignedNugetPackage"); /////////////////////////////////////////////////////////////////////////////// @@ -302,6 +273,6 @@ RunTarget(target); ////////////////////////////////////////////////////////////////////// string ToolsExePath(string exeFileName) { - var exePath = System.IO.Directory.GetFiles(@".\Tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault(); + var exePath = System.IO.Directory.GetFiles(@"./tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault(); return exePath; } diff --git a/src/GlobalAssemblyInfo.cs b/src/GlobalAssemblyInfo.cs deleted file mode 100644 index 946c00b..0000000 --- a/src/GlobalAssemblyInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyProduct("Polly.Extensions.Http")] -[assembly: AssemblyCompany("App vNext")] -[assembly: AssemblyDescription("Polly.Extensions.Http is an extensions package containing opinionated convenience methods for configuring Polly policies to handle transient faults typical of calls through HttpClient.")] -[assembly: AssemblyCopyright("Copyright (c) 2018, App vNext")] - -#if DEBUG -[assembly: AssemblyConfiguration("Debug")] -#else -[assembly: AssemblyConfiguration("Release")] -#endif diff --git a/src/Polly.Extensions.Http.NetStandard11.Specs/Polly.Extensions.Http.NetStandard11.Specs.csproj b/src/Polly.Extensions.Http.NetStandard11.Specs/Polly.Extensions.Http.NetStandard11.Specs.csproj deleted file mode 100644 index 7fb7747..0000000 --- a/src/Polly.Extensions.Http.NetStandard11.Specs/Polly.Extensions.Http.NetStandard11.Specs.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - false - Library - netcoreapp1.1 - library - - - full - TRACE;DEBUG;NETCOREAPP1_1 - - - pdbonly - true - TRACE;RELEASE;NETCOREAPP1_1 - - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - diff --git a/src/Polly.Extensions.Http.NetStandard11.Specs/Properties/AssemblyInfo.cs b/src/Polly.Extensions.Http.NetStandard11.Specs/Properties/AssemblyInfo.cs deleted file mode 100644 index e76dbc8..0000000 --- a/src/Polly.Extensions.Http.NetStandard11.Specs/Properties/AssemblyInfo.cs +++ /dev/null @@ -1 +0,0 @@ -[assembly: Xunit.CollectionBehavior(DisableTestParallelization = false)] \ No newline at end of file diff --git a/src/Polly.Extensions.Http.NetStandard11/Polly.Extensions.Http.NetStandard11.csproj b/src/Polly.Extensions.Http.NetStandard11/Polly.Extensions.Http.NetStandard11.csproj deleted file mode 100644 index 8f60a27..0000000 --- a/src/Polly.Extensions.Http.NetStandard11/Polly.Extensions.Http.NetStandard11.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - Polly.Extensions.Http - - TRACE;PORTABLE - en-US - false - true - Polly.Extensions.Http - netstandard1.1 - 1.6.1 - - - full - - - pdbonly - true - - - - False - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - \ No newline at end of file diff --git a/src/Polly.Extensions.Http.NetStandard11/Properties/AssemblyInfo.cs b/src/Polly.Extensions.Http.NetStandard11/Properties/AssemblyInfo.cs deleted file mode 100644 index 1754279..0000000 --- a/src/Polly.Extensions.Http.NetStandard11/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("Polly.Extensions.Http")] -[assembly: AssemblyInformationalVersion("2.0.1.0")] -[assembly: AssemblyFileVersion("2.0.1.0")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: CLSCompliant(true)] - -[assembly: InternalsVisibleTo("Polly.Extensions.Http.NetStandard11.Specs")] \ No newline at end of file diff --git a/src/Polly.Extensions.Http.NetStandard20.Specs/Polly.Extensions.Http.NetStandard20.Specs.csproj b/src/Polly.Extensions.Http.NetStandard20.Specs/Polly.Extensions.Http.NetStandard20.Specs.csproj deleted file mode 100644 index 77fe697..0000000 --- a/src/Polly.Extensions.Http.NetStandard20.Specs/Polly.Extensions.Http.NetStandard20.Specs.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - false - Library - netcoreapp2.0 - library - - - full - TRACE;DEBUG;NETCOREAPP2_0 - - - pdbonly - true - TRACE;RELEASE;NETCOREAPP2_0 - - - - - - - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - diff --git a/src/Polly.Extensions.Http.NetStandard20.Specs/Properties/AssemblyInfo.cs b/src/Polly.Extensions.Http.NetStandard20.Specs/Properties/AssemblyInfo.cs deleted file mode 100644 index e76dbc8..0000000 --- a/src/Polly.Extensions.Http.NetStandard20.Specs/Properties/AssemblyInfo.cs +++ /dev/null @@ -1 +0,0 @@ -[assembly: Xunit.CollectionBehavior(DisableTestParallelization = false)] \ No newline at end of file diff --git a/src/Polly.Extensions.Http.NetStandard20/Polly.Extensions.Http.NetStandard20.csproj b/src/Polly.Extensions.Http.NetStandard20/Polly.Extensions.Http.NetStandard20.csproj deleted file mode 100644 index 79e77c1..0000000 --- a/src/Polly.Extensions.Http.NetStandard20/Polly.Extensions.Http.NetStandard20.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - Polly.Extensions.Http - - TRACE;PORTABLE - en-US - false - true - Polly.Extensions.Http - netstandard2.0 - - - full - - - pdbonly - true - - - - False - - - - - Properties\GlobalAssemblyInfo.cs - - - - - - - \ No newline at end of file diff --git a/src/Polly.Extensions.Http.NetStandard20/Properties/AssemblyInfo.cs b/src/Polly.Extensions.Http.NetStandard20/Properties/AssemblyInfo.cs deleted file mode 100644 index 70f5749..0000000 --- a/src/Polly.Extensions.Http.NetStandard20/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("Polly.Extensions.Http")] -[assembly: AssemblyInformationalVersion("2.0.1.0")] -[assembly: AssemblyFileVersion("2.0.1.0")] -[assembly: AssemblyVersion("2.0.0.0")] -[assembly: CLSCompliant(true)] - -[assembly: InternalsVisibleTo("Polly.Extensions.Http.NetStandard20.Specs")] \ No newline at end of file diff --git a/src/Polly.Extensions.Http.Shared/Polly.Extensions.Http.Shared.projitems b/src/Polly.Extensions.Http.Shared/Polly.Extensions.Http.Shared.projitems deleted file mode 100644 index 28ad1d6..0000000 --- a/src/Polly.Extensions.Http.Shared/Polly.Extensions.Http.Shared.projitems +++ /dev/null @@ -1,14 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 23fa87f9-c77d-4c67-a0b0-2901de51b3ff - - - Polly.Extensions.Http.Shared - - - - - \ No newline at end of file diff --git a/src/Polly.Extensions.Http.Shared/Polly.Extensions.Http.Shared.shproj b/src/Polly.Extensions.Http.Shared/Polly.Extensions.Http.Shared.shproj deleted file mode 100644 index b67bc17..0000000 --- a/src/Polly.Extensions.Http.Shared/Polly.Extensions.Http.Shared.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 23fa87f9-c77d-4c67-a0b0-2901de51b3ff - 14.0 - - - - - - - - diff --git a/src/Polly.Extensions.Http.SharedSpecs/Polly.Extensions.Http.SharedSpecs.projitems b/src/Polly.Extensions.Http.SharedSpecs/Polly.Extensions.Http.SharedSpecs.projitems deleted file mode 100644 index aabc28d..0000000 --- a/src/Polly.Extensions.Http.SharedSpecs/Polly.Extensions.Http.SharedSpecs.projitems +++ /dev/null @@ -1,14 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 8d537c37-a4a2-4be1-84bc-34f1afb51ca8 - - - Polly.Extensions.Http.SharedSpecs - - - - - \ No newline at end of file diff --git a/src/Polly.Extensions.Http.SharedSpecs/Polly.Extensions.Http.SharedSpecs.shproj b/src/Polly.Extensions.Http.SharedSpecs/Polly.Extensions.Http.SharedSpecs.shproj deleted file mode 100644 index 6ddca4c..0000000 --- a/src/Polly.Extensions.Http.SharedSpecs/Polly.Extensions.Http.SharedSpecs.shproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - 8d537c37-a4a2-4be1-84bc-34f1afb51ca8 - 14.0 - - - - - - - - diff --git a/src/Polly.Extensions.Http.SharedSpecs/HttpPolicyExtensionsSpecs.cs b/src/Polly.Extensions.Http.Specs/HttpPolicyExtensionsSpecs.cs similarity index 83% rename from src/Polly.Extensions.Http.SharedSpecs/HttpPolicyExtensionsSpecs.cs rename to src/Polly.Extensions.Http.Specs/HttpPolicyExtensionsSpecs.cs index 01c0f14..ac63946 100644 --- a/src/Polly.Extensions.Http.SharedSpecs/HttpPolicyExtensionsSpecs.cs +++ b/src/Polly.Extensions.Http.Specs/HttpPolicyExtensionsSpecs.cs @@ -3,9 +3,6 @@ using System.Net.Http; using System.Threading.Tasks; using FluentAssertions; -using Polly; -using Polly.Extensions.Http; -using Polly.Fallback; using Xunit; @@ -24,7 +21,7 @@ public void Should_be_able_to_reference_HandleTransientHttpError() public void HandleTransientHttpError_should_handle_HttpRequestException() { bool policyHandled = false; - FallbackPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() + IAsyncPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -40,7 +37,7 @@ public void HandleTransientHttpError_should_handle_HttpRequestException() public void HandleTransientHttpError_should_handle_HttpStatusCode_RequestTimeout() { bool policyHandled = false; - FallbackPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() + IAsyncPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -56,7 +53,7 @@ public void HandleTransientHttpError_should_handle_HttpStatusCode_RequestTimeout public void HandleTransientHttpError_should_handle_HttpStatusCode_InternalServerError() { bool policyHandled = false; - FallbackPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() + IAsyncPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -72,7 +69,7 @@ public void HandleTransientHttpError_should_handle_HttpStatusCode_InternalServer public void HandleTransientHttpError_should_not_handle_HttpStatusCode_BadRequest() { bool policyHandled = false; - FallbackPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() + IAsyncPolicy policy = HttpPolicyExtensions.HandleTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -97,7 +94,7 @@ public void Should_be_able_to_reference_OrTransientHttpError() public void OrTransientHttpError_should_handle_HttpRequestException() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -113,7 +110,7 @@ public void OrTransientHttpError_should_handle_HttpRequestException() public void OrTransientHttpError_should_handle_HttpStatusCode_RequestTimeout() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -129,7 +126,7 @@ public void OrTransientHttpError_should_handle_HttpStatusCode_RequestTimeout() public void OrTransientHttpError_should_handle_HttpStatusCode_InternalServerError() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -145,7 +142,7 @@ public void OrTransientHttpError_should_handle_HttpStatusCode_InternalServerErro public void OrTransientHttpError_should_not_handle_HttpStatusCode_BadRequest() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -168,7 +165,7 @@ public void Should_be_able_to_reference_OrTransientHttpError_onGenericPolicyBuil public void OrTransientHttpError_onGenericPolicyBuilder_should_handle_HttpRequestException() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -184,7 +181,7 @@ public void OrTransientHttpError_onGenericPolicyBuilder_should_handle_HttpReques public void OrTransientHttpError_onGenericPolicyBuilder_should_handle_HttpStatusCode_RequestTimeout() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -200,7 +197,7 @@ public void OrTransientHttpError_onGenericPolicyBuilder_should_handle_HttpStatus public void OrTransientHttpError_onGenericPolicyBuilder_should_handle_HttpStatusCode_InternalServerError() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -216,7 +213,7 @@ public void OrTransientHttpError_onGenericPolicyBuilder_should_handle_HttpStatus public void OrTransientHttpError_onGenericPolicyBuilder_should_not_handle_HttpStatusCode_BadRequest() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpError() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpError() .FallbackAsync(token => { policyHandled = true; @@ -246,7 +243,7 @@ public void Should_be_able_to_reference_OrTransientHttpStatusCode_onGenericPolic public void OrTransientHttpStatusCode_should_not_handle_HttpRequestException() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpStatusCode() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpStatusCode() .FallbackAsync(token => { policyHandled = true; @@ -262,7 +259,7 @@ public void OrTransientHttpStatusCode_should_not_handle_HttpRequestException() public void OrTransientHttpStatusCode_should_handle_HttpStatusCode_RequestTimeout() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpStatusCode() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpStatusCode() .FallbackAsync(token => { policyHandled = true; @@ -278,7 +275,7 @@ public void OrTransientHttpStatusCode_should_handle_HttpStatusCode_RequestTimeou public void OrTransientHttpStatusCode_should_handle_HttpStatusCode_InternalServerError() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpStatusCode() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpStatusCode() .FallbackAsync(token => { policyHandled = true; @@ -294,7 +291,7 @@ public void OrTransientHttpStatusCode_should_handle_HttpStatusCode_InternalServe public void OrTransientHttpStatusCode_should_not_handle_HttpStatusCode_BadRequest() { bool policyHandled = false; - FallbackPolicy policy = Policy.Handle().OrTransientHttpStatusCode() + IAsyncPolicy policy = Policy.Handle().OrTransientHttpStatusCode() .FallbackAsync(token => { policyHandled = true; diff --git a/src/Polly.Extensions.Http.Specs/Polly.Extensions.Http.Specs.csproj b/src/Polly.Extensions.Http.Specs/Polly.Extensions.Http.Specs.csproj new file mode 100644 index 0000000..97b74a4 --- /dev/null +++ b/src/Polly.Extensions.Http.Specs/Polly.Extensions.Http.Specs.csproj @@ -0,0 +1,22 @@ + + + + netcoreapp1.1;netcoreapp2.0 + ..\Polly.snk + true + + + + + + + + + + + + + + + + diff --git a/src/Polly.Extensions.Http.nuspec b/src/Polly.Extensions.Http.nuspec deleted file mode 100644 index d79d757..0000000 --- a/src/Polly.Extensions.Http.nuspec +++ /dev/null @@ -1,59 +0,0 @@ - - - - App vNext - App vNext - - Polly.Extensions.Http is an extensions package containing opinionated convenience methods for configuring Polly policies to handle transient faults typical of calls through HttpClient. - - en-US - https://raw.github.com/App-vNext/Polly.Extensions.Http/master/LICENSE.txt - https://raw.github.com/App-vNext/Polly.Extensions.Http/master/Polly.png - https://github.com/App-vNext/Polly.Extensions.Http - HttpClient Exception Handling Resilience Transient Fault Policy - Copyright © 2018, App vNext - - 2.0.1 - --------------------- - - Version 2 RTM, for integration to ASPNET Core 2.1 IHttpClientFactory - - 2.0.0-v2alpha - --------------------- - - Publish as strong-named package only (discontinue non-strong-named versions) - - Add .NetStandard 2.0 target - - 1.0.3 - --------------------- - - RTM version - - 1.0.2-rc1 - --------------------- - - Reference Polly v5.9.0 - - Update xUnit and FluentAssertions dependencies - - 1.0.1-preview2 - --------------------- - - Fix signing of DLLs in strong-name package - - 1.0.0-preview2 - --------------------- - - Public release for use with ASP.NET Core 2.1-preview2 - - 0.1.0 - --------------------- - - Initial implementation - - - - - - - - - - - - - - - diff --git a/src/Polly.Extensions.Http.sln b/src/Polly.Extensions.Http.sln index 412814c..5ada18d 100644 --- a/src/Polly.Extensions.Http.sln +++ b/src/Polly.Extensions.Http.sln @@ -3,30 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.16 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{79FE9DBE-1155-4F78-A41F-FE95DEFA19DD}" - ProjectSection(SolutionItems) = preProject - GlobalAssemblyInfo.cs = GlobalAssemblyInfo.cs - Polly.Extensions.Http.nuspec = Polly.Extensions.Http.nuspec - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Extensions.Http", "Polly.Extensions.Http\Polly.Extensions.Http.csproj", "{5017174E-DAC5-4408-AB15-1F902F40C612}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Polly.Extensions.Http.Shared", "Polly.Extensions.Http.Shared\Polly.Extensions.Http.Shared.shproj", "{23FA87F9-C77D-4C67-A0B0-2901DE51B3FF}" -EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Polly.Extensions.Http.SharedSpecs", "Polly.Extensions.Http.SharedSpecs\Polly.Extensions.Http.SharedSpecs.shproj", "{8D537C37-A4A2-4BE1-84BC-34F1AFB51CA8}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Extensions.Http.NetStandard11", "Polly.Extensions.Http.NetStandard11\Polly.Extensions.Http.NetStandard11.csproj", "{5017174E-DAC5-4408-AB15-1F902F40C612}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Extensions.Http.NetStandard11.Specs", "Polly.Extensions.Http.NetStandard11.Specs\Polly.Extensions.Http.NetStandard11.Specs.csproj", "{615C92EC-5921-40F4-A690-C66B1587C08E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Extensions.Http.NetStandard20", "Polly.Extensions.Http.NetStandard20\Polly.Extensions.Http.NetStandard20.csproj", "{D8108479-6F4B-45CB-9E49-D45D1DC18F10}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Polly.Extensions.Http.NetStandard20.Specs", "Polly.Extensions.Http.NetStandard20.Specs\Polly.Extensions.Http.NetStandard20.Specs.csproj", "{435D99EB-3689-4EA0-96FE-2FA17930322D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Extensions.Http.Specs", "Polly.Extensions.Http.Specs\Polly.Extensions.Http.Specs.csproj", "{615C92EC-5921-40F4-A690-C66B1587C08E}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - Polly.Extensions.Http.Shared\Polly.Extensions.Http.Shared.projitems*{23fa87f9-c77d-4c67-a0b0-2901de51b3ff}*SharedItemsImports = 13 - Polly.Extensions.Http.Shared\Polly.Extensions.Http.Shared.projitems*{5017174e-dac5-4408-ab15-1f902f40c612}*SharedItemsImports = 4 - Polly.Extensions.Http.SharedSpecs\Polly.Extensions.Http.SharedSpecs.projitems*{8d537c37-a4a2-4be1-84bc-34f1afb51ca8}*SharedItemsImports = 13 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -40,14 +21,6 @@ Global {615C92EC-5921-40F4-A690-C66B1587C08E}.Debug|Any CPU.Build.0 = Debug|Any CPU {615C92EC-5921-40F4-A690-C66B1587C08E}.Release|Any CPU.ActiveCfg = Release|Any CPU {615C92EC-5921-40F4-A690-C66B1587C08E}.Release|Any CPU.Build.0 = Release|Any CPU - {D8108479-6F4B-45CB-9E49-D45D1DC18F10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D8108479-6F4B-45CB-9E49-D45D1DC18F10}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D8108479-6F4B-45CB-9E49-D45D1DC18F10}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D8108479-6F4B-45CB-9E49-D45D1DC18F10}.Release|Any CPU.Build.0 = Release|Any CPU - {435D99EB-3689-4EA0-96FE-2FA17930322D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {435D99EB-3689-4EA0-96FE-2FA17930322D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {435D99EB-3689-4EA0-96FE-2FA17930322D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {435D99EB-3689-4EA0-96FE-2FA17930322D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Polly.Extensions.Http.Shared/HttpPolicyExtensions.cs b/src/Polly.Extensions.Http/HttpPolicyExtensions.cs similarity index 100% rename from src/Polly.Extensions.Http.Shared/HttpPolicyExtensions.cs rename to src/Polly.Extensions.Http/HttpPolicyExtensions.cs diff --git a/src/Polly.Extensions.Http/Polly.Extensions.Http.csproj b/src/Polly.Extensions.Http/Polly.Extensions.Http.csproj new file mode 100644 index 0000000..7faa5e2 --- /dev/null +++ b/src/Polly.Extensions.Http/Polly.Extensions.Http.csproj @@ -0,0 +1,47 @@ + + + netstandard1.1;netstandard2.0 + Polly.Extensions.Http + Polly.Extensions.Http + 3.0.0 + 3.0.0.0 + 3.0.0.0 + 3.0.0.0 + 3.0.0 + App vNext + Copyright (c) 2019, App vNext + Polly.Extensions.Http is an extensions package containing opinionated convenience methods for configuring Polly policies to handle transient faults typical of calls through HttpClient. + en-US + true + true + App vNext + ..\Polly.snk + true + + + true + true + snupkg + + + + + + true + + + + + + 1.6.1 + + + en-US + Polly.Extensions.Http + BSD-3-Clause + https://raw.github.com/App-vNext/Polly/master/Polly.png + https://github.com/App-vNext/Polly.Extensions.Http + HttpClient HttpClientFactory Exception Handling Resilience Transient Fault Policy + See https://github.com/App-vNext/Polly.Extensions.Http/blob/master/CHANGELOG.md for details + +