fix(sbt): Parse dependency the more precise way (#8353)

This commit is contained in:
Sergei Zharinov 2021-01-20 13:10:20 +04:00 committed by GitHub
parent d0c3be38bf
commit 2d9d64d1bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -33,3 +33,5 @@ resolvers ++= Seq(
resolvers ++= Seq("Repo #5" at "https://example.com/repos/5/") resolvers ++= Seq("Repo #5" at "https://example.com/repos/5/")
addSbtPlugin("org.example" % "waldo" % "0.0.9") addSbtPlugin("org.example" % "waldo" % "0.0.9")
libraryDependencies += "org.example" % "fred" % "(,8.4.0]"

View file

@ -239,6 +239,20 @@ Object {
"https://dl.bintray.com/sbt/sbt-plugin-releases", "https://dl.bintray.com/sbt/sbt-plugin-releases",
], ],
}, },
Object {
"currentValue": "(,8.4.0]",
"datasource": "sbt-package",
"depName": "org.example:fred",
"lookupName": "org.example:fred",
"registryUrls": Array [
"https://repo.maven.apache.org/maven2",
"https://example.com/repos/1/",
"https://example.com/repos/2/",
"https://example.com/repos/3/",
"https://example.com/repos/4/",
"https://example.com/repos/5/",
],
},
], ],
"packageFileVersion": "1.0", "packageFileVersion": "1.0",
} }

View file

@ -125,7 +125,9 @@ function parseDepExpr(
const tokens = expr const tokens = expr
.trim() .trim()
.replace(/[()]/g, '') .split(/("[^"]*")/g)
.map((x) => (/"[^"]*"/.test(x) ? x : x.replace(/[()]+/g, '')))
.join('')
.split(/\s*(%%?)\s*|\s*classifier\s*/); .split(/\s*(%%?)\s*|\s*classifier\s*/);
const [ const [