Skip to content

Commit

Permalink
nuget sourcegen fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
coronabytes committed Sep 1, 2024
1 parent 400ba19 commit e3feb59
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Authors>Andreas Dominik Jung</Authors>
<Copyright>Andreas Dominik Jung</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>Core.ServiceMesh.Abstractions</PackageId>
<PackageTags>service-mesh nats</PackageTags>
<PackageReleaseNotes></PackageReleaseNotes>
Expand Down
10 changes: 9 additions & 1 deletion Core.ServiceMesh.SourceGen/Core.ServiceMesh.SourceGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<Authors>Andreas Dominik Jung</Authors>
<Copyright>Andreas Dominik Jung</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>Core.ServiceMesh.SourceGen</PackageId>
<PackageTags>service-mesh nats</PackageTags>
<PackageReleaseNotes></PackageReleaseNotes>
Expand All @@ -20,10 +20,18 @@
<RepositoryUrl>https://github.com/coronabytes/servicemesh.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<IsPackable>true</IsPackable>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IsRoslynComponent>true</IsRoslynComponent>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true"
PackagePath="analyzers/dotnet/cs" Visible="false" />
</ItemGroup>

</Project>
10 changes: 8 additions & 2 deletions Core.ServiceMesh.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Core.ServiceMesh/Core.ServiceMesh.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Authors>Andreas Dominik Jung</Authors>
<Copyright>Andreas Dominik Jung</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageId>Core.ServiceMesh</PackageId>
<PackageTags>service-mesh nats</PackageTags>
<PackageReleaseNotes></PackageReleaseNotes>
Expand Down
33 changes: 33 additions & 0 deletions SampleAppNuget/Controllers/WeatherForecastController.cs
Original file line number Diff line number Diff line change
@@ -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<WeatherForecastController> _logger;

public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}

[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> 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();
}
}
}
14 changes: 14 additions & 0 deletions SampleAppNuget/Mesh/IAnotherService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Core.ServiceMesh.Abstractions;
using SampleInterfaces;

namespace SampleAppNuget.Mesh;

[ServiceMesh("nugetservice")]
public interface INugetService
{
ValueTask<SampleResponse> SampleA(SampleRequest request);

ValueTask<SampleResponse> SampleB(SampleRequest request);

ValueTask SampleC(SampleRequest request);
};
3 changes: 3 additions & 0 deletions SampleAppNuget/Mesh/SampleRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace SampleInterfaces;

public record SampleRequest(string Name, decimal Amount);
3 changes: 3 additions & 0 deletions SampleAppNuget/Mesh/SampleResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace SampleInterfaces;

public record SampleResponse(string Result);
25 changes: 25 additions & 0 deletions SampleAppNuget/Program.cs
Original file line number Diff line number Diff line change
@@ -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();
41 changes: 41 additions & 0 deletions SampleAppNuget/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
16 changes: 16 additions & 0 deletions SampleAppNuget/SampleAppNuget.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Core.ServiceMesh" Version="0.0.4" />
<PackageReference Include="Core.ServiceMesh.SourceGen" Version="0.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions SampleAppNuget/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
8 changes: 8 additions & 0 deletions SampleAppNuget/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions SampleAppNuget/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

0 comments on commit e3feb59

Please sign in to comment.