mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-24 19:20:30 +08:00
Automatically generate VersionConstants.kt
This commit is contained in:
parent
9711c5eb3e
commit
fe46ea4740
1
tools/gradle-plugin/.gitignore
vendored
Normal file
1
tools/gradle-plugin/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
src/main/kotlin/VersionConstants.kt
|
@ -111,20 +111,12 @@ tasks {
|
||||
val fillBuildConstants by registering {
|
||||
group = "mirai"
|
||||
doLast {
|
||||
projectDir.resolve("src").walk().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}"""" }
|
||||
)
|
||||
}
|
||||
projectDir.resolve("src/main/kotlin/VersionConstants.kt").apply { createNewFile() }
|
||||
.writeText(
|
||||
projectDir.resolve("src/main/kotlin/VersionConstants.kt.template").readText()
|
||||
.replace("$\$CONSOLE_VERSION$$", Versions.console)
|
||||
.replace("$\$CORE_VERSION$$", Versions.core)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,6 @@
|
||||
package net.mamoe.mirai.console.gradle
|
||||
|
||||
internal object VersionConstants {
|
||||
const val CONSOLE_VERSION = "2.8.0" // value is written here automatically during build
|
||||
const val CORE_VERSION = "2.8.0" // value is written here automatically during build
|
||||
const val CONSOLE_VERSION = "$$CONSOLE_VERSION$$" // value is written here automatically during build
|
||||
const val CORE_VERSION = "$$CORE_VERSION$$" // value is written here automatically during build
|
||||
}
|
Loading…
Reference in New Issue
Block a user