Skip to content

Commit

Permalink
Support v0 versions as prerelease beta versions (Azure#15431)
Browse files Browse the repository at this point in the history
Co-authored-by: Wes Haggard <[email protected]>
  • Loading branch information
2 people authored and vindicatesociety committed Sep 18, 2021
1 parent 56ac512 commit 28b1ce1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
6 changes: 3 additions & 3 deletions eng/common/scripts/Create-APIReview.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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')
Expand All @@ -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
{
Expand Down
29 changes: 17 additions & 12 deletions eng/common/scripts/SemVer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down Expand Up @@ -160,15 +165,15 @@ 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 = ""
$this.DefaultPrereleaseLabel = "b"
$this.DefaultAlphaReleaseLabel = "a"
}

[void] SetupDefaultConventions()
[void] SetupDefaultConventions()
{
# Use the default common conventions
$this.PrereleaseLabelSeparator = "-"
Expand Down Expand Up @@ -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")

Expand All @@ -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
Expand Down

0 comments on commit 28b1ce1

Please sign in to comment.