2
0

settings.gradle.kts 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright 2019-2021 Mamoe Technologies and contributors.
  3. *
  4. * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
  5. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
  6. *
  7. * https://github.com/mamoe/mirai/blob/master/LICENSE
  8. */
  9. pluginManagement {
  10. repositories {
  11. mavenLocal()
  12. gradlePluginPortal()
  13. mavenCentral()
  14. jcenter()
  15. google()
  16. maven(url = "https://dl.bintray.com/kotlin/kotlin-eap")
  17. maven(url = "https://dl.bintray.com/kotlin/kotlin-dev")
  18. maven(url = "https://dl.bintray.com/jetbrains/kotlin-native-dependencies")
  19. maven(url = "https://kotlin.bintray.com/kotlinx")
  20. }
  21. }
  22. rootProject.name = "mirai"
  23. include(":mirai-core-utils")
  24. include(":mirai-core-api")
  25. include(":mirai-core")
  26. include(":mirai-core-all")
  27. include(":binary-compatibility-validator")
  28. include(":ci-release-helper")
  29. fun includeConsoleProjects() {
  30. val disableOldFrontEnds = true
  31. fun includeConsoleProject(projectPath: String, path: String? = null) {
  32. include(projectPath)
  33. if (path != null) project(projectPath).projectDir = file("mirai-console/$path")
  34. }
  35. includeConsoleProject(":mirai-console-compiler-annotations", "tools/compiler-annotations")
  36. includeConsoleProject(":mirai-console", "backend/mirai-console")
  37. includeConsoleProject(":mirai-console.codegen", "backend/codegen")
  38. includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
  39. includeConsoleProject(":mirai-console-compiler-common", "tools/compiler-common")
  40. includeConsoleProject(":mirai-console-intellij", "tools/intellij-plugin")
  41. includeConsoleProject(":mirai-console-gradle", "tools/gradle-plugin")
  42. @Suppress("ConstantConditionIf")
  43. if (!disableOldFrontEnds) {
  44. includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
  45. val jdkVersion = kotlin.runCatching {
  46. System.getProperty("java.version").let { v ->
  47. v.toIntOrNull() ?: v.removePrefix("1.").substringBefore("-").toIntOrNull()
  48. }
  49. }.getOrNull() ?: -1
  50. println("JDK version: $jdkVersion")
  51. if (jdkVersion >= 9) {
  52. includeConsoleProject(":mirai-console-graphical", "frontend/mirai-console-graphical")
  53. } else {
  54. println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 请使用 JDK 9 以上版本引入模块 `:mirai-console-graphical`\n")
  55. }
  56. }
  57. }
  58. fun isMiraiConsoleCloned(): Boolean {
  59. return file("mirai-console/build.gradle.kts").exists()
  60. }
  61. if (isMiraiConsoleCloned()) {
  62. includeConsoleProjects()
  63. } else {
  64. logger.warn(
  65. """
  66. [mirai] mirai-console submodule is not configured.
  67. Please execute `git submodule init` and `git submodule update --remote` to include mirai-console build if you want.
  68. If you develop only on mirai-core, it's not compulsory to include mirai-console.
  69. """.trimIndent()
  70. )
  71. }