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-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
|
2020-02-27 13:18:33 +08:00
|
|
|
|
|
|
|
plugins {
|
2020-08-16 23:21:11 +08:00
|
|
|
kotlin("jvm")
|
|
|
|
kotlin("plugin.serialization")
|
2020-02-27 13:18:33 +08:00
|
|
|
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-02-27 13:18:33 +08:00
|
|
|
}
|
|
|
|
|
2020-06-20 22:55:07 +08:00
|
|
|
version = Versions.console
|
2020-11-12 09:42:18 +08:00
|
|
|
description = "Mirai Console Backend"
|
2020-05-23 17:44:34 +08:00
|
|
|
|
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
|
|
|
|
2020-02-27 13:18:33 +08:00
|
|
|
dependencies {
|
2020-12-18 16:36:49 +08:00
|
|
|
compileAndTestRuntime(`mirai-core-api`)
|
|
|
|
compileAndTestRuntime(`mirai-core-utils`)
|
2020-11-12 09:42:18 +08:00
|
|
|
compileAndTestRuntime(`kotlin-stdlib-jdk8`)
|
|
|
|
|
|
|
|
compileAndTestRuntime(`kotlinx-atomicfu`)
|
|
|
|
compileAndTestRuntime(`kotlinx-coroutines-core`)
|
|
|
|
compileAndTestRuntime(`kotlinx-serialization-core`)
|
|
|
|
compileAndTestRuntime(`kotlinx-serialization-json`)
|
|
|
|
compileAndTestRuntime(`kotlin-reflect`)
|
|
|
|
|
2021-01-29 07:44:22 +08:00
|
|
|
implementation(project(":mirai-console-compiler-annotations"))
|
|
|
|
|
2020-11-12 09:42:18 +08:00
|
|
|
smartImplementation(yamlkt)
|
|
|
|
smartImplementation(`jetbrains-annotations`)
|
2020-11-13 21:06:49 +08:00
|
|
|
smartImplementation(`caller-finder`)
|
2020-11-12 09:42:18 +08:00
|
|
|
smartApi(`kotlinx-coroutines-jdk8`)
|
|
|
|
|
2020-12-18 16:36:49 +08:00
|
|
|
testApi(`mirai-core`)
|
2020-11-12 09:42:18 +08:00
|
|
|
testApi(`kotlin-stdlib-jdk8`)
|
2020-06-23 22:05:46 +08:00
|
|
|
}
|
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-02-27 13:18:33 +08:00
|
|
|
}
|
|
|
|
|
2021-01-28 09:32:22 +08:00
|
|
|
configurePublishing("mirai-console")
|