Skip to content

Commit c51a543

Browse files
authored
Merge pull request #1 from pfpack/feature/create-first-version
Feature/create first version
2 parents 8c8e220 + 91e58d9 commit c51a543

File tree

70 files changed

+3270
-0
lines changed

Some content is hidden

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

70 files changed

+3270
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: .NET
2+
3+
on:
4+
push:
5+
branches: [ main, dev, feature/*, fix/*, release/* ]
6+
7+
pull_request:
8+
branches: [ main ]
9+
10+
release:
11+
types: [ published ]
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: |
26+
8.0.x
27+
9.0.x
28+
29+
# Create Local NuGet Source
30+
31+
- name: Create Local NuGet Directory
32+
run: mkdir ~/nuget
33+
34+
- name: Add Local Nuget Source
35+
run: dotnet nuget add source ~/nuget
36+
37+
# Endpoint.Contract
38+
39+
- name: Restore Endpoint.Contract
40+
run: dotnet restore ./src/*/*/Endpoint.Contract.csproj
41+
42+
- name: Build Endpoint.Contract
43+
run: dotnet build ./src/*/*/Endpoint.Contract.csproj --no-restore -c Release
44+
45+
- name: Pack Endpoint.Contract
46+
run: dotnet pack ./src/*/*/Endpoint.Contract.csproj --no-restore -o ~/nuget -c Release
47+
48+
# Endpoint.Core.Generator
49+
50+
- name: Restore Endpoint.Core.Generator
51+
run: dotnet restore ./src/*/*/Endpoint.Core.Generator.csproj
52+
53+
- name: Build Endpoint.Core.Generator
54+
run: dotnet build ./src/*/*/Endpoint.Core.Generator.csproj --no-restore -c Release
55+
56+
- name: Pack Endpoint.Core.Generator
57+
run: dotnet pack ./src/*/*/Endpoint.Core.Generator.csproj --no-restore -o ~/nuget -c Release
58+
59+
# Endpoint.Core
60+
61+
- name: Restore Endpoint.Core
62+
run: dotnet restore ./src/*/*/Endpoint.Core.csproj
63+
64+
- name: Build Endpoint.Core
65+
run: dotnet build ./src/*/*/Endpoint.Core.csproj --no-restore -c Release
66+
67+
- name: Pack Endpoint.Core
68+
run: dotnet pack ./src/*/*/Endpoint.Core.csproj --no-restore -o ~/nuget -c Release
69+
70+
# Endpoint.AspNetCore.Generator
71+
72+
- name: Restore Endpoint.AspNetCore.Generator
73+
run: dotnet restore ./src/*/*/Endpoint.AspNetCore.Generator.csproj
74+
75+
- name: Build Endpoint.AspNetCore.Generator
76+
run: dotnet build ./src/*/*/Endpoint.AspNetCore.Generator.csproj --no-restore -c Release
77+
78+
- name: Pack Endpoint.AspNetCore.Generator
79+
run: dotnet pack ./src/*/*/Endpoint.AspNetCore.Generator.csproj --no-restore -o ~/nuget -c Release
80+
81+
# Endpoint.AspNetCore
82+
83+
- name: Restore Endpoint.AspNetCore
84+
run: dotnet restore ./src/*/*/Endpoint.AspNetCore.csproj
85+
86+
- name: Build Endpoint.AspNetCore
87+
run: dotnet build ./src/*/*/Endpoint.AspNetCore.csproj --no-restore -c Release
88+
89+
- name: Pack Endpoint.AspNetCore
90+
run: dotnet pack ./src/*/*/Endpoint.AspNetCore.csproj --no-restore -o ~/nuget -c Release
91+
92+
# Push
93+
94+
- name: Push Packages
95+
if: ${{ github.event_name == 'release' }}
96+
run: >
97+
dotnet nuget push "../../../nuget/*.nupkg"
98+
-s https://api.nuget.org/v3/index.json
99+
-k ${{ secrets.NuGetSourcePassword }}
100+
--skip-duplicate

Infra.Endpoint.sln

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.002.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "endpoint-core", "endpoint-core", "{78492F40-D9D4-4A26-ACC7-5FD85D6CCE2F}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Endpoint.Core", "src\endpoint-core\Endpoint.Core\Endpoint.Core.csproj", "{89AA991A-C9F5-4DC5-BD0C-B46441285215}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Endpoint.Core.Generator", "src\endpoint-core\Endpoint.Core.Generator\Endpoint.Core.Generator.csproj", "{272C2E9B-0C81-46BD-B144-8DA5D9053B7C}"
11+
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "endpoint-contract", "endpoint-contract", "{52F18F9E-6352-4FF8-AAE6-700D5DD4CAFF}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Endpoint.Contract", "src\endpoint-contract\Endpoint.Contract\Endpoint.Contract.csproj", "{C2CEC949-38A8-4726-A673-87D787DB36F6}"
15+
EndProject
16+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "endpoint-aspnetcore", "endpoint-aspnetcore", "{22154E77-BF7D-4B6B-B7F3-D538EB9E6ED5}"
17+
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Endpoint.AspNetCore", "src\endpoint-aspnetcore\Endpoint.AspNetCore\Endpoint.AspNetCore.csproj", "{9DB43A25-82F0-426F-AC8D-F1B565485E70}"
19+
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Endpoint.AspNetCore.Generator", "src\endpoint-aspnetcore\Endpoint.AspNetCore.Generator\Endpoint.AspNetCore.Generator.csproj", "{B1321449-1AD7-4BB4-8A5F-5E0835CAA259}"
21+
EndProject
22+
Global
23+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
24+
Debug|Any CPU = Debug|Any CPU
25+
Release|Any CPU = Release|Any CPU
26+
EndGlobalSection
27+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
28+
{89AA991A-C9F5-4DC5-BD0C-B46441285215}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{89AA991A-C9F5-4DC5-BD0C-B46441285215}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{89AA991A-C9F5-4DC5-BD0C-B46441285215}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{89AA991A-C9F5-4DC5-BD0C-B46441285215}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{272C2E9B-0C81-46BD-B144-8DA5D9053B7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{272C2E9B-0C81-46BD-B144-8DA5D9053B7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{272C2E9B-0C81-46BD-B144-8DA5D9053B7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{272C2E9B-0C81-46BD-B144-8DA5D9053B7C}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{C2CEC949-38A8-4726-A673-87D787DB36F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{C2CEC949-38A8-4726-A673-87D787DB36F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{C2CEC949-38A8-4726-A673-87D787DB36F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{C2CEC949-38A8-4726-A673-87D787DB36F6}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{9DB43A25-82F0-426F-AC8D-F1B565485E70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{9DB43A25-82F0-426F-AC8D-F1B565485E70}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{9DB43A25-82F0-426F-AC8D-F1B565485E70}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{9DB43A25-82F0-426F-AC8D-F1B565485E70}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{B1321449-1AD7-4BB4-8A5F-5E0835CAA259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45+
{B1321449-1AD7-4BB4-8A5F-5E0835CAA259}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{B1321449-1AD7-4BB4-8A5F-5E0835CAA259}.Release|Any CPU.ActiveCfg = Release|Any CPU
47+
{B1321449-1AD7-4BB4-8A5F-5E0835CAA259}.Release|Any CPU.Build.0 = Release|Any CPU
48+
EndGlobalSection
49+
GlobalSection(SolutionProperties) = preSolution
50+
HideSolutionNode = FALSE
51+
EndGlobalSection
52+
GlobalSection(NestedProjects) = preSolution
53+
{89AA991A-C9F5-4DC5-BD0C-B46441285215} = {78492F40-D9D4-4A26-ACC7-5FD85D6CCE2F}
54+
{272C2E9B-0C81-46BD-B144-8DA5D9053B7C} = {78492F40-D9D4-4A26-ACC7-5FD85D6CCE2F}
55+
{C2CEC949-38A8-4726-A673-87D787DB36F6} = {52F18F9E-6352-4FF8-AAE6-700D5DD4CAFF}
56+
{9DB43A25-82F0-426F-AC8D-F1B565485E70} = {22154E77-BF7D-4B6B-B7F3-D538EB9E6ED5}
57+
{B1321449-1AD7-4BB4-8A5F-5E0835CAA259} = {22154E77-BF7D-4B6B-B7F3-D538EB9E6ED5}
58+
EndGlobalSection
59+
GlobalSection(ExtensibilityGlobals) = postSolution
60+
SolutionGuid = {9DD3DE49-6F14-4B7B-A4E7-2D62687DAF56}
61+
EndGlobalSection
62+
EndGlobal
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<LangVersion>latest</LangVersion>
6+
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
7+
<ImplicitUsings>disable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
<InvariantGlobalization>true</InvariantGlobalization>
10+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
11+
<NoWarn>$(NoWarn);IDE0028;IDE0130;IDE0290;IDE0305</NoWarn>
12+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
13+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
14+
<PackageReadmeFile>README.md</PackageReadmeFile>
15+
<PackageProjectUrl>https://github.com/pfpack/early-infra-endpoint</PackageProjectUrl>
16+
<RepositoryUrl>https://github.com/pfpack/early-infra-endpoint</RepositoryUrl>
17+
<Company>pfpack</Company>
18+
<Authors>Andrei Sergeev, Pavel Moskovoy</Authors>
19+
<Copyright>Copyright © 2025 Andrei Sergeev, Pavel Moskovoy</Copyright>
20+
<Description>EarlyFuncPack Infra.Endpoint is an infrastructure engine for .NET for building lightweight applications and services.</Description>
21+
<RootNamespace>PrimeFuncPack</RootNamespace>
22+
<AssemblyName>EarlyFuncPack.Infra.Endpoint.AspNetCore.Generator</AssemblyName>
23+
<Version>0.0.1</Version>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<None Include="..\..\..\LICENSE">
28+
<Pack>True</Pack>
29+
<PackagePath></PackagePath>
30+
</None>
31+
<None Include="..\..\..\README.md">
32+
<Pack>True</Pack>
33+
<PackagePath></PackagePath>
34+
</None>
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
39+
</ItemGroup>
40+
41+
<ItemGroup>
42+
<PackageReference Include="EarlyFuncPack.CodeAnalysis.Extensions" Version="0.0.1" />
43+
<PackageReference Include="EarlyFuncPack.CodeAnalysis.SourceBuilder" Version="0.0.1" />
44+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
45+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
46+
<PrivateAssets>all</PrivateAssets>
47+
</PackageReference>
48+
</ItemGroup>
49+
50+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Text;
2+
using Microsoft.CodeAnalysis;
3+
using Microsoft.CodeAnalysis.Text;
4+
5+
namespace PrimeFuncPack;
6+
7+
[Generator(LanguageNames.CSharp)]
8+
internal sealed class EndpointExtensionsSourceGenerator : IIncrementalGenerator
9+
{
10+
public void Initialize(IncrementalGeneratorInitializationContext context)
11+
{
12+
var provider = context.GetEndpointExtensionsValueProvider();
13+
context.RegisterSourceOutput(provider, GenerateSource);
14+
}
15+
16+
private static void GenerateSource(SourceProductionContext context, EndpointExtensionsMetadata extension)
17+
{
18+
var constructorSourceCode = extension.BuildConstructorSourceCode();
19+
context.AddSource($"{extension.TypeName}.g.cs", SourceText.From(constructorSourceCode, Encoding.UTF8));
20+
21+
foreach (var resolverMethodName in extension.ResolverMethodNames)
22+
{
23+
var endpointSourceCode = extension.BuildEndpointSourceCode(resolverMethodName);
24+
context.AddSource($"{extension.TypeName}.{resolverMethodName}.g.cs", SourceText.From(endpointSourceCode, Encoding.UTF8));
25+
}
26+
}
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Collections.Generic;
2+
3+
namespace PrimeFuncPack;
4+
5+
internal sealed class EndpointExtensionsMetadata
6+
{
7+
public EndpointExtensionsMetadata(
8+
string @namespace,
9+
string typeName,
10+
DisplayedTypeData providerType,
11+
IReadOnlyList<string> resolverMethodNames)
12+
{
13+
Namespace = @namespace ?? string.Empty;
14+
TypeName = typeName ?? string.Empty;
15+
ProviderType = providerType;
16+
ResolverMethodNames = resolverMethodNames ?? [];
17+
}
18+
19+
public string Namespace { get; }
20+
21+
public string TypeName { get; }
22+
23+
public DisplayedTypeData ProviderType { get; }
24+
25+
public IReadOnlyList<string> ResolverMethodNames { get; }
26+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace PrimeFuncPack;
2+
3+
partial class EndpointExtensionsSourceBuilder
4+
{
5+
internal static string BuildConstructorSourceCode(this EndpointExtensionsMetadata metadata)
6+
=>
7+
new SourceBuilder(
8+
metadata.Namespace)
9+
.AppendCodeLine(
10+
$"internal static partial class {metadata.TypeName}")
11+
.BeginCodeBlock()
12+
.EndCodeBlock()
13+
.Build();
14+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Linq;
2+
3+
namespace PrimeFuncPack;
4+
5+
partial class EndpointExtensionsSourceBuilder
6+
{
7+
internal static string BuildEndpointSourceCode(this EndpointExtensionsMetadata metadata, string resolverMethodName)
8+
=>
9+
new SourceBuilder(
10+
metadata.Namespace)
11+
.AddUsing(
12+
"Microsoft.AspNetCore.Builder",
13+
"PrimeFuncPack")
14+
.AddUsing(
15+
metadata.ProviderType.AllNamespaces.ToArray())
16+
.AppendCodeLine(
17+
$"partial class {metadata.TypeName}")
18+
.BeginCodeBlock()
19+
.AppendCodeLine(
20+
$"internal static TBuilder {resolverMethodName}<TBuilder>(this TBuilder builder) where TBuilder : IApplicationBuilder")
21+
.BeginLambda()
22+
.AppendCodeLine(
23+
$"builder.UseEndpoint({metadata.ProviderType.DisplayedTypeName}.{resolverMethodName}().Resolve);")
24+
.EndLambda()
25+
.EndCodeBlock()
26+
.Build();
27+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace PrimeFuncPack;
2+
3+
internal static partial class EndpointExtensionsSourceBuilder
4+
{
5+
}

0 commit comments

Comments
 (0)