File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
server/server/src/main/kotlin/org/jetbrains/bsp/bazel/server/sync/languages/scala Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,13 @@ class ScalaSdkResolver(private val bazelPathsResolver: BazelPathsResolver) {
2828 )
2929 }
3030
31- private fun extractVersion (path : Path ): String? {
31+ private fun extractVersion (path : Path ): String? =
32+ extractVersionFromPath(path) ? : extractVersionFromJar(path)
33+
34+ private fun extractVersionFromPath (path : Path ): String? {
3235 val name = path.fileName.toString()
33- val matcher = VERSION_PATTERN .matcher(name)
34- return if (matcher.matches()) matcher.group(1 ) else extractVersionFromJar(path)
36+ val matcher = PATH_VERSION_PATTERN .matcher(name)
37+ return if (matcher.matches()) matcher.group(1 ) else null
3538 }
3639
3740 private fun extractVersionFromJar (path : Path ): String? {
@@ -64,7 +67,7 @@ class ScalaSdkResolver(private val bazelPathsResolver: BazelPathsResolver) {
6467 .joinToString(" ." )
6568
6669 companion object {
67- private val VERSION_PATTERN =
70+ private val PATH_VERSION_PATTERN =
6871 Pattern .compile(" (?:processed_)?scala3?-(?:library|compiler|reflect)(?:_3)?-([.\\ d]+)\\ .jar" )
6972 private val JAR_VERSION_PATTERN = Pattern .compile(" (\\ d+\\ .\\ d+\\ .\\ d+)" )
7073 }
You can’t perform that action at this time.
0 commit comments