Skip to content

Commit a9ab6ad

Browse files
authored
Merge pull request #114 from JSkimming/dotnet5-update
Added .NET 5 build targets
2 parents ecab4f4 + 8d32767 commit a9ab6ad

14 files changed

Lines changed: 111 additions & 52 deletions

File tree

.appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ assembly_info:
4646
#---------------------------------#
4747

4848
build_script:
49-
- dotnet pack -c %CONFIGURATION% --include-source /p:PackageVersion=%APPVEYOR_BUILD_VERSION%
49+
- dotnet pack -c %CONFIGURATION% /p:PackageVersion=%APPVEYOR_BUILD_VERSION%
5050

5151
#---------------------------------#
5252
# artifacts configuration #
5353
#---------------------------------#
5454

5555
artifacts:
5656
- path: src\**\*.nupkg
57+
- path: src\**\*.snupkg
5758
- path: TestResults_*.7z
5859
name: TestResults
5960

.azure-pipelines.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,36 @@ jobs:
1010
continueOnError: "true"
1111
timeoutInMinutes: 5
1212
variables:
13-
buildFramework: netcoreapp3.1
13+
buildFramework: net5.0
1414
strategy:
1515
matrix:
16-
"Linux 3.1 Debug":
17-
sdkVersion: 3.1.x
16+
"Linux 5.0 Debug":
17+
sdkVersion: 5.0.x
1818
config: Debug
1919
imageName: ubuntu-latest
2020
framework: $(buildFramework)
21-
"Linux 3.1 Release":
22-
sdkVersion: 3.1.x
21+
"Linux 5.0 Release":
22+
sdkVersion: 5.0.x
2323
config: Release
2424
imageName: ubuntu-latest
2525
framework: $(buildFramework)
26-
"MacOS 3.1 Debug":
27-
sdkVersion: 3.1.x
26+
"MacOS 5.0 Debug":
27+
sdkVersion: 5.0.x
2828
config: Debug
2929
imageName: macOS-latest
3030
framework: $(buildFramework)
31-
"MacOS 3.1 Release":
32-
sdkVersion: 3.1.x
31+
"MacOS 5.0 Release":
32+
sdkVersion: 5.0.x
3333
config: Release
3434
imageName: macOS-latest
3535
framework: $(buildFramework)
36-
"Windows 3.1 Debug":
37-
sdkVersion: 3.1.x
36+
"Windows 5.0 Debug":
37+
sdkVersion: 5.0.x
3838
config: Debug
3939
imageName: windows-latest
4040
framework: $(buildFramework)
41-
"Windows 3.1 Release":
42-
sdkVersion: 3.1.x
41+
"Windows 5.0 Release":
42+
sdkVersion: 5.0.x
4343
config: Release
4444
imageName: windows-latest
4545
framework: $(buildFramework)
@@ -48,7 +48,7 @@ jobs:
4848
steps:
4949

5050
- task: UseDotNet@2
51-
displayName: Install .NET Core SDK $(sdkVersion)
51+
displayName: Install .NET SDK $(sdkVersion)
5252
inputs:
5353
version: $(sdkVersion)
5454

@@ -70,7 +70,7 @@ jobs:
7070
codeCoverageTool: Cobertura
7171
summaryFileLocation: ./test/TestResults/output/coverage.$(framework).cobertura.xml
7272

73-
- task: BuildQualityChecks@6
73+
- task: BuildQualityChecks@7
7474
displayName: Check code coverage levels
7575
inputs:
7676
showStatistics: true

.circleci/config.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,23 @@ workflows:
6868
image-tag: "core/sdk:3.1-alpine"
6969
build-config: Release
7070
framework: netcoreapp3.1
71+
- build/run-build:
72+
name: 5.0 Debug Build
73+
image-tag: "sdk:5.0"
74+
build-config: Debug
75+
framework: net5.0
76+
- build/run-build:
77+
name: 5.0 Alpine Debug Build
78+
image-tag: "sdk:5.0-alpine"
79+
build-config: Debug
80+
framework: net5.0
81+
- build/run-build:
82+
name: 5.0 Release Build
83+
image-tag: "sdk:5.0"
84+
build-config: Release
85+
framework: net5.0
86+
- build/run-build:
87+
name: 5.0 Alpine Release Build
88+
image-tag: "sdk:5.0-alpine"
89+
build-config: Release
90+
framework: net5.0

.github/workflows/ci.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,26 @@ jobs:
2424
config:
2525
- Debug
2626
- Release
27-
dotnet:
28-
- 3.1.x
2927
framework:
3028
- netcoreapp3.1
31-
name: Test ${{ matrix.os }} ${{ matrix.dotnet }} ${{ matrix.config }}
29+
- net5.0
30+
name: Test ${{ matrix.os }} ${{ matrix.framework }} ${{ matrix.config }}
31+
3232
steps:
3333

34-
- uses: actions/checkout@v1
34+
- uses: actions/checkout@v2
35+
36+
- name: Setup .NET Core 3.1
37+
uses: actions/setup-dotnet@v1
38+
if: matrix.framework == 'netcoreapp3.1'
39+
with:
40+
dotnet-version: 3.1.x
3541

36-
- name: Setup .NET Core
42+
- name: Setup .NET 5.0
3743
uses: actions/setup-dotnet@v1
44+
if: matrix.framework == 'net5.0'
3845
with:
39-
dotnet-version: ${{ matrix.dotnet }}
46+
dotnet-version: 5.0.x
4047

4148
- name: Test Coverage
4249
run: ./coverage.sh ${{ matrix.framework }} ${{ matrix.config }}
@@ -47,15 +54,16 @@ jobs:
4754
strategy:
4855
matrix:
4956
framework:
50-
- netcoreapp3.1
57+
- net5.0
58+
5159
steps:
5260

53-
- uses: actions/checkout@v1
61+
- uses: actions/checkout@v2
5462

55-
- name: Setup .NET Core
63+
- name: Setup .NET 5.0
5664
uses: actions/setup-dotnet@v1
5765
with:
58-
dotnet-version: 3.1.x
66+
dotnet-version: 5.0.x
5967

6068
- name: Test Coverage
6169
run: ./coverage.sh ${{ matrix.framework }} Release

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ matrix:
77

88
include:
99
- os: linux
10-
dotnet: 3.1
10+
dotnet: 5.0
1111
mono: none
1212
- os: osx
13-
dotnet: 3.1.401
13+
dotnet: 5.0.101
1414
mono: none
1515

1616
branches:
1717
only:
1818
- master
1919

2020
script:
21-
- ./coverage.sh netcoreapp3.1 Release
21+
- ./coverage.sh net5.0 Release

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,21 @@ RUN dotnet restore
2424
COPY . .
2525

2626
RUN ./coverage.sh netcoreapp3.1 Debug
27+
28+
########################################################################################################################
29+
# .NET 5
30+
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine
31+
32+
WORKDIR /work
33+
34+
# Copy just the solution and proj files to make best use of docker image caching.
35+
COPY ./castle.core.asyncinterceptor.sln .
36+
COPY ./src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj ./src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj
37+
COPY ./test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj ./test/Castle.Core.AsyncInterceptor.Tests/Castle.Core.AsyncInterceptor.Tests.csproj
38+
39+
# Run restore on just the project files, this should cache the image after restore.
40+
RUN dotnet restore
41+
42+
COPY . .
43+
44+
RUN ./coverage.sh net5.0 Debug

src/Castle.Core.AsyncInterceptor/AsyncInterceptorBase.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Castle.DynamicProxy
2020
Justification = "Must propagate the same exceptions.")]
2121
public abstract class AsyncInterceptorBase : IAsyncInterceptor
2222
{
23-
#if !NETSTANDARD2_0
23+
#if !NETSTANDARD2_0 && !NET5_0
2424
/// <summary>
2525
/// A completed <see cref="Task"/>.
2626
/// </summary>
@@ -43,7 +43,7 @@ public abstract class AsyncInterceptorBase : IAsyncInterceptor
4343
/// Intercepts a synchronous method <paramref name="invocation"/>.
4444
/// </summary>
4545
/// <param name="invocation">The method invocation.</param>
46-
void IAsyncInterceptor.InterceptSynchronous(IInvocation invocation)
46+
public void InterceptSynchronous(IInvocation invocation)
4747
{
4848
Type returnType = invocation.Method.ReturnType;
4949
GenericSynchronousHandler handler = GenericSynchronousHandlers.GetOrAdd(returnType, CreateHandler);
@@ -54,7 +54,7 @@ void IAsyncInterceptor.InterceptSynchronous(IInvocation invocation)
5454
/// Intercepts an asynchronous method <paramref name="invocation"/> with return type of <see cref="Task"/>.
5555
/// </summary>
5656
/// <param name="invocation">The method invocation.</param>
57-
void IAsyncInterceptor.InterceptAsynchronous(IInvocation invocation)
57+
public void InterceptAsynchronous(IInvocation invocation)
5858
{
5959
invocation.ReturnValue = InterceptAsync(invocation, invocation.CaptureProceedInfo(), ProceedAsynchronous);
6060
}
@@ -64,7 +64,7 @@ void IAsyncInterceptor.InterceptAsynchronous(IInvocation invocation)
6464
/// </summary>
6565
/// <typeparam name="TResult">The type of the <see cref="Task{T}"/> <see cref="Task{T}.Result"/>.</typeparam>
6666
/// <param name="invocation">The method invocation.</param>
67-
void IAsyncInterceptor.InterceptAsynchronous<TResult>(IInvocation invocation)
67+
public void InterceptAsynchronous<TResult>(IInvocation invocation)
6868
{
6969
invocation.ReturnValue =
7070
InterceptAsync(invocation, invocation.CaptureProceedInfo(), ProceedAsynchronous<TResult>);
@@ -138,15 +138,15 @@ private static Task ProceedSynchronous(IInvocation invocation, IInvocationProcee
138138
try
139139
{
140140
proceedInfo.Invoke();
141-
#if NETSTANDARD2_0
141+
#if NETSTANDARD2_0 || NET5_0
142142
return Task.CompletedTask;
143143
#else
144144
return CompletedTask;
145145
#endif
146146
}
147147
catch (Exception e)
148148
{
149-
#if NETSTANDARD2_0
149+
#if NETSTANDARD2_0 || NET5_0
150150
return Task.FromException(e);
151151
#else
152152
var tcs = new TaskCompletionSource<int>();
@@ -167,7 +167,7 @@ private static Task<TResult> ProceedSynchronous<TResult>(
167167
}
168168
catch (Exception e)
169169
{
170-
#if NETSTANDARD2_0
170+
#if NETSTANDARD2_0 || NET5_0
171171
return Task.FromException<TResult>(e);
172172
#else
173173
var tcs = new TaskCompletionSource<TResult>();
@@ -177,6 +177,7 @@ private static Task<TResult> ProceedSynchronous<TResult>(
177177
}
178178
}
179179

180+
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "The name explicitly says Asynchronous.")]
180181
private static async Task ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
181182
{
182183
proceedInfo.Invoke();
@@ -187,6 +188,7 @@ private static async Task ProceedAsynchronous(IInvocation invocation, IInvocatio
187188
await originalReturnValue.ConfigureAwait(false);
188189
}
189190

191+
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "The name explicitly says Asynchronous.")]
190192
private static async Task<TResult> ProceedAsynchronous<TResult>(
191193
IInvocation invocation,
192194
IInvocationProceedInfo proceedInfo)

src/Castle.Core.AsyncInterceptor/AsyncTimingInterceptor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ protected sealed override Stopwatch StartingInvocation(IInvocation invocation)
2626
}
2727

2828
/// <summary>
29-
/// Signals <see cref="CompletedTiming"/> after stopping a <paramref name="stopwatch"/> to time the method
29+
/// Signals <see cref="CompletedTiming"/> after stopping a <see cref="Stopwatch"/> to time the method
3030
/// <paramref name="invocation"/>.
3131
/// </summary>
3232
/// <param name="invocation">The method invocation.</param>
33-
/// <param name="stopwatch">The <see cref="Stopwatch"/> returned by <see cref="StartingInvocation"/> to time
33+
/// <param name="state">The <see cref="Stopwatch"/> returned by <see cref="StartingInvocation"/> to time
3434
/// the method <paramref name="invocation"/>.</param>
35-
protected sealed override void CompletedInvocation(IInvocation invocation, Stopwatch stopwatch)
35+
protected sealed override void CompletedInvocation(IInvocation invocation, Stopwatch state)
3636
{
37-
stopwatch.Stop();
38-
CompletedTiming(invocation, stopwatch);
37+
state.Stop();
38+
CompletedTiming(invocation, state);
3939
}
4040

4141
/// <summary>

src/Castle.Core.AsyncInterceptor/Castle.Core.AsyncInterceptor.csproj

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net45;netstandard2.0;net5.0</TargetFrameworks>
55
<RootNamespace>Castle.DynamicProxy</RootNamespace>
66
<LangVersion>latest</LangVersion>
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
<Nullable>enable</Nullable>
10+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
1011
<CodeAnalysisRuleSet>..\stylecop.ruleset</CodeAnalysisRuleSet>
1112
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1213
<Authors>James Skimming</Authors>
@@ -15,9 +16,14 @@
1516
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1617
<PackageProjectUrl>https://github.com/JSkimming/Castle.Core.AsyncInterceptor</PackageProjectUrl>
1718
<PackageIcon>castle-logo.png</PackageIcon>
19+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
20+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1821
<RepositoryUrl>https://github.com/JSkimming/Castle.Core.AsyncInterceptor</RepositoryUrl>
1922
<RepositoryType>git</RepositoryType>
23+
<IncludeSymbols>true</IncludeSymbols>
24+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2025
<PackageTags>async asynchronous-methods castle castle-core dynamic dynamicproxy dynamic-proxy dynamicproxy2 intercept-methods proxy</PackageTags>
26+
<ContinuousIntegrationBuild Condition=" '$(CI)' == 'true' ">true</ContinuousIntegrationBuild>
2127
</PropertyGroup>
2228

2329
<!-- Strong name signing -->
@@ -28,20 +34,16 @@
2834
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
2935
</PropertyGroup>
3036

31-
<!--
32-
Force the net45 build to generate non Portable PDB until such time that OpenCover supports Portable PDBs
33-
https://github.com/OpenCover/opencover/issues/610
34-
-->
35-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
36-
<DebugType>pdbonly</DebugType>
37-
</PropertyGroup>
38-
3937
<ItemGroup>
4038
<PackageReference Include="Castle.Core" Version="4.4.0" />
4139
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.1">
4240
<PrivateAssets>all</PrivateAssets>
4341
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4442
</PackageReference>
43+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
44+
<PrivateAssets>all</PrivateAssets>
45+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
46+
</PackageReference>
4547
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.304">
4648
<PrivateAssets>all</PrivateAssets>
4749
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/Castle.Core.AsyncInterceptor/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2016-2020 James Skimming. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33

4+
using System;
45
using System.Reflection;
56
using System.Runtime.InteropServices;
67

@@ -20,6 +21,7 @@
2021
[assembly: AssemblyCopyright("Copyright © 2016-2020 James Skimming")]
2122
[assembly: AssemblyTrademark("")]
2223
[assembly: AssemblyCulture("")]
24+
[assembly: CLSCompliant(true)]
2325

2426
// Setting ComVisible to false makes the types in this assembly not visible
2527
// to COM components. If you need to access a type in this assembly from

0 commit comments

Comments
 (0)