|
|
@@ -1,8 +1,8 @@
|
|
|
pluginManagement {
|
|
|
repositories {
|
|
|
- maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
|
|
|
- maven(url = "https://mirrors.huaweicloud.com/repository/maven")
|
|
|
+ mavenLocal()
|
|
|
jcenter()
|
|
|
+ maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
|
|
|
mavenCentral()
|
|
|
}
|
|
|
|
|
|
@@ -11,6 +11,8 @@ pluginManagement {
|
|
|
val version = requested.version
|
|
|
when (requested.id.id) {
|
|
|
"org.jetbrains.kotlin.jvm" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${version}")
|
|
|
+ "org.jetbrains.kotlin.plugin.serialization" -> useModule("org.jetbrains.kotlin:kotlin-serialization:${version}")
|
|
|
+ "com.jfrog.bintray" -> useModule("com.jfrog.bintray.gradle:gradle-bintray-plugin:$version")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -18,50 +20,34 @@ pluginManagement {
|
|
|
|
|
|
rootProject.name = "mirai-console"
|
|
|
|
|
|
-val onlyBackEnd = true
|
|
|
+val disableOldFrontEnds = true
|
|
|
|
|
|
-include(":mirai-console")
|
|
|
-project(":mirai-console").projectDir = file("backend/mirai-console")
|
|
|
+fun includeProject(projectPath: String, path: String? = null) {
|
|
|
+ include(projectPath)
|
|
|
+ if (path != null) project(projectPath).projectDir = file(path)
|
|
|
+}
|
|
|
|
|
|
-include(":codegen")
|
|
|
-project(":codegen").projectDir = file("backend/codegen")
|
|
|
+includeProject(":mirai-console", "backend/mirai-console")
|
|
|
+includeProject(":codegen", "backend/codegen")
|
|
|
+includeProject(":mirai-console-pure", "frontend/mirai-console-pure")
|
|
|
|
|
|
@Suppress("ConstantConditionIf")
|
|
|
-if (!onlyBackEnd) {
|
|
|
-
|
|
|
- include(":mirai-console-pure")
|
|
|
- project(":mirai-console-pure").projectDir = file("frontend/mirai-console-pure")
|
|
|
-
|
|
|
- include(":mirai-console-terminal")
|
|
|
- project(":mirai-console-terminal").projectDir = file("frontend/mirai-console-terminal")
|
|
|
+if (!disableOldFrontEnds) {
|
|
|
+ includeProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
|
|
|
|
|
|
- try {
|
|
|
- val javaVersion = System.getProperty("java.version")
|
|
|
- var versionPos = javaVersion.indexOf(".")
|
|
|
- var javaVersionNum = javaVersion.substring(0, 1).toInt()
|
|
|
-
|
|
|
- if (javaVersion.startsWith("1.")) {
|
|
|
- javaVersionNum = javaVersion.substring(2, 3).toInt()
|
|
|
- } else {
|
|
|
- if (versionPos == -1) versionPos = javaVersion.indexOf("-")
|
|
|
- if (versionPos == -1) {
|
|
|
- println("jdk version unknown")
|
|
|
- } else {
|
|
|
- javaVersionNum = javaVersion.substring(0, versionPos).toInt()
|
|
|
- }
|
|
|
- }
|
|
|
- if (javaVersionNum >= 9) {
|
|
|
- include(":mirai-console-graphical")
|
|
|
- project(":mirai-console-graphical").projectDir = file("frontend/mirai-console-graphical")
|
|
|
- } else {
|
|
|
- println("JDK 版本为 $javaVersionNum")
|
|
|
- println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 请使用JDK 9以上版本引入模块 `:mirai-console-graphical`\n")
|
|
|
+ val jdkVersion = kotlin.runCatching {
|
|
|
+ System.getProperty("java.version").let { v ->
|
|
|
+ v.toIntOrNull() ?: v.removePrefix("1.").substringBefore("-").toIntOrNull()
|
|
|
}
|
|
|
+ }.getOrNull() ?: -1
|
|
|
|
|
|
- } catch (ignored: Exception) {
|
|
|
- println("无法确定 JDK 版本, 将不会引入 `:mirai-console-graphical`")
|
|
|
+ println("JDK version: $jdkVersion")
|
|
|
+
|
|
|
+ if (jdkVersion >= 9) {
|
|
|
+ includeProject(":mirai-console-graphical", "frontend/mirai-console-graphical")
|
|
|
+ } else {
|
|
|
+ println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 请使用 JDK 9 以上版本引入模块 `:mirai-console-graphical`\n")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
enableFeaturePreview("GRADLE_METADATA")
|