2022-12-22 20:41:33 +03:00
|
|
|
|
|
|
|
param(
|
|
|
|
[Parameter(Mandatory = $true)] [String]$BuildConfiguration
|
|
|
|
)
|
|
|
|
|
|
|
|
Write-Host "BuildConfiguration" $BuildConfiguration
|
|
|
|
|
|
|
|
$apiTool="tool\.store\microsoft.dotnet.apicompat.tool\7.0.100\microsoft.dotnet.apicompat.tool\7.0.100\tools\net6.0\any\Microsoft.DotNet.ApiCompat.Tool.dll"
|
|
|
|
$apiToolRightFolder="Output"
|
|
|
|
|
|
|
|
[xml]$xfiles = Get-Content .\ApiCompat.Files.xml
|
2022-12-23 12:28:03 +03:00
|
|
|
$e = "<br />" + [char]0x274C
|
2022-12-22 20:41:33 +03:00
|
|
|
|
|
|
|
foreach ($a in $xfiles.ApiCompat.Assembly)
|
|
|
|
{
|
|
|
|
$n = $a.Name
|
|
|
|
$s = "suppress.$n.xml"
|
|
|
|
$l = $ExecutionContext.InvokeCommand.ExpandString($a.Location)
|
|
|
|
$apiToolLeft = "$l\$n.dll"
|
|
|
|
$apiToolRight = "$apiToolRightFolder\$n.dll"
|
|
|
|
|
|
|
|
Set-Content $s "<Suppressions/>"
|
|
|
|
|
|
|
|
Write-Host "Checking" $n "..."
|
|
|
|
dotnet $apiTool --suppression-file $s --left-assembly $apiToolLeft --right-assembly $apiToolRight --enable-rule-attributes-must-match --enable-rule-cannot-change-parameter-name --generate-suppression-file
|
|
|
|
|
|
|
|
[xml]$x = Get-Content $s
|
2022-12-23 12:28:03 +03:00
|
|
|
$e += [string]::Join("<br />" + [char]0x274C, ($x.Suppressions.Suppression | % { $_.DiagnosticId + " " + $_.Target })).Trim()
|
2022-12-22 20:41:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-23 12:28:03 +03:00
|
|
|
if ($e.Length -gt 8)
|
2022-12-22 20:41:33 +03:00
|
|
|
{
|
|
|
|
Write-Host "##[error] $e"
|
|
|
|
Write-Host "##vso[task.setvariable variable=ApiCompat;issecret=false]Public API changes: $e"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$ok = [char]0x2705
|
|
|
|
$okMsg = $ok + " No public API change."
|
|
|
|
Write-Host $okMsg
|
|
|
|
Write-Host "##vso[task.setvariable variable=ApiCompat;issecret=false]$okMsg"
|
|
|
|
}
|