Skip to content

Commit

Permalink
add build config
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Dec 2, 2023
1 parent eed9d96 commit 123d085
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
kotlin("jvm") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion

id("com.github.gmazzo.buildconfig") version "3.1.0"
id("net.mamoe.mirai-console") version "2.16.0"
}

Expand All @@ -16,6 +17,14 @@ repositories {
mavenCentral()
}

buildConfig {
className("BuildConstants")
packageName("org.example.mirai.plugin")
useKotlinOutput()

buildConfigField("String", "VERSION", "\"${project.version}\"")
}

mirai {
noTestCore = true
setupConsoleTestRuntime {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/example/mirai/plugin/JavaPluginMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class JavaPluginMain extends JavaPlugin {
public static final JavaPluginMain INSTANCE = new JavaPluginMain();

private JavaPluginMain() {
super(new JvmPluginDescriptionBuilder("org.example.mirai-example", "0.1.0")
super(new JvmPluginDescriptionBuilder("org.example.mirai-example", BuildConstants.VERSION)
.info("EG")
.build());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/PluginMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object PluginMain : KotlinPlugin(
JvmPluginDescription(
id = "org.example.mirai-example",
name = "插件示例",
version = "0.1.0"
version = BuildConstants.VERSION
) {
author("作者名称或联系方式")
info(
Expand Down

0 comments on commit 123d085

Please sign in to comment.