2021-01-28 09:32:22 +08:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2020-09-13 15:27:42 +08:00
|
|
|
@file:Suppress("UnusedImport")
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
kotlin("jvm")
|
|
|
|
id("java")
|
|
|
|
`maven-publish`
|
|
|
|
|
2020-11-12 09:42:18 +08:00
|
|
|
id("org.jetbrains.intellij") version Versions.intellijGradlePlugin
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
2021-03-29 18:17:50 +08:00
|
|
|
maven("https://maven.aliyun.com/repository/public")
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|
|
|
|
|
2021-04-10 20:21:58 +08:00
|
|
|
version = Versions.console
|
2020-09-13 15:27:42 +08:00
|
|
|
description = "IntelliJ plugin for Mirai Console"
|
|
|
|
|
2021-03-29 18:17:50 +08:00
|
|
|
// JVM fails to compile
|
|
|
|
kotlin.target.compilations.forEach { kotlinCompilation ->
|
|
|
|
kotlinCompilation.kotlinOptions.freeCompilerArgs += "-Xuse-ir"
|
|
|
|
} // don't use `useIr()`, compatibility with mirai-console dedicated builds
|
|
|
|
|
2020-09-13 15:27:42 +08:00
|
|
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
|
|
|
intellij {
|
2020-11-12 09:42:18 +08:00
|
|
|
version = Versions.intellij
|
2020-09-13 15:27:42 +08:00
|
|
|
isDownloadSources = true
|
|
|
|
updateSinceUntilBuild = false
|
|
|
|
|
2021-03-29 18:17:50 +08:00
|
|
|
sandboxDirectory = projectDir.resolve("run/idea-sandbox").absolutePath
|
|
|
|
|
2020-09-13 15:27:42 +08:00
|
|
|
setPlugins(
|
2020-12-18 16:36:49 +08:00
|
|
|
"org.jetbrains.kotlin:${Versions.kotlinIntellijPlugin}", // @eap
|
2021-03-29 18:17:50 +08:00
|
|
|
"java",
|
2021-04-10 12:36:56 +08:00
|
|
|
"gradle"
|
2020-09-13 15:27:42 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-02-24 09:08:38 +08:00
|
|
|
project.extra.set("javaTarget", JavaVersion.VERSION_11) // see build.gradle.kts:213 in root project
|
|
|
|
|
2020-09-13 15:27:42 +08:00
|
|
|
tasks.getByName("publishPlugin", org.jetbrains.intellij.tasks.PublishTask::class) {
|
|
|
|
val pluginKey = project.findProperty("jetbrains.hub.key")?.toString()
|
|
|
|
if (pluginKey != null) {
|
|
|
|
logger.info("Found jetbrains.hub.key")
|
|
|
|
setToken(pluginKey)
|
|
|
|
} else {
|
|
|
|
logger.info("jetbrains.hub.key not found")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-11 17:58:53 +08:00
|
|
|
fun File.resolveMkdir(relative: String): File {
|
|
|
|
return this.resolve(relative).apply { mkdirs() }
|
|
|
|
}
|
|
|
|
|
2020-09-13 15:27:42 +08:00
|
|
|
tasks.withType<org.jetbrains.intellij.tasks.PatchPluginXmlTask> {
|
2021-01-12 19:12:36 +08:00
|
|
|
sinceBuild("201.*")
|
|
|
|
untilBuild("215.*")
|
2021-02-11 17:58:53 +08:00
|
|
|
pluginDescription(
|
|
|
|
"""
|
2020-10-04 22:28:56 +08:00
|
|
|
Plugin development support for <a href='https://github.com/mamoe/mirai-console'>Mirai Console</a>
|
2020-09-19 14:50:12 +08:00
|
|
|
|
|
|
|
<h3>Features</h3>
|
|
|
|
<ul>
|
|
|
|
<li>Inspections for plugin properties, for example, checking PluginDescription.</li>
|
|
|
|
<li>Inspections for illegal calls.</li>
|
|
|
|
<li>Intentions for resolving serialization problems.</li>
|
|
|
|
</ul>
|
2021-02-11 17:58:53 +08:00
|
|
|
""".trimIndent()
|
|
|
|
)
|
|
|
|
changeNotes(
|
|
|
|
"""
|
2020-12-25 20:45:38 +08:00
|
|
|
See <a href="https://github.com/mamoe/mirai-console/releases">https://github.com/mamoe/mirai-console/releases</a>
|
2021-02-11 17:58:53 +08:00
|
|
|
""".trimIndent()
|
|
|
|
)
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-11-12 09:42:18 +08:00
|
|
|
api(`jetbrains-annotations`)
|
|
|
|
api(`kotlinx-coroutines-jdk8`)
|
2021-03-29 18:17:50 +08:00
|
|
|
api(`kotlinx-coroutines-swing`)
|
2020-09-13 15:27:42 +08:00
|
|
|
|
2020-09-17 21:39:34 +08:00
|
|
|
api(project(":mirai-console-compiler-common"))
|
|
|
|
|
2021-03-29 18:17:50 +08:00
|
|
|
compileOnly(`kotlin-stdlib-jdk8`)
|
|
|
|
compileOnly("com.jetbrains:ideaIC:${Versions.intellij}")
|
|
|
|
// compileOnly(`kotlin-compiler`)
|
|
|
|
|
2020-09-13 15:27:42 +08:00
|
|
|
compileOnly(files("libs/ide-common.jar"))
|
2021-03-29 18:17:50 +08:00
|
|
|
compileOnly(fileTree("build/idea-sandbox/plugins/Kotlin/lib").filter {
|
|
|
|
!it.name.contains("stdlib")
|
|
|
|
})
|
|
|
|
compileOnly(`kotlin-reflect`)
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|