Skip to content

Commit 5db35a0

Browse files
committed
Add beforeFriendlyName and afterFriendlyName arguments. Pass the correct strings to the api diff tool. Add better logic to determine root of failure when packages are not found.
1 parent 6f116f0 commit 5db35a0

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

release-notes/RunApiDiff2.ps1

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,16 @@ Function RunApiDiff2
372372
[ValidateNotNullOrEmpty()]
373373
[string]
374374
$attributesToExclude
375+
,
376+
[Parameter(Mandatory = $true)]
377+
[ValidateNotNullOrEmpty()]
378+
[string]
379+
$beforeFriendlyName
380+
,
381+
[Parameter(Mandatory = $true)]
382+
[ValidateNotNullOrEmpty()]
383+
[string]
384+
$afterFriendlyName
375385
)
376386

377387
VerifyPathOrExit $apiDiffExe
@@ -381,7 +391,7 @@ Function RunApiDiff2
381391
# All arguments:
382392
# "https://github.com/dotnet/sdk/tree/main/src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff.Tool/Program.cs"
383393

384-
RunCommand "$apiDiffExe -b $beforeFolder -a $afterFolder -o $outputFolder -tc $tableOfContentsFileNamePrefix -eattrs '$attributesToExclude'"
394+
RunCommand "$apiDiffExe -b '$beforeFolder' -a '$afterFolder' -o '$outputFolder' -tc '$tableOfContentsFileNamePrefix' -eattrs '$attributesToExclude' -bfn '$beforeFriendlyName' -afn '$afterFriendlyName'"
385395
}
386396

387397
Function CreateReadme
@@ -496,7 +506,7 @@ Function DownloadPackage
496506

497507
$refPackageName = "$fullSdkName.Ref"
498508

499-
$nugetSource = $useNuget ? "https://api.nuget.org/v3/index.json" : "https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet10/nuget/v3/index.json"
509+
$feed = $useNuget ? "https://api.nuget.org/v3/index.json" : "https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet10/nuget/v3/index.json"
500510

501511
$searchTerm = ""
502512
If ($previewOrRC -eq "ga")
@@ -508,7 +518,16 @@ Function DownloadPackage
508518
$searchTerm = "$dotNetversion.*-$previewOrRC.$previewNumberVersion*"
509519
}
510520

511-
$results = Find-Package -AllVersions -Source $nugetSource -Name $refPackageName -AllowPrereleaseVersions | Where-Object -Property Version -Like $searchTerm | Sort-Object Version -Descending
521+
$foundPackages = Find-Package -AllVersions -Source $feed -Name $refPackageName -AllowPrereleaseVersions -ErrorAction Continue
522+
523+
If ($foundPackages.Count -eq 0)
524+
{
525+
Write-Error "No NuGet packages found with ref package name '$refPackageName' in feed '$feed'"
526+
Get-PackageSource -Name $refPackageName | Format-Table -Property Name, SourceUri
527+
Write-Error "Exiting" -ErrorAction Stop
528+
}
529+
530+
$results = $foundPackages | Where-Object -Property Version -Like $searchTerm | Sort-Object Version -Descending
512531

513532
If ($results.Count -eq 0)
514533
{
@@ -564,9 +583,6 @@ Function GetAttributesToExclude
564583
# True when comparing 8.0 GA with 9.0 GA
565584
$IsComparingReleases = ($PreviousDotNetVersion -Ne $CurrentDotNetVersion) -And ($PreviousPreviewOrRC -Eq "ga") -And ($CurrentPreviewOrRC -eq "ga")
566585

567-
$currentDotNetFullName = GetDotNetFullName $IsComparingReleases $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion
568-
569-
570586
## Check folders passed as parameters exist
571587

572588
VerifyPathOrExit $CoreRepo
@@ -635,12 +651,18 @@ RecreateFolder $windowsDesktopTargetFolder
635651

636652
## Run the ApiDiff commands
637653

654+
# Comma separated docIDs of attribute types
638655
$attributesToExclude = GetAttributesToExclude $AttributesToExcludeFilePath
639656

640-
RunApiDiff2 $apiDiffExe $netCoreTargetFolder $netCoreBeforeDllFolder $netCoreAfterDllFolder $currentDotNetFullName $attributesToExclude
641-
RunApiDiff2 $apiDiffExe $aspNetCoreTargetFolder $aspNetCoreBeforeDllFolder $aspNetCoreAfterDllFolder $currentDotNetFullName $attributesToExclude
642-
RunApiDiff2 $apiDiffExe $windowsDesktopTargetFolder $windowsDesktopBeforeDllFolder $windowsDesktopAfterDllFolder $currentDotNetFullName $attributesToExclude
657+
# Example: "10.0-preview2"
658+
$currentDotNetFullName = GetDotNetFullName $IsComparingReleases $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion
643659

660+
# Examples: ".NET 10 Preview 1" and ".NET 10 Preview 2"
661+
$previousDotNetFriendlyName = GetDotNetFriendlyName $PreviousDotNetVersion $PreviousPreviewOrRC $PreviousPreviewNumberVersion
644662
$currentDotNetFriendlyName = GetDotNetFriendlyName $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion
645663

664+
RunApiDiff2 $apiDiffExe $netCoreTargetFolder $netCoreBeforeDllFolder $netCoreAfterDllFolder $currentDotNetFullName $attributesToExclude $previousDotNetFriendlyName $currentDotNetFriendlyName
665+
RunApiDiff2 $apiDiffExe $aspNetCoreTargetFolder $aspNetCoreBeforeDllFolder $aspNetCoreAfterDllFolder $currentDotNetFullName $attributesToExclude $previousDotNetFriendlyName $currentDotNetFriendlyName
666+
RunApiDiff2 $apiDiffExe $windowsDesktopTargetFolder $windowsDesktopBeforeDllFolder $windowsDesktopAfterDllFolder $currentDotNetFullName $attributesToExclude $previousDotNetFriendlyName $currentDotNetFriendlyName
667+
646668
CreateReadme $previewFolderPath $currentDotNetFriendlyName $currentDotNetFullName

0 commit comments

Comments
 (0)