[Gradle, JS] Add includedRange with version only
This commit is contained in:
+9
@@ -19,6 +19,15 @@ fun versionToNpmRanges(version: String): Set<NpmRange> {
|
||||
.visit(parser.rangeSet())!!
|
||||
}
|
||||
|
||||
fun includedRange(
|
||||
includedVersion: String,
|
||||
includedWithCaret: Boolean = false
|
||||
): NpmRange =
|
||||
includedRange(
|
||||
listOf(includedVersion),
|
||||
includedWithCaret
|
||||
)
|
||||
|
||||
fun includedRange(
|
||||
includedVersions: List<String>,
|
||||
includedWithCaret: Boolean = false
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ private fun chooseVersion(
|
||||
return newVersion
|
||||
}
|
||||
|
||||
return (includedRange(listOf(oldVersion)) intersect includedRange(listOf(newVersion)))?.toString()
|
||||
return (includedRange(oldVersion) intersect includedRange(newVersion))?.toString()
|
||||
?: throw GradleException(
|
||||
"""
|
||||
There is already declared version of '$module' with version '$oldVersion' which does not intersects with another declared version '${newVersion}'
|
||||
|
||||
+1
-3
@@ -24,14 +24,12 @@ internal class YarnEntryRegistry(private val lockFile: File) {
|
||||
return entry
|
||||
}
|
||||
|
||||
val versionRange = includedRange(listOf(version))
|
||||
|
||||
entryMap.entries
|
||||
.firstOrNull { (_, entry) ->
|
||||
if (entry.version == null) {
|
||||
false
|
||||
} else {
|
||||
(versionRange intersect includedRange(listOf(entry.version))) != null
|
||||
(includedRange(version) intersect includedRange(entry.version)) != null
|
||||
}
|
||||
}
|
||||
?.let { return it.value }
|
||||
|
||||
Reference in New Issue
Block a user