build.gradle.kts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. @file:Suppress("UnusedImport")
  10. plugins {
  11. kotlin("jvm")
  12. id("java")
  13. `maven-publish`
  14. id("org.jetbrains.intellij") version Versions.intellijGradlePlugin
  15. }
  16. repositories {
  17. maven("https://maven.aliyun.com/repository/public")
  18. }
  19. version = Versions.console
  20. description = "IntelliJ plugin for Mirai Console"
  21. // See https://github.com/JetBrains/gradle-intellij-plugin/
  22. intellij {
  23. version.set(Versions.intellij)
  24. downloadSources.set(true)
  25. updateSinceUntilBuild.set(false)
  26. sandboxDir.set(projectDir.resolve("run/idea-sandbox").absolutePath)
  27. plugins.set(
  28. listOf(
  29. // "org.jetbrains.kotlin:${Versions.kotlinIntellijPlugin}", // @eap
  30. "java",
  31. "gradle",
  32. "org.jetbrains.kotlin"
  33. )
  34. )
  35. }
  36. afterEvaluate {
  37. java {
  38. sourceCompatibility = JavaVersion.VERSION_11
  39. targetCompatibility = JavaVersion.VERSION_11
  40. }
  41. }
  42. tasks.getByName("publishPlugin", org.jetbrains.intellij.tasks.PublishPluginTask::class) {
  43. val pluginKey = project.findProperty("jetbrains.hub.key")?.toString()
  44. if (pluginKey != null) {
  45. logger.info("Found jetbrains.hub.key")
  46. token.set(pluginKey)
  47. } else {
  48. logger.info("jetbrains.hub.key not found")
  49. }
  50. }
  51. fun File.resolveMkdir(relative: String): File {
  52. return this.resolve(relative).apply { mkdirs() }
  53. }
  54. kotlin.target.compilations.all {
  55. kotlinOptions {
  56. jvmTarget = "11"
  57. }
  58. }
  59. tasks.withType<org.jetbrains.intellij.tasks.PatchPluginXmlTask> {
  60. sinceBuild.set("201.*")
  61. untilBuild.set("215.*")
  62. pluginDescription.set(
  63. """
  64. Plugin development support for <a href='https://github.com/mamoe/mirai'>Mirai Console</a>
  65. <h3>Features</h3>
  66. <ul>
  67. <li>Inspections for plugin properties.</li>
  68. <li>Inspections for illegal calls.</li>
  69. <li>Intentions for resolving serialization problems.</li>
  70. </ul>
  71. """.trimIndent()
  72. )
  73. changeNotes.set(
  74. """
  75. See <a href="https://github.com/mamoe/mirai/releases">https://github.com/mamoe/mirai/releases</a>
  76. """.trimIndent()
  77. )
  78. }
  79. dependencies {
  80. api(`jetbrains-annotations`)
  81. api(`kotlinx-coroutines-jdk8`)
  82. api(`kotlinx-coroutines-swing`)
  83. api(project(":mirai-console-compiler-common"))
  84. implementation(`kotlin-stdlib-jdk8`)
  85. implementation(`kotlin-reflect`)
  86. }