Skip to content

Commit

Permalink
feat: control versions at the same place
Browse files Browse the repository at this point in the history
  • Loading branch information
Cdm2883 committed Sep 30, 2024
1 parent d4099cd commit 7bb4d65
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
19 changes: 19 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,22 @@ plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.gradleup.shadow) apply false
}

subprojects {
afterEvaluate {

if (projectDir.resolve("src/main/resources/plugin.json").exists()) {
val version = rootProject.libs.versions.allaymc.kotlinx.get()

tasks.named("processResources") {
doLast {
val origin = file("src/main/resources/plugin.json")
val processed = file("${layout.buildDirectory.get()}/resources/main/plugin.json")
val content = origin.readText().replace("\${version}", version)
processed.writeText(content)
}
}
}

}
}
3 changes: 2 additions & 1 deletion example/src/main/resources/plugin.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"entrance": "vip.cdms.allaymc.kotlinx.KotlinxExamplePlugin",
"name": "KotlinxExamplePlugin",
"version": "0.1.0-alpha",
"version": "${version}",
"dependencies": [
{
"name": "KotlinxPlugin",
"version": "${version}",
"optional": false
}
]
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[versions]
allaymc-kotlinx = "0.1.0-alpha"

kotlin = "2.0.20"
gradleup-shadow = "8.3.0"

Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/resources/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"authors": [
"MineBuilder"
],
"version": "0.1.0-alpha",
"version": "${version}",
"dependencies": [],
"website": "https://github.com/MineBuilders/allaymc-kotlinx"
}

0 comments on commit 7bb4d65

Please sign in to comment.