Skip to content

Commit f424bc4

Browse files
authored
RunApiDiff.ps1: Fix bug setting wrong filenames and foldernames when comparing preview1 and previous version (dotnet#9177)
* Fix bug causing the incorrect creation of the subfolder for preview1 when comparing with the previous release. * Also fix it for the readme files. * Invert target folders to match the preview one first
1 parent f59666e commit f424bc4

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

release-notes/RunApiDiff.ps1

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Function GetDotNetFullName
170170
Param (
171171
[Parameter(Mandatory=$true)]
172172
[bool]
173-
$areVersionsEqual
173+
$IsComparingReleases
174174
,
175175
[Parameter(Mandatory=$true)]
176176
[ValidatePattern("\d+\.\d")]
@@ -188,7 +188,7 @@ Function GetDotNetFullName
188188
$previewNumberVersion # 0, 1, 2, 3, ...
189189
)
190190

191-
If (-Not $areVersionsEqual)
191+
If ($IsComparingReleases)
192192
{
193193
Return "$dotNetVersion.$previewNumberVersion"
194194
}
@@ -313,18 +313,19 @@ Function GetPreviewFolderPath
313313
,
314314
[Parameter(Mandatory=$true)]
315315
[bool]
316-
$areVersionsEqual
316+
$IsComparingReleases # True when comparing 8.0 GA with 9.0 GA
317317
)
318318

319319
$prefixFolder = [IO.Path]::Combine($rootFolder, "release-notes", $dotNetVersion)
320320
$apiDiffFolderName = "api-diff"
321-
If ($areVersionsEqual)
321+
322+
If ($IsComparingReleases)
322323
{
323-
$previewOrRCFolderName = GetPreviewOrRCFolderName $dotNetVersion $previewOrRC $previewNumberVersion
324-
Return [IO.Path]::Combine($prefixFolder, "preview", $apiDiffFolderName, $previewOrRCFolderName)
324+
Return [IO.Path]::Combine($prefixFolder, "$dotNetVersion.$previewNumberVersion", $apiDiffFolderName)
325325
}
326326

327-
Return [IO.Path]::Combine($prefixFolder, "$dotNetVersion.$previewNumberVersion", $apiDiffFolderName)
327+
$previewOrRCFolderName = GetPreviewOrRCFolderName $dotNetVersion $previewOrRC $previewNumberVersion
328+
Return [IO.Path]::Combine($prefixFolder, "preview", $previewOrRCFolderName, $apiDiffFolderName)
328329
}
329330

330331
Function RunAsmDiff
@@ -564,10 +565,11 @@ Function DownloadPackage
564565

565566
## Generate strings with no whitespace
566567

567-
$areVersionsEqual = $PreviousDotNetVersion -eq $CurrentDotNetVersion
568+
# True when comparing 8.0 GA with 9.0 GA
569+
$IsComparingReleases = ($PreviousDotNetVersion -Ne $CurrentDotNetVersion) -And ($PreviousPreviewOrRC -Eq "ga") -And ($CurrentPreviewOrRC -eq "ga")
568570

569-
$previousDotNetFullName = GetDotNetFullName $areVersionsEqual $PreviousDotNetVersion $PreviousPreviewOrRC $PreviousPreviewNumberVersion
570-
$currentDotNetFullName = GetDotNetFullName $areVersionsEqual $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion
571+
$previousDotNetFullName = GetDotNetFullName $IsComparingReleases $PreviousDotNetVersion $PreviousPreviewOrRC $PreviousPreviewNumberVersion
572+
$currentDotNetFullName = GetDotNetFullName $IsComparingReleases $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion
571573

572574

573575
## Check folders passed as parameters exist
@@ -616,7 +618,7 @@ ReBuildIfExeNotFound $asmDiffExe $asmDiffProjectPath $asmDiffArtifactsPath
616618

617619
## Recreate api-diff folder in core repo folder
618620

619-
$previewFolderPath = GetPreviewFolderPath $CoreRepo $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion $areVersionsEqual
621+
$previewFolderPath = GetPreviewFolderPath $CoreRepo $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion $IsComparingReleases
620622
Write-Color cyan "Checking existing diff folder: $previewFolderPath"
621623
RecreateFolder $previewFolderPath
622624

0 commit comments

Comments
 (0)