Skip to content

Commit

Permalink
Use Gradle JavaVersion API
Browse files Browse the repository at this point in the history
  • Loading branch information
blindpirate authored and Him188 committed Apr 7, 2021
1 parent 770615f commit aacdf0d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,9 @@ fun includeConsoleProjects() {
if (!disableOldFrontEnds) {
includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")

val jdkVersion = kotlin.runCatching {
System.getProperty("java.version").let { v ->
v.toIntOrNull() ?: v.removePrefix("1.").substringBefore("-").toIntOrNull()
}
}.getOrNull() ?: -1
println("JDK version: ${JavaVersion.current()}")

println("JDK version: $jdkVersion")

if (jdkVersion >= 9) {
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
includeConsoleProject(":mirai-console-graphical", "frontend/mirai-console-graphical")
} else {
println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 请使用 JDK 9 以上版本引入模块 `:mirai-console-graphical`\n")
Expand Down

0 comments on commit aacdf0d

Please sign in to comment.