Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Polly.Core #1053

Merged
merged 7 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true

[*]

indent_size = 4
indent_style = space
tab_width = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{appxmanifest,axml,build,config,csproj,dbml,discomap,dtd,json,jsproj,lsproj,njsproj,nuspec,proj,props,resjson,resw,resx,StyleCop,targets,props,tasks,vbproj,yml,xml,xsd}]
indent_style = space
indent_size = 2
tab_width = 2

# C# files
[*.cs]

# Put any C# specific settings here
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- uses: codecov/codecov-action@v3
name: Upload coverage to Codecov
with:
file: ./src/Polly.Specs/coverage-reports/Cobertura.xml
files: ./src/Polly.Specs/coverage-reports/Cobertura.xml,./src/Polly.Core.Tests/coverage-reports/Cobertura.xml
flags: ${{ matrix.os_name }}

- name: Publish NuGet packages
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,5 @@ tools
coverage.*.cobertura.xml
coverage.*.json
coverage-reports/

!eng/**
9 changes: 9 additions & 0 deletions Version.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<Version>7.3.0</Version>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<FileVersion>7.3.0.0</FileVersion>
<InformationalVersion>7.3.0.0</InformationalVersion>
<PackageVersion>7.3.0</PackageVersion>
</PropertyGroup>
</Project>
20 changes: 11 additions & 9 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,11 @@ Task("__RunTests")
loggers = new[] { "GitHubActions;report-warnings=false" };
}

foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj"))
var projects = GetFiles("./src/**/*.Specs.csproj").Concat(GetFiles("./src/**/*.Tests.csproj"));

foreach(var proj in projects)
{
DotNetTest(specsProj.FullPath, new DotNetTestSettings
DotNetTest(proj.FullPath, new DotNetTestSettings
{
Configuration = configuration,
Loggers = loggers,
Expand All @@ -204,13 +206,9 @@ Task("__RunTests")
}
});

Task("__CreateSignedNuGetPackage")
Task("__CreateSignedNuGetPackages")
.Does(() =>
{
var packageName = projectName;

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

var dotNetPackSettings = new DotNetPackSettings
{
Configuration = configuration,
Expand All @@ -225,7 +223,11 @@ Task("__CreateSignedNuGetPackage")
},
};

DotNetPack(System.IO.Path.Combine(srcDir, projectName, projectName + ".csproj"), dotNetPackSettings);
Information("Building Polly.{0}.nupkg", nugetVersion);
DotNetPack(System.IO.Path.Combine(srcDir, "Polly", "Polly.csproj"), dotNetPackSettings);

Information("Building Polly.Core.{0}.nupkg", nugetVersion);
DotNetPack(System.IO.Path.Combine(srcDir, "Polly.Core", "Polly.Core.csproj"), dotNetPackSettings);
});

//////////////////////////////////////////////////////////////////////
Expand All @@ -238,7 +240,7 @@ Task("Build")
.IsDependentOn("__UpdateAssemblyVersionInformation")
.IsDependentOn("__BuildSolutions")
.IsDependentOn("__RunTests")
.IsDependentOn("__CreateSignedNuGetPackage");
.IsDependentOn("__CreateSignedNuGetPackages");

///////////////////////////////////////////////////////////////////////////////
// PRIMARY TARGETS
Expand Down
20 changes: 20 additions & 0 deletions eng/Analyzers.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<ItemGroup Label="Analyzers" Condition="$(UseDefaultAnalyzers) == 'true'">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.51.0.59060" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<AdditionalFiles Include="$(MsBuildThisFileDirectory)analyzers\Stylecop.json" Visible="false" />
<EditorConfigFiles Include="$(MsBuildThisFileDirectory)analyzers\Stylecop.globalconfig" />
<EditorConfigFiles Include="$(MsBuildThisFileDirectory)analyzers\$(ProjectType).globalconfig" />
</ItemGroup>

<PropertyGroup>
<RunAnalyzers>true</RunAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>latest</AnalysisLevel>
</PropertyGroup>
</Project>
16 changes: 16 additions & 0 deletions eng/Common.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\Polly.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<RootDir>$(MSBuildThisFileDirectory)..\</RootDir>
<ContinuousIntegrationBuild Condition=" '$(CI)' != '' ">true</ContinuousIntegrationBuild>
</PropertyGroup>

<Import Project="$(MsBuildThisFileDirectory)Analyzers.targets" />

<ItemGroup>
<None Include="$(MsBuildThisFileDirectory)..\Polly.png" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions eng/Library.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project>
<Import Project="..\Version.props" />

<PropertyGroup>
<Company>App vNext</Company>
<Copyright>Copyright (c) $([System.DateTime]::Now.ToString(yyyy)), App vNext</Copyright>
<DefaultLanguage>en-US</DefaultLanguage>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>Michael Wolfenden, App vNext</Authors>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<EmbedUntrackedSources>true</EmbedUntrackedSources> <!-- EmbedUntrackedSources for deterministic build -->
<PollyPublicKeySuffix>, PublicKey=0024000004800000940000000602000000240000525341310004000001000100150819e3494f97263a3abdd18e5e0c47b04e6c0ede44a6c51d50b545d403ceeb7cbb32d18dbbbcdd1d88a87d7b73206b126be134b0609c36aa3cb31dd2e47e393293102809b8d77f192f3188618a42e651c14ebf05f8f5b76aa91b431642b23497ed82b65d63791cdaa31d4282a2d6cbabc3fe0745b6b6690c417cabf6a1349c</PollyPublicKeySuffix>
</PropertyGroup>

<PropertyGroup Label="SourceLink">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup Label="SourceLink">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup Label="SharedNuspecProperties">
<PackageIcon>Polly.png</PackageIcon>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/App-vNext/Polly</PackageProjectUrl>
<PackageTags>Exception Handling Resilience Transient Fault Policy Circuit Breaker CircuitBreaker Retry Wait Cache Cache-aside Bulkhead Rate-limit Fallback Timeout Throttle Parallelization</PackageTags>
<PackageReleaseNotes>See https://github.com/App-vNext/Polly/blob/master/CHANGELOG.md for details</PackageReleaseNotes>
</PropertyGroup>

<Target Name="AddInternalsVisibleToTest" BeforeTargets="BeforeCompile">
<ItemGroup>
<InternalsVisibleTo Include="%(InternalsVisibleToTest.Identity)$(PollyPublicKeySuffix)" />
</ItemGroup>
</Target>
</Project>
39 changes: 39 additions & 0 deletions eng/Test.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project>
<PropertyGroup>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.2.0" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="ReportGenerator" Version="5.1.19" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) != '.NETFramework'">
<CollectCoverage>true</CollectCoverage>
<CoverletOutputFormat>cobertura</CoverletOutputFormat>
<Exclude>[xunit.*]*</Exclude>
<ExcludeByAttribute>System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
</PropertyGroup>

<PropertyGroup Condition=" '$(CollectCoverage)' == 'true' ">
<ReportGeneratorOutputMarkdown Condition=" '$(ReportGeneratorOutputMarkdown)' == '' AND '$(GITHUB_SHA)' != '' ">true</ReportGeneratorOutputMarkdown>
<ReportGeneratorReportTypes>HTML</ReportGeneratorReportTypes>
<ReportGeneratorReportTypes Condition=" '$(ReportGeneratorOutputMarkdown)' == 'true' ">$(ReportGeneratorReportTypes);MarkdownSummaryGitHub</ReportGeneratorReportTypes>
<ReportGeneratorTargetDirectory>$([System.IO.Path]::Combine($(OutputPath), 'coverage-reports'))</ReportGeneratorTargetDirectory>
<_MarkdownSummaryPrefix>&lt;details&gt;&lt;summary&gt;:chart_with_upwards_trend: &lt;b&gt;$(AssemblyName) Code Coverage report&lt;/b&gt; %28$(TargetFramework)%29&lt;/summary&gt;</_MarkdownSummaryPrefix>
<_MarkdownSummarySuffix>&lt;/details&gt;</_MarkdownSummarySuffix>
</PropertyGroup>

<Target Name="GenerateCoverageReports" AfterTargets="GenerateCoverageResultAfterTest" Condition=" '$(CollectCoverage)' == 'true' ">
<ReportGenerator ReportFiles="@(CoverletReport)" ReportTypes="$(ReportGeneratorReportTypes)" Tag="$(TargetFramework)" TargetDirectory="$(ReportGeneratorTargetDirectory)" Title="$(AssemblyName)" VerbosityLevel="Warning" />
<Exec Condition=" '$(ReportGeneratorOutputMarkdown)' == 'true' " Command="pwsh -Command %22('$(_MarkdownSummaryPrefix)' + [System.Environment]::NewLine + [System.Environment]::NewLine + (Get-Content $([System.IO.Path]::Combine($(ReportGeneratorTargetDirectory), 'SummaryGithub.md')) | Out-String) + [System.Environment]::NewLine + [System.Environment]::NewLine + '$(_MarkdownSummarySuffix)') >> $(GITHUB_STEP_SUMMARY)%22" />
</Target>
</Project>
Loading