From e3feb59c4f8cc202ba08667b76e56906c4d98e1b Mon Sep 17 00:00:00 2001 From: jung Date: Sun, 1 Sep 2024 15:23:38 +0200 Subject: [PATCH] nuget sourcegen fix? --- .../Core.ServiceMesh.Abstractions.csproj | 2 +- .../Core.ServiceMesh.SourceGen.csproj | 10 ++++- Core.ServiceMesh.sln | 10 ++++- Core.ServiceMesh/Core.ServiceMesh.csproj | 2 +- .../Controllers/WeatherForecastController.cs | 33 +++++++++++++++ SampleAppNuget/Mesh/IAnotherService.cs | 14 +++++++ SampleAppNuget/Mesh/SampleRequest.cs | 3 ++ SampleAppNuget/Mesh/SampleResponse.cs | 3 ++ SampleAppNuget/Program.cs | 25 +++++++++++ SampleAppNuget/Properties/launchSettings.json | 41 +++++++++++++++++++ SampleAppNuget/SampleAppNuget.csproj | 16 ++++++++ SampleAppNuget/WeatherForecast.cs | 13 ++++++ SampleAppNuget/appsettings.Development.json | 8 ++++ SampleAppNuget/appsettings.json | 9 ++++ 14 files changed, 184 insertions(+), 5 deletions(-) create mode 100644 SampleAppNuget/Controllers/WeatherForecastController.cs create mode 100644 SampleAppNuget/Mesh/IAnotherService.cs create mode 100644 SampleAppNuget/Mesh/SampleRequest.cs create mode 100644 SampleAppNuget/Mesh/SampleResponse.cs create mode 100644 SampleAppNuget/Program.cs create mode 100644 SampleAppNuget/Properties/launchSettings.json create mode 100644 SampleAppNuget/SampleAppNuget.csproj create mode 100644 SampleAppNuget/WeatherForecast.cs create mode 100644 SampleAppNuget/appsettings.Development.json create mode 100644 SampleAppNuget/appsettings.json diff --git a/Core.ServiceMesh.Abstractions/Core.ServiceMesh.Abstractions.csproj b/Core.ServiceMesh.Abstractions/Core.ServiceMesh.Abstractions.csproj index e975b33..43f9fe3 100644 --- a/Core.ServiceMesh.Abstractions/Core.ServiceMesh.Abstractions.csproj +++ b/Core.ServiceMesh.Abstractions/Core.ServiceMesh.Abstractions.csproj @@ -6,7 +6,7 @@ enable Andreas Dominik Jung Andreas Dominik Jung - true + false Core.ServiceMesh.Abstractions service-mesh nats diff --git a/Core.ServiceMesh.SourceGen/Core.ServiceMesh.SourceGen.csproj b/Core.ServiceMesh.SourceGen/Core.ServiceMesh.SourceGen.csproj index 14644bb..1732f0c 100644 --- a/Core.ServiceMesh.SourceGen/Core.ServiceMesh.SourceGen.csproj +++ b/Core.ServiceMesh.SourceGen/Core.ServiceMesh.SourceGen.csproj @@ -6,7 +6,7 @@ true Andreas Dominik Jung Andreas Dominik Jung - true + false Core.ServiceMesh.SourceGen service-mesh nats @@ -20,10 +20,18 @@ https://github.com/coronabytes/servicemesh.git git true + false + true + + + + + diff --git a/Core.ServiceMesh.sln b/Core.ServiceMesh.sln index 4bb7654..aefa129 100644 --- a/Core.ServiceMesh.sln +++ b/Core.ServiceMesh.sln @@ -13,9 +13,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleInterfaces", "SampleI EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleWorker", "SampleWorker\SampleWorker.csproj", "{3E1285C2-DE29-4591-8BE3-5D5684B1AA42}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.ServiceMesh.SourceGen", "Core.ServiceMesh.SourceGen\Core.ServiceMesh.SourceGen.csproj", "{056844CB-F495-48FA-B351-E5F7590E4A17}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.ServiceMesh.SourceGen", "Core.ServiceMesh.SourceGen\Core.ServiceMesh.SourceGen.csproj", "{056844CB-F495-48FA-B351-E5F7590E4A17}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.ServiceMesh.SourceGen.Tests", "Core.ServiceMesh.SourceGen.Tests\Core.ServiceMesh.SourceGen.Tests.csproj", "{0A12704F-4653-42B9-B4A5-D31BE66512A4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.ServiceMesh.SourceGen.Tests", "Core.ServiceMesh.SourceGen.Tests\Core.ServiceMesh.SourceGen.Tests.csproj", "{0A12704F-4653-42B9-B4A5-D31BE66512A4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleAppNuget", "SampleAppNuget\SampleAppNuget.csproj", "{46F1E3ED-4BB2-4C40-B454-263B786C9D96}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -51,6 +53,10 @@ Global {0A12704F-4653-42B9-B4A5-D31BE66512A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {0A12704F-4653-42B9-B4A5-D31BE66512A4}.Release|Any CPU.ActiveCfg = Release|Any CPU {0A12704F-4653-42B9-B4A5-D31BE66512A4}.Release|Any CPU.Build.0 = Release|Any CPU + {46F1E3ED-4BB2-4C40-B454-263B786C9D96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46F1E3ED-4BB2-4C40-B454-263B786C9D96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46F1E3ED-4BB2-4C40-B454-263B786C9D96}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46F1E3ED-4BB2-4C40-B454-263B786C9D96}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Core.ServiceMesh/Core.ServiceMesh.csproj b/Core.ServiceMesh/Core.ServiceMesh.csproj index 9e734c3..2479ed7 100644 --- a/Core.ServiceMesh/Core.ServiceMesh.csproj +++ b/Core.ServiceMesh/Core.ServiceMesh.csproj @@ -6,7 +6,7 @@ enable Andreas Dominik Jung Andreas Dominik Jung - true + false Core.ServiceMesh service-mesh nats diff --git a/SampleAppNuget/Controllers/WeatherForecastController.cs b/SampleAppNuget/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..5cfb113 --- /dev/null +++ b/SampleAppNuget/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace SampleAppNuget.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} diff --git a/SampleAppNuget/Mesh/IAnotherService.cs b/SampleAppNuget/Mesh/IAnotherService.cs new file mode 100644 index 0000000..7dad076 --- /dev/null +++ b/SampleAppNuget/Mesh/IAnotherService.cs @@ -0,0 +1,14 @@ +using Core.ServiceMesh.Abstractions; +using SampleInterfaces; + +namespace SampleAppNuget.Mesh; + +[ServiceMesh("nugetservice")] +public interface INugetService +{ + ValueTask SampleA(SampleRequest request); + + ValueTask SampleB(SampleRequest request); + + ValueTask SampleC(SampleRequest request); +}; \ No newline at end of file diff --git a/SampleAppNuget/Mesh/SampleRequest.cs b/SampleAppNuget/Mesh/SampleRequest.cs new file mode 100644 index 0000000..9a76658 --- /dev/null +++ b/SampleAppNuget/Mesh/SampleRequest.cs @@ -0,0 +1,3 @@ +namespace SampleInterfaces; + +public record SampleRequest(string Name, decimal Amount); \ No newline at end of file diff --git a/SampleAppNuget/Mesh/SampleResponse.cs b/SampleAppNuget/Mesh/SampleResponse.cs new file mode 100644 index 0000000..8a36d32 --- /dev/null +++ b/SampleAppNuget/Mesh/SampleResponse.cs @@ -0,0 +1,3 @@ +namespace SampleInterfaces; + +public record SampleResponse(string Result); \ No newline at end of file diff --git a/SampleAppNuget/Program.cs b/SampleAppNuget/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/SampleAppNuget/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/SampleAppNuget/Properties/launchSettings.json b/SampleAppNuget/Properties/launchSettings.json new file mode 100644 index 0000000..3ae6c0c --- /dev/null +++ b/SampleAppNuget/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:42959", + "sslPort": 44311 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5188", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7187;http://localhost:5188", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/SampleAppNuget/SampleAppNuget.csproj b/SampleAppNuget/SampleAppNuget.csproj new file mode 100644 index 0000000..7c411ef --- /dev/null +++ b/SampleAppNuget/SampleAppNuget.csproj @@ -0,0 +1,16 @@ + + + + net8.0 + enable + enable + false + + + + + + + + + diff --git a/SampleAppNuget/WeatherForecast.cs b/SampleAppNuget/WeatherForecast.cs new file mode 100644 index 0000000..b0c3e7c --- /dev/null +++ b/SampleAppNuget/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace SampleAppNuget +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/SampleAppNuget/appsettings.Development.json b/SampleAppNuget/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/SampleAppNuget/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/SampleAppNuget/appsettings.json b/SampleAppNuget/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/SampleAppNuget/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}