settings.gradle.kts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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(":binary-compatibility-validator-android")
  29. project(":binary-compatibility-validator-android").projectDir = file("binary-compatibility-validator/android")
  30. include(":ci-release-helper")
  31. fun includeConsoleProjects() {
  32. val disableOldFrontEnds = true
  33. fun includeConsoleProject(projectPath: String, path: String? = null) {
  34. include(projectPath)
  35. if (path != null) project(projectPath).projectDir = file("mirai-console/$path")
  36. }
  37. includeConsoleProject(":mirai-console-compiler-annotations", "tools/compiler-annotations")
  38. includeConsoleProject(":mirai-console", "backend/mirai-console")
  39. includeConsoleProject(":mirai-console.codegen", "backend/codegen")
  40. includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
  41. includeConsoleProject(":mirai-console-compiler-common", "tools/compiler-common")
  42. includeConsoleProject(":mirai-console-intellij", "tools/intellij-plugin")
  43. includeConsoleProject(":mirai-console-gradle", "tools/gradle-plugin")
  44. @Suppress("ConstantConditionIf")
  45. if (!disableOldFrontEnds) {
  46. includeConsoleProject(":mirai-console-terminal", "frontend/mirai-console-terminal")
  47. val jdkVersion = kotlin.runCatching {
  48. System.getProperty("java.version").let { v ->
  49. v.toIntOrNull() ?: v.removePrefix("1.").substringBefore("-").toIntOrNull()
  50. }
  51. }.getOrNull() ?: -1
  52. println("JDK version: $jdkVersion")
  53. if (jdkVersion >= 9) {
  54. includeConsoleProject(":mirai-console-graphical", "frontend/mirai-console-graphical")
  55. } else {
  56. println("当前使用的 JDK 版本为 ${System.getProperty("java.version")}, 请使用 JDK 9 以上版本引入模块 `:mirai-console-graphical`\n")
  57. }
  58. }
  59. }
  60. fun isMiraiConsoleCloned(): Boolean {
  61. return file("mirai-console/build.gradle.kts").exists()
  62. }
  63. if (isMiraiConsoleCloned()) {
  64. includeConsoleProjects()
  65. } else {
  66. logger.warn(
  67. """
  68. [mirai] mirai-console submodule is not configured.
  69. Please execute `git submodule init` and `git submodule update` to include mirai-console build if you want.
  70. If you develop only on mirai-core, it's not compulsory to include mirai-console.
  71. """.trimIndent()
  72. )
  73. }