2020-09-13 15:27:42 +08:00
|
|
|
@file:Suppress("UnusedImport")
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
kotlin("jvm")
|
2020-09-19 20:33:34 +08:00
|
|
|
kotlin("kapt")
|
|
|
|
id("java-gradle-plugin")
|
|
|
|
id("com.gradle.plugin-publish")
|
2020-09-13 15:27:42 +08:00
|
|
|
id("java")
|
2020-09-19 20:33:34 +08:00
|
|
|
//signing
|
2020-09-13 15:27:42 +08:00
|
|
|
`maven-publish`
|
|
|
|
id("com.jfrog.bintray")
|
2020-09-19 20:33:34 +08:00
|
|
|
|
|
|
|
id("com.github.johnrengelman.shadow")
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compileOnly(gradleApi())
|
|
|
|
compileOnly(kotlin("gradle-plugin-api").toString()) {
|
|
|
|
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
|
|
|
|
}
|
|
|
|
compileOnly(kotlin("gradle-plugin").toString()) {
|
|
|
|
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
|
|
|
|
}
|
|
|
|
|
|
|
|
compileOnly(kotlin("stdlib"))
|
|
|
|
|
|
|
|
api("com.github.jengelman.gradle.plugins:shadow:6.0.0")
|
2020-11-12 09:42:18 +08:00
|
|
|
api(`jetbrains-annotations`)
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
version = Versions.console
|
|
|
|
description = "Gradle plugin for Mirai Console"
|
|
|
|
|
2020-09-19 20:33:34 +08:00
|
|
|
pluginBundle {
|
|
|
|
website = "https://github.com/mamoe/mirai-console"
|
|
|
|
vcsUrl = "https://github.com/mamoe/mirai-console"
|
|
|
|
tags = listOf("framework", "kotlin", "mirai")
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|
|
|
|
|
2020-09-19 20:33:34 +08:00
|
|
|
gradlePlugin {
|
|
|
|
plugins {
|
|
|
|
create("miraiConsole") {
|
|
|
|
id = "net.mamoe.mirai-console"
|
|
|
|
displayName = "Mirai Console"
|
|
|
|
description = project.description
|
|
|
|
implementationClass = "net.mamoe.mirai.console.gradle.MiraiConsoleGradlePlugin"
|
|
|
|
}
|
|
|
|
}
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|
|
|
|
|
2020-11-12 09:42:18 +08:00
|
|
|
kotlin.target.compilations.all {
|
|
|
|
kotlinOptions {
|
|
|
|
apiVersion = "1.3"
|
|
|
|
languageVersion = "1.3"
|
2020-09-13 15:27:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks {
|
2020-09-19 20:33:34 +08:00
|
|
|
val compileKotlin by getting {}
|
|
|
|
|
|
|
|
val fillBuildConstants by registering {
|
|
|
|
group = "mirai"
|
|
|
|
doLast {
|
|
|
|
(compileKotlin as org.jetbrains.kotlin.gradle.tasks.KotlinCompile).source.filter { it.name == "VersionConstants.kt" }.single()
|
|
|
|
.let { file ->
|
|
|
|
file.writeText(
|
|
|
|
file.readText()
|
|
|
|
.replace(
|
|
|
|
Regex("""const val CONSOLE_VERSION = ".*"""")
|
|
|
|
) {
|
|
|
|
"""const val CONSOLE_VERSION = "${Versions.console}""""
|
|
|
|
}
|
|
|
|
.replace(
|
|
|
|
Regex("""const val CORE_VERSION = ".*"""")
|
|
|
|
) { """const val CORE_VERSION = "${Versions.core}"""" }
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
compileKotlin.dependsOn(fillBuildConstants)
|
|
|
|
}
|
|
|
|
|
2020-09-19 21:01:04 +08:00
|
|
|
setupPublishing("mirai-console-gradle")
|