forked from mamoe/mirai
-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.gradle.kts
84 lines (70 loc) · 3.02 KB
/
settings.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 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
*/
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
mavenCentral()
jcenter()
google()
maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev")
maven(url = "https://dl.bintray.com/jetbrains/kotlin-native-dependencies")
maven(url = "https://kotlin.bintray.com/kotlinx")
}
}
rootProject.name = "mirai"
include(":mirai-core-utils")
include(":mirai-core-api")
include(":mirai-core")
include(":mirai-core-all")
include(":binary-compatibility-validator")
fun includeConsoleProjects() {
val disableOldFrontEnds = true
fun includeConsoleProject(projectPath: String, path: String? = null) {
include(projectPath)
if (path != null) project(projectPath).projectDir = file("mirai-console/$path")
}
includeConsoleProject(":mirai-console-compiler-annotations", "tools/compiler-annotations")
includeConsoleProject(":mirai-console", "backend/mirai-console")
includeConsoleProject(":mirai-console.codegen", "backend/codegen")
includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
includeConsoleProject(":mirai-console-compiler-common", "tools/compiler-common")
includeConsoleProject(":mirai-console-intellij", "tools/intellij-plugin")
includeConsoleProject(":mirai-console-gradle", "tools/gradle-plugin")
@Suppress("ConstantConditionIf")
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: $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")
}
}
}
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()
)
}