2020-11-01 15:07:32 +08:00
|
|
|
/*
|
2021-01-21 14:16:03 +08:00
|
|
|
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
2020-11-01 15:07:32 +08:00
|
|
|
*
|
|
|
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
|
|
|
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
|
|
|
*
|
|
|
|
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
|
|
|
*/
|
|
|
|
|
2020-10-03 12:42:13 +08:00
|
|
|
pluginManagement {
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
gradlePluginPortal()
|
|
|
|
mavenCentral()
|
|
|
|
jcenter()
|
|
|
|
google()
|
2020-12-25 18:49:34 +08:00
|
|
|
maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
|
|
|
|
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev")
|
2020-10-03 12:42:13 +08:00
|
|
|
maven(url = "https://dl.bintray.com/jetbrains/kotlin-native-dependencies")
|
|
|
|
maven(url = "https://kotlin.bintray.com/kotlinx")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rootProject.name = "mirai"
|
|
|
|
|
2020-12-02 09:25:25 +08:00
|
|
|
include(":mirai-core-utils")
|
2020-10-03 12:42:13 +08:00
|
|
|
include(":mirai-core-api")
|
|
|
|
include(":mirai-core")
|
2021-01-21 14:16:03 +08:00
|
|
|
include(":mirai-core-all")
|
|
|
|
|
2021-01-28 09:32:23 +08:00
|
|
|
include(":binary-compatibility-validator")
|
|
|
|
|
|
|
|
|
2021-01-28 09:46:57 +08:00
|
|
|
fun includeConsoleProjects() {
|
|
|
|
val disableOldFrontEnds = true
|
2021-01-28 09:32:23 +08:00
|
|
|
|
2021-01-28 09:46:57 +08:00
|
|
|
fun includeConsoleProject(projectPath: String, path: String? = null) {
|
|
|
|
include(projectPath)
|
|
|
|
if (path != null) project(projectPath).projectDir = file("mirai-console/$path")
|
|
|
|
}
|
2021-01-28 09:32:23 +08:00
|
|
|
|
2021-01-28 09:46:57 +08:00
|
|
|
includeConsoleProject(":mirai-console", "backend/mirai-console")
|
|
|
|
includeConsoleProject(":mirai-console.codegen", "backend/codegen")
|
2021-01-28 09:32:23 +08:00
|
|
|
includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
|
2021-01-28 09:46:57 +08:00
|
|
|
includeConsoleProject(":mirai-console-compiler-common", "tools/compiler-common")
|
|
|
|
includeConsoleProject(":mirai-console-intellij", "tools/intellij-plugin")
|
|
|
|
includeConsoleProject(":mirai-console-gradle", "tools/gradle-plugin")
|
2021-01-28 09:32:23 +08:00
|
|
|
|
2021-01-28 09:46:57 +08:00
|
|
|
@Suppress("ConstantConditionIf")
|
|
|
|
if (!disableOldFrontEnds) {
|
|
|
|
includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
|
2021-01-28 09:32:23 +08:00
|
|
|
|
2021-01-28 09:46:57 +08:00
|
|
|
val jdkVersion = kotlin.runCatching {
|
|
|
|
System.getProperty("java.version").let { v ->
|
|
|
|
v.toIntOrNull() ?: v.removePrefix("1.").substringBefore("-").toIntOrNull()
|
|
|
|
}
|
|
|
|
}.getOrNull() ?: -1
|
2021-01-28 09:32:23 +08:00
|
|
|
|
2021-01-28 09:46:57 +08:00
|
|
|
println("JDK version: $jdkVersion")
|
|
|
|
|
|
|
|
if (jdkVersion >= 9) {
|
|
|
|
includeConsoleProject(":mirai-console-graphical", "frontend/mirai-console-graphical")
|
|
|
|
} else {
|
|
|
|
println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 请使用 JDK 9 以上版本引入模块 `:mirai-console-graphical`\n")
|
|
|
|
}
|
2021-01-28 09:32:23 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-28 09:46:57 +08:00
|
|
|
fun isMiraiConsoleCloned(): Boolean {
|
|
|
|
return file("mirai-console/build.gradle.kts").exists()
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isMiraiConsoleCloned()) {
|
|
|
|
includeConsoleProjects()
|
|
|
|
} else {
|
|
|
|
logger.warn(
|
|
|
|
"""
|
|
|
|
[mirai] mirai-console submodule is not configured.
|
|
|
|
Please execute `git submodule init` and `git submodule update --remote` to include mirai-console build if you want.
|
|
|
|
If you develop only on mirai-core, it's not compulsory to include mirai-console.
|
|
|
|
""".trimIndent()
|
|
|
|
)
|
|
|
|
}
|