diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-03-26 06:21:37 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-03-26 07:27:51 +0900 |
| commit | e0d1f7a9bc9122d02de829a28a51b9aec8611fa5 (patch) | |
| tree | 8f28eef5f5258bf01c0c4df70cc0df6831d73bc7 /platform-velocity | |
| parent | b0e13d04de476cd90eacf59c33e680593d8df0b8 (diff) | |
| download | LunaticChat-e0d1f7a9bc9122d02de829a28a51b9aec8611fa5.tar.gz LunaticChat-e0d1f7a9bc9122d02de829a28a51b9aec8611fa5.tar.bz2 LunaticChat-e0d1f7a9bc9122d02de829a28a51b9aec8611fa5.zip | |
feat: Add Night warning to Status Command
Diffstat (limited to 'platform-velocity')
3 files changed, 45 insertions, 1 deletions
diff --git a/platform-velocity/build.gradle.kts b/platform-velocity/build.gradle.kts index cc8af58..f6a4e57 100644 --- a/platform-velocity/build.gradle.kts +++ b/platform-velocity/build.gradle.kts @@ -36,12 +36,30 @@ tasks { } processResources { - val props = mapOf("version" to project.version) + val gitCommitHash = + providers + .exec { + commandLine("git", "rev-parse", "--short", "HEAD") + }.standardOutput + .asText + .get() + .trim() + + val isNightly = providers.gradleProperty("isNightly").orNull?.toBoolean() ?: false + val props = + mapOf( + "version" to project.version, + "gitCommitHash" to gitCommitHash, + "channel" to if (isNightly) "nightly" else "stable", + ) inputs.properties(props) filteringCharset = "UTF-8" filesMatching("velocity-plugin.json") { expand(props) } + filesMatching("build-info.properties") { + expand(props) + } } build { diff --git a/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/BuildInfo.kt b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/BuildInfo.kt new file mode 100644 index 0000000..1cb13d4 --- /dev/null +++ b/platform-velocity/src/main/kotlin/dev/m1sk9/lunaticChat/velocity/BuildInfo.kt @@ -0,0 +1,23 @@ +package dev.m1sk9.lunaticChat.velocity + +import java.util.Properties + +object BuildInfo { + val version: String + val commitHash: String + val channel: String + + init { + val props = Properties() + BuildInfo::class.java.getResourceAsStream("/build-info.properties")?.use { + props.load(it) + } + version = props.getProperty("version", "unknown") + commitHash = props.getProperty("commit", "unknown") + channel = props.getProperty("channel", "stable") + } + + val isNightly: Boolean get() = channel == "nightly" + + fun versionWithCommit(): String = "$version ($commitHash)" +} diff --git a/platform-velocity/src/main/resources/build-info.properties b/platform-velocity/src/main/resources/build-info.properties new file mode 100644 index 0000000..1f8dbc2 --- /dev/null +++ b/platform-velocity/src/main/resources/build-info.properties @@ -0,0 +1,3 @@ +version=${version} +commit=${gitCommitHash} +channel=${channel} |
