From 23156429aa518cbbe07f8fcee6456beb342bbd44 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Thu, 2 Sep 2021 08:58:46 -0700 Subject: [PATCH] Support v0 versions as prerelease beta versions (#1972) --- eng/common/scripts/Create-APIReview.ps1 | 6 ++--- eng/common/scripts/SemVer.ps1 | 29 +++++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/eng/common/scripts/Create-APIReview.ps1 b/eng/common/scripts/Create-APIReview.ps1 index 5f1b0b32006..e4a4d2a83dd 100644 --- a/eng/common/scripts/Create-APIReview.ps1 +++ b/eng/common/scripts/Create-APIReview.ps1 @@ -128,7 +128,7 @@ if ($packages) { Write-Host "API review is in approved status." } - elseif ($version.IsPrerelease -or ($version.Major -eq 0)) + elseif ($version.IsPrerelease) { # Ignore API review status for prerelease version Write-Host "Package version is not GA. Ignoring API view approval status" @@ -141,7 +141,7 @@ if ($packages) { # Return error code if status code is 201 for new data plane package # Temporarily enable API review for spring SDK types. Ideally this should be done be using 'IsReviewRequired' method in language side - # to override default check of SDK type client + # to override default check of SDK type client if (($pkgInfo.SdkType -eq "client" -or $pkgInfo.SdkType -eq "spring") -and $pkgInfo.IsNewSdk) { if ($respCode -eq '201') @@ -161,7 +161,7 @@ if ($packages) { Write-Host "API review is not approved for package $($PackageName), however it is not required for this package type so it can still be released without API review approval." } - } + } } else { diff --git a/eng/common/scripts/SemVer.ps1 b/eng/common/scripts/SemVer.ps1 index 10c35e82537..b3ca5353274 100644 --- a/eng/common/scripts/SemVer.ps1 +++ b/eng/common/scripts/SemVer.ps1 @@ -76,14 +76,19 @@ class AzureEngSemanticVersion : IComparable { $this.SetupDefaultConventions() } - if ($null -eq $matches['prelabel']) + if ($null -eq $matches['prelabel']) { # artifically provide these values for non-prereleases to enable easy sorting of them later than prereleases. $this.PrereleaseLabel = "zzz" $this.PrereleaseNumber = 99999999 $this.IsPrerelease = $false $this.VersionType = "GA" - if ($this.Patch -ne 0) { + if ($this.Major -eq 0) { + # Treat initial 0 versions as a prerelease beta's + $this.VersionType = "Beta" + $this.IsPrerelease = $true + } + elseif ($this.Patch -ne 0) { $this.VersionType = "Patch" } } @@ -160,7 +165,7 @@ class AzureEngSemanticVersion : IComparable { } } - [void] SetupPythonConventions() + [void] SetupPythonConventions() { # Python uses no separators and "b" for beta so this sets up the the object to work with those conventions $this.PrereleaseLabelSeparator = $this.PrereleaseNumberSeparator = $this.BuildNumberSeparator = "" @@ -168,7 +173,7 @@ class AzureEngSemanticVersion : IComparable { $this.DefaultAlphaReleaseLabel = "a" } - [void] SetupDefaultConventions() + [void] SetupDefaultConventions() { # Use the default common conventions $this.PrereleaseLabelSeparator = "-" @@ -219,20 +224,20 @@ class AzureEngSemanticVersion : IComparable { { $global:Language = "" $versions = @( - "1.0.1", - "2.0.0", + "1.0.1", + "2.0.0", "2.0.0-alpha.20200920", "2.0.0-alpha.20200920.1", - "2.0.0-beta.2", - "1.0.10", + "2.0.0-beta.2", + "1.0.10", "2.0.0-alpha.20201221.03", "2.0.0-alpha.20201221.1", "2.0.0-alpha.20201221.5", "2.0.0-alpha.20201221.2", "2.0.0-alpha.20201221.10", - "2.0.0-beta.1", - "2.0.0-beta.10", - "1.0.0", + "2.0.0-beta.1", + "2.0.0-beta.10", + "1.0.0", "1.0.0b2", "1.0.2") @@ -258,7 +263,7 @@ class AzureEngSemanticVersion : IComparable { for ($i = 0; $i -lt $expectedSort.Count; $i++) { - if ($sort[$i] -ne $expectedSort[$i]) { + if ($sort[$i] -ne $expectedSort[$i]) { Write-Host "Error: Incorrect version sort:" Write-Host "Expected: " Write-Host $expectedSort