Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
initial feedback
  • Loading branch information
m-redding committed Nov 18, 2025
commit 729dbe04b882085521c330af71930b455f41623f
4 changes: 2 additions & 2 deletions eng/Directory.Build.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
<GenerateAPIListing Condition="'$(GenerateAPIListing)' == '' AND '$(IsShippingClientLibrary)' == 'true'">true</GenerateAPIListing>
<EnableSourceLink Condition="'$(EnableSourceLink)' == ''">true</EnableSourceLink>
<DefineConstants Condition="'$(BuildSnippets)' == 'true'">$(DefineConstants);SNIPPET</DefineConstants>
<AotCompatOptOut>false</AotCompatOptOut>
<AotAnalyzersOptOut>false</AotAnalyzersOptOut>
<AotCompatOptOut Condition="'$(IsShippingLibrary)' == 'true'">false</AotCompatOptOut>
<AotAnalyzersOptOut Condition="'$(IsShippingLibrary)' == 'true'">false</AotAnalyzersOptOut>
<ApiCompatBaselineTargetFramework Condition="'$(TargetFramework)' == '$(LtsTargetFramework)'">netstandard2.0</ApiCompatBaselineTargetFramework>
</PropertyGroup>

Expand Down
10 changes: 0 additions & 10 deletions eng/Directory.Build.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -401,16 +401,6 @@
</ItemGroup>
</Target>

<Target Name="GetAotCompatOptOut" Returns="@(AotCompatOptOutLine)">
<PropertyGroup>
<AotCompatOptOutText>$(PackageId):AotCompatOptOut=$(AotCompatOptOut)</AotCompatOptOutText>
</PropertyGroup>

<ItemGroup Condition="'$(IsShippingLibrary)' == 'true'">
<AotCompatOptOutLine Include="$(AotCompatOptOutText)" />
</ItemGroup>
</Target>

<Target Name="_SetProjectDependsOnInnerTarget">
<PropertyGroup>
<InnerTargets>ProjectDependsOnInner</InnerTargets>
Expand Down
44 changes: 14 additions & 30 deletions eng/scripts/compatibility/Check-AOT-Compatibility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,22 @@ param(
### Check if AOT compatibility is opted out ###

$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot .. .. ..)
$EngDir = Join-Path $RepoRoot "eng"
$ServiceProj = Join-Path -Path $EngDir -ChildPath "service.proj"
$outputFilePath = Join-Path ([System.IO.Path]::GetTempPath()) "aot-compat-$([System.Guid]::NewGuid()).txt"

dotnet msbuild `
/nologo `
/t:GetAotCompatOptOut `
"$ServiceProj" `
/p:ServiceDirectory=$ServiceDirectory `
/p:Project=$PackageName `
/p:IncludeTests=false `
/p:IncludeSamples=false `
/p:IncludePerf=false `
/p:IncludeStress=false `
/p:OutputProjectInfoListFilePath="$outputFilePath" `
-tl:off | Out-Host

$aotCompatLines = @()
if (Test-Path $outputFilePath) {
$aotCompatLines = Get-Content $outputFilePath | Where-Object { $_ -and $_.Trim() }
$null = Remove-Item $outputFilePath -Force -ErrorAction SilentlyContinue

# Build the path to the actual project file (same logic as used later in the script)
if ([string]::IsNullOrEmpty($DirectoryName)) {
$ProjectPath = Join-Path $RepoRoot "sdk" $ServiceDirectory $PackageName "src" "$PackageName.csproj"
} else {
$ProjectPath = Join-Path $RepoRoot "sdk" $ServiceDirectory $DirectoryName "src" "$PackageName.csproj"
}

foreach ($line in $aotCompatLines) {
if ($line -like "*$PackageName:AotCompatOptOut=*") {
$aotCompatOptOut = $line.Split("=")[1].Trim()
if ($aotCompatOptOut -eq "true") {
Write-Host "AOT compatibility is opted out for $PackageName. Skipping AOT compatibility check."
exit 0
}
break
}
# Get the property directly from the project file - replicating what the target does
$output = dotnet msbuild -getProperty:AotCompatOptOut "$ProjectPath"

$aotOptOut = $output.Trim() -eq "true"

if ($aotOptOut) {
Write-Host "AOT compatibility is opted out for $PackageName. Skipping AOT compatibility check."
exit 0
}

### Creating a test app ###
Expand Down
21 changes: 0 additions & 21 deletions eng/service.proj
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,4 @@
<WriteLinesToFile File="$(OutputProjectFilePath)" Lines="@(_WriteToLines)" />
</Target>

<Target Name="GetAotCompatOptOut">
<MSBuild Projects="@(ProjectReference)"
Targets="GetAotCompatOptOut"
BuildInParallel="$(BuildInParallel)"
SkipNonexistentProjects="false"
SkipNonexistentTargets="true">
<Output ItemName="AotCompatOptOutLines" TaskParameter="TargetOutputs" />
</MSBuild>

<!-- Deduplicate lines -->
<RemoveDuplicates Inputs="@(AotCompatOptOutLines)">
<Output TaskParameter="Filtered" ItemName="AotCompatOptOutLinesFiltered"/>
</RemoveDuplicates>

<!-- Write aggregated output to file if OutputProjectInfoListFilePath is specified -->
<WriteLinesToFile Condition="'$(OutputProjectInfoListFilePath)' != ''"
File="$(OutputProjectInfoListFilePath)"
Lines="@(AotCompatOptOutLinesFiltered)"
Overwrite="true" />
</Target>

</Project>
Loading