mirai/backend/mirai-console/build.gradle.kts

67 lines
2.0 KiB
Plaintext
Raw Normal View History

2020-08-01 13:04:32 +08:00
@file:Suppress("UnusedImport")
2020-06-21 14:24:17 +08:00
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2020-08-22 20:13:05 +08:00
import java.time.Instant
plugins {
2020-08-16 23:21:11 +08:00
kotlin("jvm")
kotlin("plugin.serialization")
id("java")
`maven-publish`
2020-06-28 11:45:21 +08:00
id("com.jfrog.bintray")
2020-08-16 23:21:11 +08:00
id("net.mamoe.kotlin-jvm-blocking-bridge")
}
2020-06-20 22:55:07 +08:00
version = Versions.console
2020-11-12 09:42:18 +08:00
description = "Mirai Console Backend"
2020-03-05 09:45:54 +08:00
kotlin {
2020-07-11 19:26:31 +08:00
explicitApiWarning()
2020-03-05 09:45:54 +08:00
}
2020-05-14 16:05:42 +08:00
dependencies {
2020-11-12 09:42:18 +08:00
compileAndTestRuntime(`mirai-core`)
compileAndTestRuntime(`kotlin-stdlib`)
compileAndTestRuntime(`kotlin-stdlib-jdk8`)
compileAndTestRuntime(`kotlinx-atomicfu`)
compileAndTestRuntime(`kotlinx-coroutines-core`)
compileAndTestRuntime(`kotlinx-serialization-core`)
compileAndTestRuntime(`kotlinx-serialization-json`)
compileAndTestRuntime(`kotlin-reflect`)
smartImplementation(yamlkt)
smartImplementation(`jetbrains-annotations`)
smartApi(`kotlinx-coroutines-jdk8`)
testApi(`mirai-core-qqandroid`)
testApi(`kotlin-stdlib-jdk8`)
}
2020-06-17 13:25:28 +08:00
tasks {
2020-06-21 14:24:17 +08:00
val compileKotlin by getting {}
2020-11-12 09:42:18 +08:00
register("fillBuildConstants") {
2020-07-11 20:04:18 +08:00
group = "mirai"
2020-06-21 14:24:17 +08:00
doLast {
2020-08-20 12:52:41 +08:00
(compileKotlin as KotlinCompile).source.filter { it.name == "MiraiConsoleBuildConstants.kt" }.single()
.let { file ->
file.writeText(
file.readText()
2020-08-22 20:13:05 +08:00
.replace(
2020-09-02 08:24:17 +08:00
Regex("""val buildDate: Instant = Instant.ofEpochSecond\(.*\)""")
) {
"""val buildDate: Instant = Instant.ofEpochSecond(${
2020-09-20 00:28:57 +08:00
Instant.now().epochSecond
2020-09-02 08:24:17 +08:00
})"""
}
2020-08-22 20:13:05 +08:00
.replace(
2020-09-26 23:51:00 +08:00
Regex("""const val versionConst:\s+String\s+=\s+".*"""")
) { """const val versionConst: String = "${project.version}"""" }
2020-08-20 12:52:41 +08:00
)
2020-09-20 00:28:57 +08:00
}
2020-06-21 14:24:17 +08:00
}
}
}
2020-11-12 09:42:18 +08:00
setupPublishing("mirai-console")