Skip to content

Commit

Permalink
feat: 输出LiveChatClient版本信息
Browse files Browse the repository at this point in the history
  • Loading branch information
1962247851 committed Jan 15, 2025
1 parent 9e78399 commit 475b30b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 7 deletions.
30 changes: 23 additions & 7 deletions barrage-fly/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.springframework.boot.gradle.tasks.bundling.BootJar
import java.nio.charset.StandardCharsets

plugins {
id("org.springframework.boot") version "2.7.16"
alias(libs.plugins.springframeworkBoot)
id("io.spring.dependency-management") version "1.0.15.RELEASE"
kotlin("jvm") version "1.6.21"
kotlin("plugin.spring") version "1.6.21"
Expand Down Expand Up @@ -52,12 +53,13 @@ extra["springBootAdminVersion"] = "2.7.4"

dependencies {
// https://github.com/OrdinaryRoad-Project/ordinaryroad-live-chat-client
val liveChatClientVersion = "1.2.3"
val liveChatClientBrotliVersion = "1.16.0"
val ordinaryroadVersion = "1.6.0"
val saTokenVersion = "1.36.0"
val qLExpressVersion = "3.3.2"

// 指定版本
implementation("org.apache.commons:commons-lang3:3.14.0")
implementation("de.codecentric:spring-boot-admin-starter-client")
implementation("de.codecentric:spring-boot-admin-starter-server")
implementation("org.springframework.boot:spring-boot-starter-actuator")
Expand All @@ -69,11 +71,11 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("org.springframework.integration:spring-integration-rsocket")
implementation("tech.ordinaryroad:live-chat-client-bilibili:$liveChatClientVersion")
implementation("tech.ordinaryroad:live-chat-client-douyu:$liveChatClientVersion")
implementation("tech.ordinaryroad:live-chat-client-huya:$liveChatClientVersion")
implementation("tech.ordinaryroad:live-chat-client-douyin:$liveChatClientVersion")
implementation("tech.ordinaryroad:live-chat-client-kuaishou:$liveChatClientVersion")
implementation(libs.liveChatClientBilibili)
implementation(libs.liveChatClientDouyu)
implementation(libs.liveChatClientHuya)
implementation(libs.liveChatClientDouyin)
implementation(libs.liveChatClientKuaishou)
implementation("tech.ordinaryroad:ordinaryroad-commons-core:$ordinaryroadVersion") {
exclude("org.springframework")
exclude("org.springframework.cloud")
Expand Down Expand Up @@ -151,6 +153,20 @@ dependencyManagement {
}
}

/**
* 生成版本信息
*/
tasks.withType<ProcessResources> {
doLast {
val propertiesFile = file("src/main/resources/properties/generated/version.properties")
if (propertiesFile.exists()) {
propertiesFile.delete()
}
propertiesFile.parentFile.mkdirs()
propertiesFile.appendText("liveChatClientVersion=${libs.versions.liveChatClient.get()}", StandardCharsets.UTF_8)
}
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
Expand Down
14 changes: 14 additions & 0 deletions barrage-fly/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[versions]
springBoot = "2.7.16"
liveChatClient = "1.3.2"

[libraries]
liveChatClientBilibili = { group = "tech.ordinaryroad", name = "live-chat-client-bilibili", version.ref = "liveChatClient" }
liveChatClientDouyu = { group = "tech.ordinaryroad", name = "live-chat-client-douyu", version.ref = "liveChatClient" }
liveChatClientHuya = { group = "tech.ordinaryroad", name = "live-chat-client-huya", version.ref = "liveChatClient" }
liveChatClientDouyin = { group = "tech.ordinaryroad", name = "live-chat-client-douyin", version.ref = "liveChatClient" }
liveChatClientKuaishou = { group = "tech.ordinaryroad", name = "live-chat-client-kuaishou", version.ref = "liveChatClient" }

[plugins]
springframeworkBoot = { id = "org.springframework.boot", version = "2.7.16" }

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

package tech.ordinaryroad.barrage.fly

import cn.hutool.core.util.StrUtil
import de.codecentric.boot.admin.server.config.EnableAdminServer
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.core.io.support.PropertiesLoaderUtils
import tech.ordinaryroad.barrage.fly.context.BarrageFlyTaskContext
import tech.ordinaryroad.commons.core.config.PasswordEncoderConfig
import tech.ordinaryroad.commons.core.config.RedisTemplateConfiguration
Expand All @@ -37,6 +39,8 @@ class OrdinaryroadBarrageFlyApplication {
@JvmStatic
fun main(args: Array<String>) {
runApplication<OrdinaryroadBarrageFlyApplication>(*args)
val properties = PropertiesLoaderUtils.loadAllProperties("properties/generated/version.properties")
println(StrUtil.format("LiveChatClient Version: {}", properties.getProperty("liveChatClientVersion")))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright 2023 OrdinaryRoad
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

liveChatClientVersion=1.3.2

0 comments on commit 475b30b

Please sign in to comment.