mirai/tools/gradle-plugin/build.gradle.kts

86 lines
2.4 KiB
Plaintext
Raw Normal View History

@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")
id("java")
2020-09-19 20:33:34 +08:00
//signing
`maven-publish`
id("com.jfrog.bintray")
2020-09-19 20:33:34 +08:00
id("com.github.johnrengelman.shadow")
}
dependencies {
compileOnly(gradleApi())
2020-11-28 13:53:53 +08:00
compileOnly(gradleKotlinDsl())
2020-09-19 20:33:34 +08:00
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-11-28 13:53:53 +08:00
api("com.jfrog.bintray.gradle:gradle-bintray-plugin:${Versions.bintray}")
}
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-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-11-12 09:42:18 +08:00
kotlin.target.compilations.all {
kotlinOptions {
apiVersion = "1.3"
languageVersion = "1.3"
}
}
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")