Skip to content

Commit

Permalink
assign api version based on server version
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Oct 22, 2024
1 parent 759caec commit fb49ca6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ if (snapshot) {
version = version + "-SNAPSHOT"
}

def versionFile = file("version")
if (!versionFile.exists()) {
throw new GradleException("version file not found")
}
def serverVersion = versionFile.text.trim()
def majorServerVersion = serverVersion.count('.') > 1 ? serverVersion.substring(0, serverVersion.lastIndexOf('.')) : serverVersion

repositories {
mavenCentral()
maven {
Expand All @@ -40,12 +47,7 @@ paperweight {
}

dependencies {
def versionFile = file("version")
if (!versionFile.exists()) {
throw new GradleException("version file not found")
}
def version = versionFile.text.trim()
paperweight.foliaDevBundle("$version-R0.1-SNAPSHOT")
paperweight.foliaDevBundle("$serverVersion-R0.1-SNAPSHOT")

def core = "4.5.7"
implementation "me.hsgamer:hscore-bukkit-config:$core"
Expand Down Expand Up @@ -91,7 +93,7 @@ processResources {
def props = [
version: version,
name: project.name,
apiVersion: "1.21",
apiVersion: majorServerVersion,
description: project.description
]
inputs.properties props
Expand Down

0 comments on commit fb49ca6

Please sign in to comment.