Skip to content

Commit

Permalink
Publish the AotCompatibility.TestApp project as part of PR validation (
Browse files Browse the repository at this point in the history
…#5622)

- Remove AI in Microsoft.Extensions.AI.AotCompatibility.TestApp so it can be used for all projects
    - Analyze all libraries except the ones that have current warnings
- Publish the app from the AzDO pipeline
- Clean up the AotCompatibility.TestApp
    - Remove unnecessary code in Program.cs by turning off ReferenceTrimmer
    - Make the project publishable without passing in a TFM by only targeting a single TFM
- Fix part of Compliance.Redaction trimming issues by reenabling the Config Binder source generator.
  • Loading branch information
eerhardt authored Nov 13, 2024
2 parents 6487428 + 4cd0228 commit 1073446
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 49 deletions.
4 changes: 4 additions & 0 deletions eng/pipelines/templates/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ steps:
condition: always()
continueOnError: true
- script: $(Build.SourcesDirectory)/.dotnet/dotnet publish
workingDirectory: $(Build.SourcesDirectory)/test/Libraries/Microsoft.Extensions.AotCompatibility.TestApp
displayName: Publish AOT Test

- ${{ if ne(parameters.skipQualityGates, 'true') }}:
- ${{ if eq(parameters.runAsPublic, 'true') }}:
- task: PublishPipelineArtifact@1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
<InjectStringSyntaxAttributeOnLegacy>true</InjectStringSyntaxAttributeOnLegacy>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
<InjectSharedNumericExtensions>true</InjectSharedNumericExtensions>
<InjectSharedDataValidation>true</InjectSharedDataValidation>

<!-- using the ConfigurationBinder source generator is blocked by https://github.com/dotnet/runtime/issues/94547 -->
<!-- https://github.com/dotnet/extensions/issues/5623 -->
<IsAotCompatible>false</IsAotCompatible>
<NoWarn>$(NoWarn);IL2026</NoWarn>
</PropertyGroup>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(LatestTargetFramework)</TargetFramework>
<!-- clear TargetFrameworks because it is set in ..\Directory.Build.props -->
<TargetFrameworks></TargetFrameworks>
<PublishAot>true</PublishAot>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<!-- Remove the ReferenceTrimmer analyzer. We explicitly want to reference every assembly so the AOT compiler sees it. -->
<PackageReference Remove="ReferenceTrimmer" />

<LibraryProjects Include="$(RepoRoot)\src\Libraries\**\*.csproj" />
<!-- https://github.com/Azure/azure-sdk-for-net/issues/47069 -->
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.AI.AzureAIInference\Microsoft.Extensions.AI.AzureAIInference.csproj" />
<!-- https://github.com/openai/openai-dotnet/issues/20 -->
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.AI.OpenAI\Microsoft.Extensions.AI.OpenAI.csproj" />
<!-- https://github.com/dotnet/extensions/issues/5624 -->
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.Caching.Hybrid\Microsoft.Extensions.Caching.Hybrid.csproj" />
<!-- https://github.com/dotnet/extensions/issues/5623 -->
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.Compliance.Redaction\Microsoft.Extensions.Compliance.Redaction.csproj" />
<!-- https://github.com/dotnet/extensions/issues/5625 -->
<LibraryProjects Remove="$(RepoRoot)\src\Libraries\Microsoft.Extensions.Http.Resilience\Microsoft.Extensions.Http.Resilience.csproj" />

<TrimmerRootAssembly Include="@(LibraryProjects->'%(FileName)')" />
<ProjectReference Include="@(LibraryProjects)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

System.Console.WriteLine("Success!");

0 comments on commit 1073446

Please sign in to comment.