RunApiDiff.ps1: Fix bug setting wrong filenames and foldernames when comparing preview1 and previous version (#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
This commit is contained in:
Carlos Sánchez López 2024-02-22 10:20:46 -06:00 коммит произвёл GitHub
Родитель f59666ee01
Коммит f424bc4f5d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 13 добавлений и 11 удалений

Просмотреть файл

@ -170,7 +170,7 @@ Function GetDotNetFullName
Param (
[Parameter(Mandatory=$true)]
[bool]
$areVersionsEqual
$IsComparingReleases
,
[Parameter(Mandatory=$true)]
[ValidatePattern("\d+\.\d")]
@ -188,7 +188,7 @@ Function GetDotNetFullName
$previewNumberVersion # 0, 1, 2, 3, ...
)
If (-Not $areVersionsEqual)
If ($IsComparingReleases)
{
Return "$dotNetVersion.$previewNumberVersion"
}
@ -313,18 +313,19 @@ Function GetPreviewFolderPath
,
[Parameter(Mandatory=$true)]
[bool]
$areVersionsEqual
$IsComparingReleases # True when comparing 8.0 GA with 9.0 GA
)
$prefixFolder = [IO.Path]::Combine($rootFolder, "release-notes", $dotNetVersion)
$apiDiffFolderName = "api-diff"
If ($areVersionsEqual)
If ($IsComparingReleases)
{
$previewOrRCFolderName = GetPreviewOrRCFolderName $dotNetVersion $previewOrRC $previewNumberVersion
Return [IO.Path]::Combine($prefixFolder, "preview", $apiDiffFolderName, $previewOrRCFolderName)
Return [IO.Path]::Combine($prefixFolder, "$dotNetVersion.$previewNumberVersion", $apiDiffFolderName)
}
Return [IO.Path]::Combine($prefixFolder, "$dotNetVersion.$previewNumberVersion", $apiDiffFolderName)
$previewOrRCFolderName = GetPreviewOrRCFolderName $dotNetVersion $previewOrRC $previewNumberVersion
Return [IO.Path]::Combine($prefixFolder, "preview", $previewOrRCFolderName, $apiDiffFolderName)
}
Function RunAsmDiff
@ -564,10 +565,11 @@ Function DownloadPackage
## Generate strings with no whitespace
$areVersionsEqual = $PreviousDotNetVersion -eq $CurrentDotNetVersion
# True when comparing 8.0 GA with 9.0 GA
$IsComparingReleases = ($PreviousDotNetVersion -Ne $CurrentDotNetVersion) -And ($PreviousPreviewOrRC -Eq "ga") -And ($CurrentPreviewOrRC -eq "ga")
$previousDotNetFullName = GetDotNetFullName $areVersionsEqual $PreviousDotNetVersion $PreviousPreviewOrRC $PreviousPreviewNumberVersion
$currentDotNetFullName = GetDotNetFullName $areVersionsEqual $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion
$previousDotNetFullName = GetDotNetFullName $IsComparingReleases $PreviousDotNetVersion $PreviousPreviewOrRC $PreviousPreviewNumberVersion
$currentDotNetFullName = GetDotNetFullName $IsComparingReleases $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion
## Check folders passed as parameters exist
@ -616,7 +618,7 @@ ReBuildIfExeNotFound $asmDiffExe $asmDiffProjectPath $asmDiffArtifactsPath
## Recreate api-diff folder in core repo folder
$previewFolderPath = GetPreviewFolderPath $CoreRepo $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion $areVersionsEqual
$previewFolderPath = GetPreviewFolderPath $CoreRepo $CurrentDotNetVersion $CurrentPreviewOrRC $CurrentPreviewNumberVersion $IsComparingReleases
Write-Color cyan "Checking existing diff folder: $previewFolderPath"
RecreateFolder $previewFolderPath