Sync eng/common directory with azure-sdk-tools repository (#48)

This commit is contained in:
Azure SDK Bot 2020-03-27 11:33:06 -07:00 коммит произвёл GitHub
Родитель 5cd2f2778e
Коммит 55fdc3572a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 10 добавлений и 4 удалений

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

@ -2,7 +2,7 @@
# Expects the buildtools to be cloned
parameters:
BaseBranchName: master
BaseBranchName: $(Build.SourceBranch)
PRBranchName: not-specified
PROwner: azure-sdk
CommitMsg: not-specified

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

@ -11,12 +11,12 @@ param (
$Language = $Language.ToLower()
# Regex inspired but simplified from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
$SEMVER_REGEX = "^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-?(?<prelabel>[a-zA-Z-]*)(?:\.?(?<prenumber>0|[1-9]\d*)))?$"
$SEMVER_REGEX = "^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-?(?<prelabel>[a-zA-Z-]*)(?:\.?(?<prenumber>0|[1-9]\d*))?)?$"
function ToSemVer($version){
if ($version -match $SEMVER_REGEX)
{
if($matches['prelabel'] -eq $null) {
if(-not $matches['prelabel']) {
# artifically provide these values for non-prereleases to enable easy sorting of them later than prereleases.
$prelabel = "zzz"
$prenumber = 999;
@ -24,7 +24,13 @@ function ToSemVer($version){
}
else {
$prelabel = $matches["prelabel"]
$prenumber = [int]$matches["prenumber"]
$prenumber = 0
# some older packages don't have a prenumber, should handle this
if($matches["prenumber"]){
$prenumber = [int]$matches["prenumber"]
}
$isPre = $true;
}