Skip to content

Commit 5d15310

Browse files
committed
Refactoring, renaming, switch to GitHub actions.
1 parent cd5d98f commit 5d15310

File tree

234 files changed

+1274
-1734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+1274
-1734
lines changed

.github/workflows/build-test.yaml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
types: [assigned, opened, synchronize, reopened]
13+
14+
env:
15+
BUILD_CONFIGURATION: Debug
16+
17+
jobs:
18+
build:
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest, windows-latest, macOS-latest]
23+
name: .NET Build
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
- name: Setup .NET
29+
uses: actions/setup-dotnet@v3
30+
with:
31+
dotnet-version: |
32+
8.0.x
33+
- name: Restore
34+
run: dotnet restore
35+
- name: Build
36+
run: dotnet build --configuration ${{env.BUILD_CONFIGURATION}} --no-restore
37+
- name: Test
38+
run: dotnet test --configuration ${{env.BUILD_CONFIGURATION}} --collect:"Code Coverage;Format=Cobertura" --logger trx --results-directory test-results --no-build
39+
- name: Build packages
40+
run: dotnet pack --configuration ${{env.BUILD_CONFIGURATION}} --output ./artifacts --no-build
41+
# - name: Upload coverage to Codecov
42+
# uses: codecov/codecov-action@v3
43+
# with:
44+
# directory: ./test-results
45+
# files: '*.cobertura.xml'
46+
#
47+
- name: Upload artifacts
48+
if: matrix.os == 'ubuntu-latest'
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: artifacts
52+
path: ./artifacts
53+
- name: Upload test results
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: test-results-${{ matrix.os }}
57+
path: ./test-results
58+
if: ${{ always() }} # Always run this step even on failure
59+
60+
deploy-testing:
61+
if: github.event_name == 'push'
62+
runs-on: ubuntu-latest
63+
environment: testing
64+
needs: build
65+
name: Deploy Testing
66+
steps:
67+
- name: Setup .NET
68+
uses: actions/setup-dotnet@v3
69+
with:
70+
dotnet-version: |
71+
8.0.x
72+
- name: Download artifacts
73+
uses: actions/download-artifact@v3
74+
with:
75+
name: artifacts
76+
path: ./artifacts
77+
- name: Push packages
78+
run: dotnet nuget push -s ${{vars.MYGET_URL}} -k ${{secrets.MYGET_API_KEY}} ./artifacts/*.nupkg
79+
80+
deploy-release:
81+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
82+
runs-on: ubuntu-latest
83+
environment: production
84+
needs:
85+
- build
86+
- deploy-testing
87+
name: Deploy Production
88+
steps:
89+
- name: Setup .NET
90+
uses: actions/setup-dotnet@v3
91+
with:
92+
dotnet-version: |
93+
8.0.x
94+
- name: Download artifacts
95+
uses: actions/download-artifact@v3
96+
with:
97+
name: artifacts
98+
path: ./artifacts
99+
- name: Push packages
100+
run: dotnet nuget push -s ${{vars.NUGET_URL}} -k ${{secrets.NUGET_API_KEY}} ./artifacts/*.nupkg

AppCore.Extensions.sln

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,35 @@ EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.DependencyInjection.DependencyModelExtensions", "DependencyInjection\src\AppCore.Extensions.DependencyInjection.DependencyModelExtensions\AppCore.Extensions.DependencyInjection.DependencyModelExtensions.csproj", "{2D04A8E5-C7AE-4403-AF7B-2853E3EB827C}"
1111
EndProject
1212
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DependencyInjection", "DependencyInjection", "{EB91A313-F884-4256-90A2-070A0C41EEF7}"
13+
ProjectSection(SolutionItems) = preProject
14+
DependencyInjection\Directory.Build.props = DependencyInjection\Directory.Build.props
15+
DependencyInjection\README.md = DependencyInjection\README.md
16+
EndProjectSection
1317
EndProject
1418
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.DependencyInjection.Tests", "DependencyInjection\test\AppCore.Extensions.DependencyInjection.Tests\AppCore.Extensions.DependencyInjection.Tests.csproj", "{87F9A082-B75B-4190-B685-250CBC0C1E67}"
1519
EndProject
1620
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.DependencyInjection.AssemblyExtensions.Tests", "DependencyInjection\test\AppCore.Extensions.DependencyInjection.AssemblyExtensions.Tests\AppCore.Extensions.DependencyInjection.AssemblyExtensions.Tests.csproj", "{DBF6B4B6-8532-45E0-8FDF-266CB961EA41}"
1721
EndProject
1822
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{93CFDB2F-A8BD-4A9D-9024-A3C953C340A2}"
23+
ProjectSection(SolutionItems) = preProject
24+
DependencyInjection\src\Directory.Build.props = DependencyInjection\src\Directory.Build.props
25+
EndProjectSection
1926
EndProject
2027
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7149D82E-B79A-400B-902B-F63AA1AE1F1F}"
28+
ProjectSection(SolutionItems) = preProject
29+
DependencyInjection\test\Directory.Build.props = DependencyInjection\test\Directory.Build.props
30+
EndProjectSection
2131
EndProject
2232
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosting", "Hosting", "{EDABA206-A09A-4DF8-8D8C-36FFDE265243}"
33+
ProjectSection(SolutionItems) = preProject
34+
Hosting\Directory.Build.props = Hosting\Directory.Build.props
35+
Hosting\README.md = Hosting\README.md
36+
EndProjectSection
2337
EndProject
2438
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D6508E9B-7A1A-40CD-A5AA-CF21D6FFEB9E}"
39+
ProjectSection(SolutionItems) = preProject
40+
Hosting\src\Directory.Build.props = Hosting\src\Directory.Build.props
41+
EndProjectSection
2542
EndProject
2643
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.Hosting.Abstractions", "Hosting\src\AppCore.Extensions.Hosting.Abstractions\AppCore.Extensions.Hosting.Abstractions.csproj", "{FADEC3EC-C66B-44CA-9B94-4B8E13D6D2C1}"
2744
EndProject
@@ -34,6 +51,9 @@ EndProject
3451
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.Hosting.Plugins.AspNetCore.Mvc", "Hosting\src\AppCore.Extensions.Hosting.Plugins.AspNetCore.Mvc\AppCore.Extensions.Hosting.Plugins.AspNetCore.Mvc.csproj", "{FAC58053-1E7A-487C-8256-6784427A61A4}"
3552
EndProject
3653
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E2C71AB4-DF09-4961-82EC-916A08650A86}"
54+
ProjectSection(SolutionItems) = preProject
55+
Hosting\test\Directory.Build.props = Hosting\test\Directory.Build.props
56+
EndProjectSection
3757
EndProject
3858
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.Hosting.Tests", "Hosting\test\AppCore.Extensions.Hosting.Tests\AppCore.Extensions.Hosting.Tests.csproj", "{8F032CE3-007E-46BC-B913-1884FA3583FE}"
3959
EndProject
@@ -46,11 +66,18 @@ EndProject
4666
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Http", "Http", "{9416DF99-18D3-4373-A517-00A65E7CC32A}"
4767
ProjectSection(SolutionItems) = preProject
4868
Http\README.md = Http\README.md
69+
Http\Directory.Build.props = Http\Directory.Build.props
4970
EndProjectSection
5071
EndProject
5172
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B2F9DC67-6D7B-4070-8580-F401050445A9}"
73+
ProjectSection(SolutionItems) = preProject
74+
Http\src\Directory.Build.props = Http\src\Directory.Build.props
75+
EndProjectSection
5276
EndProject
5377
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A038B60C-C6C4-4487-A0CC-1591E3D48601}"
78+
ProjectSection(SolutionItems) = preProject
79+
Http\test\Directory.Build.props = Http\test\Directory.Build.props
80+
EndProjectSection
5481
EndProject
5582
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.Http.Authentication", "Http\src\AppCore.Extensions.Http.Authentication\AppCore.Extensions.Http.Authentication.csproj", "{D6108CCC-CFD4-40A0-BD5C-B6F0ADFB5E5C}"
5683
EndProject
@@ -68,6 +95,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppCore.Extensions.Http.Aut
6895
EndProject
6996
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "Http\samples\Web\Web.csproj", "{7D72ABA6-5EBE-491A-A599-65D15FD10308}"
7097
EndProject
98+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{84A72356-33A9-4B80-B96D-436429E1D181}"
99+
ProjectSection(SolutionItems) = preProject
100+
.editorconfig = .editorconfig
101+
.gitignore = .gitignore
102+
AppCoreNet.ruleset = AppCoreNet.ruleset
103+
CONTRIBUTING.md = CONTRIBUTING.md
104+
Directory.Build.props = Directory.Build.props
105+
GitVersion.yml = GitVersion.yml
106+
global.json = global.json
107+
LICENSE = LICENSE
108+
README.md = README.md
109+
stylecop.json = stylecop.json
110+
EndProjectSection
111+
EndProject
71112
Global
72113
GlobalSection(SolutionConfigurationPlatforms) = preSolution
73114
Debug|Any CPU = Debug|Any CPU

AppCoreNet.ruleset

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RuleSet Name="AppCoreNet" ToolsVersion="10.0">
3+
<!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers/tree/master/documentation -->
4+
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
5+
6+
<!-- Do not warn if no documentation is built -->
7+
<Rule Id="SA0001" Action="None" />
8+
9+
<!-- Closing square bracket should be followed by a space doesnt work with nullable arrays -->
10+
<Rule Id="SA1011" Action="None"/>
11+
12+
<!-- Local calls do not need 'this' -->
13+
<Rule Id="SA1101" Action="None" />
14+
15+
<!-- Allow properties before constructor -->
16+
<Rule Id="SA1201" Action="None"/>
17+
18+
<!-- Require underscore for field prefixes -->
19+
<Rule Id="SA1309" Action="None" />
20+
<Rule Id="SX1309" Action="Error" />
21+
22+
<!-- No braces for single-line statements -->
23+
<Rule Id="SA1503" Action="None" />
24+
25+
<!-- Members should be documented -->
26+
<Rule Id="SA1600" Action="Info"/>
27+
<Rule Id="SA1633" Action="Info"/>
28+
</Rules>
29+
</RuleSet>

DependencyInjection/src/AppCore.Extensions.DependencyInjection.Abstractions/Activator/ActivatorExtensions.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Licensed under the MIT License.
2-
// Copyright (c) 2018-2021 the AppCore .NET project.
1+
// Licensed under the MIT license.
2+
// Copyright (c) The AppCore .NET project.
33

44
using System;
5-
using AppCore.Diagnostics;
5+
using AppCoreNet.Diagnostics;
66

77
namespace AppCore.Extensions.DependencyInjection.Activator;
88

@@ -17,10 +17,11 @@ public static class ActivatorExtensions
1717
/// <typeparam name="T">The type to activate.</typeparam>
1818
/// <param name="activator">The <see cref="IActivator"/>.</param>
1919
/// <param name="parameters">Constructor arguments not provided by the <see cref="IServiceProvider"/>.</param>
20-
/// <returns>An activated object of type instanceType</returns>
20+
/// <returns>An activated object of type <typeparamref name="T"/>.</returns>
21+
/// <exception cref="ArgumentNullException">Argument <paramref name="activator"/> is null.</exception>
2122
public static T CreateInstance<T>(this IActivator activator, params object[] parameters)
2223
{
2324
Ensure.Arg.NotNull(activator);
24-
return (T) activator.CreateInstance(typeof(T), parameters);
25+
return (T)activator.CreateInstance(typeof(T), parameters);
2526
}
2627
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Licensed under the MIT License.
2-
// Copyright (c) 2018-2021 the AppCore .NET project.
1+
// Licensed under the MIT license.
2+
// Copyright (c) The AppCore .NET project.
33

44
using System;
5-
using AppCore.Diagnostics;
5+
using AppCoreNet.Diagnostics;
66

77
namespace AppCore.Extensions.DependencyInjection.Activator;
88

@@ -14,12 +14,12 @@ public sealed class DefaultActivator : IActivator
1414
/// <summary>
1515
/// Gets the static instance of the <see cref="DefaultActivator"/>.
1616
/// </summary>
17-
public static DefaultActivator Instance { get; } = new();
17+
public static DefaultActivator Instance { get; } = new ();
1818

1919
/// <inheritdoc />
2020
public object CreateInstance(Type instanceType, params object[] parameters)
2121
{
2222
Ensure.Arg.NotNull(instanceType);
23-
return System.Activator.CreateInstance(instanceType, parameters);
23+
return System.Activator.CreateInstance(instanceType, parameters ?? Array.Empty<object>());
2424
}
2525
}

DependencyInjection/src/AppCore.Extensions.DependencyInjection.Abstractions/Activator/IActivator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Licensed under the MIT License.
2-
// Copyright (c) 2018-2021 the AppCore .NET project.
1+
// Licensed under the MIT license.
2+
// Copyright (c) The AppCore .NET project.
33

44
using System;
55

@@ -15,6 +15,7 @@ public interface IActivator
1515
/// </summary>
1616
/// <param name="instanceType">The type to activate.</param>
1717
/// <param name="parameters">Constructor arguments not provided by the <see cref="IServiceProvider"/>.</param>
18-
/// <returns>An activated object of type instanceType</returns>
18+
/// <returns>An activated object of type <paramref name="instanceType"/>.</returns>
19+
/// <exception cref="ArgumentNullException">Argument <paramref name="instanceType"/> is null.</exception>
1920
object CreateInstance(Type instanceType, params object[] parameters);
2021
}

DependencyInjection/src/AppCore.Extensions.DependencyInjection.Abstractions/Activator/ServiceProviderActivator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Licensed under the MIT License.
2-
// Copyright (c) 2018-2021 the AppCore .NET project.
1+
// Licensed under the MIT license.
2+
// Copyright (c) The AppCore .NET project.
33

44
using System;
5-
using AppCore.Diagnostics;
5+
using AppCoreNet.Diagnostics;
66
using Microsoft.Extensions.DependencyInjection;
77

88
namespace AppCore.Extensions.DependencyInjection.Activator;
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
5-
<RootNamespace>AppCore.Extensions.DependencyInjection</RootNamespace>
4+
<TargetFrameworks>net8.0;net6.0;netstandard2.0;net462</TargetFrameworks>
5+
<RootNamespace>AppCoreNet.Extensions.DependencyInjection</RootNamespace>
66
<Description>Provides extensions to the Microsoft.Extensions.DependencyInjection framework.</Description>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="AppCore.Diagnostics.Sources" Version="$(AppCore_Shared_Version)">
10+
<PackageReference Include="AppCoreNet.TypeHelpers.Sources" Version="0.5.0">
1111
<PrivateAssets>all</PrivateAssets>
1212
</PackageReference>
13-
<PackageReference Include="AppCore.TypeHelpers.Sources" Version="$(AppCore_Shared_Version)">
14-
<PrivateAssets>all</PrivateAssets>
15-
</PackageReference>
16-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_Extensions_Version)" />
13+
</ItemGroup>
14+
15+
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
16+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
17+
</ItemGroup>
18+
19+
<ItemGroup Condition="'$(TargetFramework)'!='net8.0'">
20+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
21+
</ItemGroup>
22+
23+
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
24+
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
1725
</ItemGroup>
1826

1927
</Project>

DependencyInjection/src/AppCore.Extensions.DependencyInjection.Abstractions/AppCoreBuilder.cs

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

DependencyInjection/src/AppCore.Extensions.DependencyInjection.Abstractions/AppCoreServiceCollectionExtensions.cs

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

0 commit comments

Comments
 (0)