Fix file detecting

This commit is contained in:
Him188 2020-04-02 22:50:01 +08:00 committed by GitHub
parent f70ad5191b
commit 0c905f8cd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,7 @@ fun Project.findLatestFile(): Map.Entry<String, File>? {
return File(projectDir, "build/libs").walk()
.filter { it.isFile }
.onEach { println("all files=$it") }
.filter { it.name.matches(Regex("""${project.name}-([0-9]|\.)*\.jar""")) }
.filter { it.name.matches(Regex("""${project.name}-([0-9]|\.)*-all\.jar""")) }
.onEach { println("matched file: ${it.name}") }
.associateBy { it.nameWithoutExtension.substringAfterLast('-') }
.onEach { println("versions: $it") }
@ -100,4 +100,4 @@ fun Project.findLatestFile(): Map.Entry<String, File>? {
acc + 100.0.pow(2 - index).toInt() * (s.toIntOrNull() ?: 0)
}
}
}
}