include prerelease in version matching
This commit is contained in:
34
package-lock.json
generated
34
package-lock.json
generated
@@ -22,7 +22,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.15.0",
|
||||
"@types/q": "^1.5.5",
|
||||
"@types/semver-compare": "^1.0.1",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"minimist": "^1.2.8",
|
||||
"prettier": "^2.8.4",
|
||||
@@ -286,14 +286,9 @@
|
||||
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA=="
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
|
||||
"integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
|
||||
},
|
||||
"node_modules/@types/semver-compare": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver-compare/-/semver-compare-1.0.1.tgz",
|
||||
"integrity": "sha512-wx2LQVvKlEkhXp/HoKIZ/aSL+TvfJdKco8i0xJS3aR877mg4qBHzNT6+B5a61vewZHo79EdZavskGnRXEC2H6A==",
|
||||
"version": "7.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
|
||||
"integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
@@ -684,6 +679,11 @@
|
||||
"uuid": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/azure-pipelines-tool-lib/node_modules/@types/semver": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
|
||||
"integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
|
||||
},
|
||||
"node_modules/azure-pipelines-tool-lib/node_modules/@types/uuid": {
|
||||
"version": "3.4.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz",
|
||||
@@ -3977,14 +3977,9 @@
|
||||
"integrity": "sha512-0/HnwIfW4ki2D8L8c9GVcG5I72s9jP5GSLVF0VIXDW00kmIpA6O33G7a8n59Tmh7Nz0WUC3rSb7PTY/sdW2JzA=="
|
||||
},
|
||||
"@types/semver": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
|
||||
"integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
|
||||
},
|
||||
"@types/semver-compare": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver-compare/-/semver-compare-1.0.1.tgz",
|
||||
"integrity": "sha512-wx2LQVvKlEkhXp/HoKIZ/aSL+TvfJdKco8i0xJS3aR877mg4qBHzNT6+B5a61vewZHo79EdZavskGnRXEC2H6A==",
|
||||
"version": "7.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
|
||||
"integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/uuid": {
|
||||
@@ -4333,6 +4328,11 @@
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/semver": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
|
||||
"integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ=="
|
||||
},
|
||||
"@types/uuid": {
|
||||
"version": "3.4.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.9.tgz",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.15.0",
|
||||
"@types/q": "^1.5.5",
|
||||
"@types/semver-compare": "^1.0.1",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"minimist": "^1.2.8",
|
||||
"prettier": "^2.8.4",
|
||||
|
||||
@@ -169,7 +169,7 @@ export class DotnetTool implements IDotnetTool {
|
||||
|
||||
this.buildAgent.debug(`got versions: ${versions.join(', ')}`)
|
||||
|
||||
return this.versionManager.evaluateVersions(versions, versionSpec)
|
||||
return this.versionManager.evaluateVersions(versions, versionSpec, { includePrerelease })
|
||||
}
|
||||
|
||||
private async acquireTool(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import cmp from 'semver-compare'
|
||||
import * as semver from 'semver'
|
||||
import { injectable, inject } from 'inversify'
|
||||
|
||||
@@ -6,7 +5,7 @@ import { IBuildAgent, TYPES } from './models'
|
||||
|
||||
export interface IVersionManager {
|
||||
isExplicitVersion(versionSpec: string): boolean
|
||||
evaluateVersions(versions: string[], versionSpec: string): string
|
||||
evaluateVersions(versions: string[], versionSpec: string, optionsOrLoose?: boolean | semver.RangeOptions): string
|
||||
cleanVersion(version: string): string
|
||||
}
|
||||
|
||||
@@ -27,13 +26,13 @@ export class VersionManager implements IVersionManager {
|
||||
return valid
|
||||
}
|
||||
|
||||
public evaluateVersions(versions: string[], versionSpec: string): string {
|
||||
public evaluateVersions(versions: string[], versionSpec: string, optionsOrLoose?: boolean | semver.RangeOptions): string {
|
||||
let version: string
|
||||
this.buildAgent.debug('evaluating ' + versions.length + ' versions')
|
||||
versions = versions.sort(cmp)
|
||||
versions = semver.sort(versions)
|
||||
for (let i = versions.length - 1; i >= 0; i--) {
|
||||
const potential: string = versions[i]
|
||||
const satisfied: boolean = semver.satisfies(potential, versionSpec)
|
||||
const satisfied: boolean = semver.satisfies(potential, versionSpec, optionsOrLoose)
|
||||
if (satisfied) {
|
||||
version = potential
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user