Skip to content

Commit a636d4a

Browse files
committed
Add setup for NativeAoT test project for OpenAPI
1 parent c8fe8ca commit a636d4a

File tree

51 files changed

+40
-5
lines changed

Some content is hidden

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

51 files changed

+40
-5
lines changed

eng/RequiresDelayedBuildProjects.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<RequiresDelayedBuild Include="$(RepoRoot)src\Grpc\JsonTranscoding\test\Microsoft.AspNetCore.Grpc.Swagger.Tests\Microsoft.AspNetCore.Grpc.Swagger.Tests.csproj" />
2121
<RequiresDelayedBuild Include="$(RepoRoot)src\Grpc\JsonTranscoding\test\testassets\IntegrationTestsWebsite\IntegrationTestsWebsite.csproj" />
2222
<RequiresDelayedBuild Include="$(RepoRoot)src\Grpc\JsonTranscoding\test\testassets\Sandbox\Sandbox.csproj" />
23+
<RequiresDelayedBuild Include="$(RepoRoot)src\OpenApi\test\Microsoft.AspNetCore.OpenApi.NativeAotTests\Microsoft.AspNetCore.OpenApi.NativeAotTests.proj" />
2324
<RequiresDelayedBuild Include="$(RepoRoot)src\ProjectTemplates\test\Templates.Blazor.Tests\Templates.Blazor.Tests.csproj" />
2425
<RequiresDelayedBuild Include="$(RepoRoot)src\SignalR\server\SignalR\test\Microsoft.AspNetCore.SignalR.TrimmingTests\Microsoft.AspNetCore.SignalR.TrimmingTests.proj" />
2526
<RequiresDelayedBuild Include="$(RepoRoot)eng\Npm.Workspace.FunctionalTests.nodeproj" />

eng/testing/linker/SupportFiles/Directory.Build.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
<ProjectReference Include="$(RepoRoot)src\DataProtection\Extensions\src\Microsoft.AspNetCore.DataProtection.Extensions.csproj" />
7676
<ProjectReference Include="$(RepoRoot)src\SignalR\clients\csharp\Client\src\Microsoft.AspNetCore.SignalR.Client.csproj" />
7777
<ProjectReference Include="$(RepoRoot)src\SignalR\server\SignalR\src\Microsoft.AspNetCore.SignalR.csproj" />
78+
<ProjectReference Include="$(RepoRoot)src\OpenApi\src\Microsoft.AspNetCore.OpenApi.csproj" />
79+
<ProjectReference Include="$(RepoRoot)src\Http\Http.Extensions\gen\Microsoft.AspNetCore.Http.RequestDelegateGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
7880
</ItemGroup>
7981

8082
</Project>

eng/testing/linker/project.csproj.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<!-- Workaround while there is no SDK available that understands the TFM; suppress unsupported version errors. -->
1212
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
1313
<_ExtraTrimmerArgs>{ExtraTrimmerArgs} $(_ExtraTrimmerArgs)</_ExtraTrimmerArgs>
14+
<InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);{InterceptorsPreviewNamespacesArgs}</InterceptorsPreviewNamespaces>
1415
{AdditionalProperties}
1516
</PropertyGroup>
1617

@@ -21,5 +22,5 @@
2122
<ItemGroup>
2223
{AdditionalProjectReferences}
2324
</ItemGroup>
24-
25+
2526
</Project>

eng/testing/linker/trimmingTests.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
.Replace('{AdditionalProperties}', '$(_additionalPropertiesString)')
9292
.Replace('{RuntimeHostConfigurationOptions}', '$(_runtimeHostConfigurationOptionsString)')
9393
.Replace('{AdditionalProjectReferences}', '$(_additionalProjectReferencesString)')
94+
.Replace('{InterceptorsPreviewNamespacesArgs}', '%(TestConsoleApps.InterceptorNamespaces)')
9495
)"
9596
Overwrite="true" />
9697
<Copy SourceFiles="$(_projectSourceFile);

src/OpenApi/OpenApi.slnf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
"src\\OpenApi\\perf\\Microbenchmarks\\Microsoft.AspNetCore.OpenApi.Microbenchmarks.csproj",
1414
"src\\OpenApi\\sample\\Sample.csproj",
1515
"src\\OpenApi\\src\\Microsoft.AspNetCore.OpenApi.csproj",
16-
"src\\OpenApi\\test\\Microsoft.AspNetCore.OpenApi.Tests.csproj",
1716
"src\\Servers\\Connections.Abstractions\\src\\Microsoft.AspNetCore.Connections.Abstractions.csproj"
17+
"src\\OpenApi\\test\\Microsoft.AspNetCore.OpenApi.Tests\\Microsoft.AspNetCore.OpenApi.Tests.csproj",
18+
"src\\OpenApi\\test\\Microsoft.AspNetCore.OpenApi.NativeTests\\Microsoft.AspNetCore.OpenApi.NativeAoTests.proj",
19+
"src\\OpenApi\\sample\\Sample.csproj",
20+
"src\\OpenApi\\perf\\Microbenchmarks\\Microsoft.AspNetCore.OpenApi.Microbenchmarks.csproj"
1821
]
1922
}
2023
}

src/OpenApi/perf/Microbenchmarks/Microsoft.AspNetCore.OpenApi.Microbenchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.OpenApi.Tests.csproj" />
16+
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.OpenApi.Tests\Microsoft.AspNetCore.OpenApi.Tests.csproj" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

src/OpenApi/sample/Sample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25-
<Compile Include="../test/Shared/SharedTypes.cs" />
26-
<Compile Include="../test/Shared/SharedTypes.Polymorphism.cs" />
25+
<Compile Include="../test/Microsoft.AspNetCore.OpenApi.Tests/Shared/SharedTypes.cs" />
26+
<Compile Include="../test/Microsoft.AspNetCore.OpenApi.Tests/Shared/SharedTypes.Polymorphism.cs" />
2727
</ItemGroup>
2828

2929
<!-- Required to generated trimmable Map-invocations. -->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
using Microsoft.AspNetCore.Builder;
4+
using Microsoft.Extensions.DependencyInjection;
5+
6+
var builder = WebApplication.CreateSlimBuilder();
7+
8+
builder.Services.AddOpenApi();
9+
10+
var app = builder.Build();
11+
12+
app.MapOpenApi();
13+
14+
app.MapGet("/", () => "Hello World!");
15+
app.MapGet("/{name}", (string name) => $"Hello {name}!");
16+
17+
return 100;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<ItemGroup>
4+
<_TestConsoleAppSourceFiles Include="BasicMinimalApiWithOpenApiDependency.cs">
5+
<EnabledProperties>EnableRequestDelegateGenerator</EnabledProperties>
6+
<InterceptorNamespaces>Microsoft.AspNetCore.Http.Generated</InterceptorNamespaces>
7+
</_TestConsoleAppSourceFiles>
8+
</ItemGroup>
9+
10+
</Project>

0 commit comments

Comments
 (0)