Skip to content

Commit

Permalink
Regenerate sgen files
Browse files Browse the repository at this point in the history
  • Loading branch information
OoLunar committed Jun 28, 2024
1 parent 89ca3fa commit 215b32b
Show file tree
Hide file tree
Showing 76 changed files with 228 additions and 386 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Nullable>enable</Nullable>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IsPackable>false</IsPackable>
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/HyperSharp.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ItemGroup>
<None Include="../res/config.json" CopyToOutputDirectory="Always" />
<PackageReference Include="EmbedIO" Version="3.5.2" />
<PackageReference Include="GenHTTP.Core" Version="8.3.1" />
<PackageReference Include="GenHTTP.Core" Version="8.5.2" />
<PackageReference Include="NetCoreServer" Version="8.0.7" />
<ProjectReference Include="$(ProjectRoot)/src/HyperSharp/HyperSharp.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
Expand All @@ -16,10 +16,10 @@
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectReference Include="$(ProjectRoot)/src/HyperSharp/HyperSharp.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.4" />
<PackageReference Include="NuGet.Frameworks" Version="6.9.1" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.6" />
<PackageReference Include="NuGet.Frameworks" Version="6.10.1" />
<PackageReference Include="ThisAssembly.Project" Version="1.4.3" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" PrivateAssets="all" />
<ProjectProperty Include="ProjectRoot" />
<ProjectProperty Include="TargetFramework" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public bool Execute(IConfiguration configuration)

headerNames.AppendLine(ENUM_VALUE_TEMPLATE
.Replace("{{HeaderName}}", headerName.Name)
.Replace("{{HeaderValue}}", headerName.GetRawConstantValue()!.ToString()
.Replace("{{HeaderValue}}", headerName.GetValue(null)!.ToString()
));
}

string code = CODE_TEMPLATE
.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture))
.Replace("{{HeaderName}}", headerNames.ToString().TrimStart().TrimEnd('\n', ','));
string projectRoot = Directory.GetCurrentDirectory();
File.WriteAllText(Path.Combine(projectRoot, "Protocol", "HyperHeaderName.cs"), code);
string projectRoot = ThisAssembly.Project.ProjectRoot;
File.WriteAllText(Path.Combine(projectRoot, "src/HyperSharp/Protocol/HyperHeaderName.cs"), code);

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ public readonly partial record struct HyperStatus

public bool Execute(IConfiguration configuration)
{
string projectRoot = Directory.GetCurrentDirectory();
string? targetFrameworks = configuration["TargetFrameworks"];
if (targetFrameworks is null)
{
Console.WriteLine("The 'TargetFrameworks' property is not set.");
return false;
}

string[] targetedFrameworks = targetFrameworks.Split(';');
string? dotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
if (dotnetRoot is null)
{
Expand Down Expand Up @@ -89,7 +80,7 @@ public bool Execute(IConfiguration configuration)
Console.WriteLine($"Skipping '{sdkVersion}' because in '{Path.GetFileName(msBuildDependenciesJsonPath)}', the 'runtimeOptions.tfm' property contains a null value.");
continue;
}
else if (!targetedFrameworks.Any(framework => framework.StartsWith(targetFrameworkMoniker, StringComparison.OrdinalIgnoreCase)))
else if (!new string[] { ThisAssembly.Project.TargetFramework }.Any(framework => framework.StartsWith(targetFrameworkMoniker, StringComparison.OrdinalIgnoreCase)))
{
Console.WriteLine($"Skipping '{sdkVersion}' because in '{Path.GetFileName(msBuildDependenciesJsonPath)}' the 'runtimeOptions.tfm' property contains a value that is not targeted by the project.");
continue;
Expand All @@ -112,7 +103,8 @@ public bool Execute(IConfiguration configuration)
.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture))
.Replace("{{NetVersion}}", targetFrameworkMoniker.Replace('.', '_').ToUpperInvariant())
.Replace("{{Code}}", httpStatus);
File.WriteAllText($"{projectRoot}/Protocol/HyperStatus/HyperStatus.{httpStatus}.cs", stringBuilder.ToString());

File.WriteAllText($"{ThisAssembly.Project.ProjectRoot}/src/HyperSharp/Protocol/HyperStatus/HyperStatus.{httpStatus}.cs", stringBuilder.ToString());
}
}

Expand Down
157 changes: 136 additions & 21 deletions src/HyperSharp/Protocol/HyperHeaderName.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated/>
// Last modified at 2023-09-24.
// Last modified at 2024-06-28.

namespace HyperSharp.Protocol
{
Expand Down Expand Up @@ -87,15 +87,20 @@ public enum HyperHeaderName
Allow,

/// <summary>
/// Represents the <c>:authority</c> header.
/// Represents the <c>Alt-Svc</c> header.
/// </summary>
Authority,
AltSvc,

/// <summary>
/// Represents the <c>Authorization</c> header.
/// </summary>
Authorization,

/// <summary>
/// Represents the <c>baggage</c> header.
/// </summary>
Baggage,

/// <summary>
/// Represents the <c>Cache-Control</c> header.
/// </summary>
Expand Down Expand Up @@ -156,6 +161,11 @@ public enum HyperHeaderName
/// </summary>
ContentType,

/// <summary>
/// Represents the <c>Correlation-Context</c> header.
/// </summary>
CorrelationContext,

/// <summary>
/// Represents the <c>Cookie</c> header.
/// </summary>
Expand All @@ -166,6 +176,11 @@ public enum HyperHeaderName
/// </summary>
Date,

/// <summary>
/// Represents the <c>DNT</c> header.
/// </summary>
DNT,

/// <summary>
/// Represents the <c>ETag</c> header.
/// </summary>
Expand All @@ -186,11 +201,41 @@ public enum HyperHeaderName
/// </summary>
From,

/// <summary>
/// Represents the <c>Grpc-Accept-Encoding</c> header.
/// </summary>
GrpcAcceptEncoding,

/// <summary>
/// Represents the <c>Grpc-Encoding</c> header.
/// </summary>
GrpcEncoding,

/// <summary>
/// Represents the <c>Grpc-Message</c> header.
/// </summary>
GrpcMessage,

/// <summary>
/// Represents the <c>Grpc-Status</c> header.
/// </summary>
GrpcStatus,

/// <summary>
/// Represents the <c>Grpc-Timeout</c> header.
/// </summary>
GrpcTimeout,

/// <summary>
/// Represents the <c>Host</c> header.
/// </summary>
Host,

/// <summary>
/// Represents the <c>Keep-Alive</c> header.
/// </summary>
KeepAlive,

/// <summary>
/// Represents the <c>If-Match</c> header.
/// </summary>
Expand Down Expand Up @@ -221,6 +266,11 @@ public enum HyperHeaderName
/// </summary>
LastModified,

/// <summary>
/// Represents the <c>Link</c> header.
/// </summary>
Link,

/// <summary>
/// Represents the <c>Location</c> header.
/// </summary>
Expand All @@ -231,21 +281,11 @@ public enum HyperHeaderName
/// </summary>
MaxForwards,

/// <summary>
/// Represents the <c>:method</c> header.
/// </summary>
Method,

/// <summary>
/// Represents the <c>Origin</c> header.
/// </summary>
Origin,

/// <summary>
/// Represents the <c>:path</c> header.
/// </summary>
Path,

/// <summary>
/// Represents the <c>Pragma</c> header.
/// </summary>
Expand All @@ -261,6 +301,11 @@ public enum HyperHeaderName
/// </summary>
ProxyAuthorization,

/// <summary>
/// Represents the <c>Proxy-Connection</c> header.
/// </summary>
ProxyConnection,

/// <summary>
/// Represents the <c>Range</c> header.
/// </summary>
Expand All @@ -277,9 +322,34 @@ public enum HyperHeaderName
RetryAfter,

/// <summary>
/// Represents the <c>:scheme</c> header.
/// Represents the <c>Request-Id</c> header.
/// </summary>
RequestId,

/// <summary>
/// Represents the <c>Sec-WebSocket-Accept</c> header.
/// </summary>
SecWebSocketAccept,

/// <summary>
/// Represents the <c>Sec-WebSocket-Key</c> header.
/// </summary>
SecWebSocketKey,

/// <summary>
/// Represents the <c>Sec-WebSocket-Protocol</c> header.
/// </summary>
SecWebSocketProtocol,

/// <summary>
/// Represents the <c>Sec-WebSocket-Version</c> header.
/// </summary>
SecWebSocketVersion,

/// <summary>
/// Represents the <c>Sec-WebSocket-Extensions</c> header.
/// </summary>
Scheme,
SecWebSocketExtensions,

/// <summary>
/// Represents the <c>Server</c> header.
Expand All @@ -291,11 +361,6 @@ public enum HyperHeaderName
/// </summary>
SetCookie,

/// <summary>
/// Represents the <c>:status</c> header.
/// </summary>
Status,

/// <summary>
/// Represents the <c>Strict-Transport-Security</c> header.
/// </summary>
Expand All @@ -316,11 +381,31 @@ public enum HyperHeaderName
/// </summary>
TransferEncoding,

/// <summary>
/// Represents the <c>Translate</c> header.
/// </summary>
Translate,

/// <summary>
/// Represents the <c>traceparent</c> header.
/// </summary>
TraceParent,

/// <summary>
/// Represents the <c>tracestate</c> header.
/// </summary>
TraceState,

/// <summary>
/// Represents the <c>Upgrade</c> header.
/// </summary>
Upgrade,

/// <summary>
/// Represents the <c>Upgrade-Insecure-Requests</c> header.
/// </summary>
UpgradeInsecureRequests,

/// <summary>
/// Represents the <c>User-Agent</c> header.
/// </summary>
Expand Down Expand Up @@ -349,6 +434,36 @@ public enum HyperHeaderName
/// <summary>
/// Represents the <c>WWW-Authenticate</c> header.
/// </summary>
WWWAuthenticate
WWWAuthenticate,

/// <summary>
/// Represents the <c>X-Content-Type-Options</c> header.
/// </summary>
XContentTypeOptions,

/// <summary>
/// Represents the <c>X-Frame-Options</c> header.
/// </summary>
XFrameOptions,

/// <summary>
/// Represents the <c>X-Powered-By</c> header.
/// </summary>
XPoweredBy,

/// <summary>
/// Represents the <c>X-Requested-With</c> header.
/// </summary>
XRequestedWith,

/// <summary>
/// Represents the <c>X-UA-Compatible</c> header.
/// </summary>
XUACompatible,

/// <summary>
/// Represents the <c>X-XSS-Protection</c> header.
/// </summary>
XXSSProtection
}
}
6 changes: 1 addition & 5 deletions src/HyperSharp/Protocol/HyperStatus/HyperStatus.Accepted.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// <auto-generated/>
// Last modified at 2023-09-24.
// Last modified at 2024-06-28.

#nullable enable
namespace HyperSharp.Protocol
{
public readonly partial record struct HyperStatus
{
#if NET7_0_OR_GREATER

/// <inheritdoc cref="global::System.Net.HttpStatusCode.Accepted" />
public static HyperStatus Accepted() => new(global::System.Net.HttpStatusCode.Accepted, new HyperHeaderCollection(), null);

Expand All @@ -23,7 +21,5 @@ public readonly partial record struct HyperStatus
/// <param name="headers">The headers of the response.</param>
/// <param name="body">The body of the response.</param>
public static HyperStatus Accepted(HyperHeaderCollection headers, object? body) => new(global::System.Net.HttpStatusCode.Accepted, headers, body);

#endif
}
}
Loading

0 comments on commit 215b32b

Please sign in to comment.