diff --git a/.gitignore b/.gitignore index 2f177c2..522c67d 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,6 @@ nb-configuration.xml # Ignore DevSpace cache and log folder .devspace/ + +# Ignore kotlin folder +.kotlin diff --git a/build.gradle.kts b/build.gradle.kts index 65a9372..f706585 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,12 +20,14 @@ allprojects { it.setBlockIndent(4) it.setContinuationIndent(4) } + targetExclude("**/build/**") } kotlinGradle { ktfmt().googleStyle().configure { it.setBlockIndent(4) it.setContinuationIndent(4) } + targetExclude("**/build/**") } } } diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index aea4c23..40fa29b 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -14,3 +14,11 @@ tasks.shadowJar { archiveClassifier.set("") // Removes the 'all' classifier archiveVersion.set("") // Removes the version from the jar name } + +val pluginVersion = project.version.toString() + +tasks.processResources { + inputs.property("version", project.version) + + filesMatching(listOf("**/plugin.yml")) { expand("VERSION" to pluginVersion) } +} diff --git a/paper/src/main/resources/plugin.yml b/paper/src/main/resources/plugin.yml index 11aa8d7..5fbde81 100644 --- a/paper/src/main/resources/plugin.yml +++ b/paper/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: GroundsServerDiscovery -version: 1.0.0-SNAPSHOT +version: ${VERSION} main: gg.grounds.GroundsPluginServerDiscovery -api-version: 1.21 \ No newline at end of file +api-version: 1.21 diff --git a/velocity/build.gradle.kts b/velocity/build.gradle.kts index 448c8f8..8906713 100644 --- a/velocity/build.gradle.kts +++ b/velocity/build.gradle.kts @@ -1,4 +1,7 @@ -plugins { id("com.gradleup.shadow") version "9.3.0" } +plugins { + id("com.gradleup.shadow") version "9.3.0" + id("com.github.gmazzo.buildconfig") version "6.0.7" +} dependencies { implementation(project(":common")) @@ -15,3 +18,12 @@ tasks.shadowJar { archiveClassifier.set("") // Removes the 'all' classifier archiveVersion.set("") // Removes the version from the jar name } + +buildConfig { + className("BuildInfo") + packageName("gg.grounds") + + useKotlinOutput() + + buildConfigField("String", "VERSION", "\"${project.version}\"") +} diff --git a/velocity/src/main/kotlin/gg/grounds/GroundsPluginServerDiscovery.kt b/velocity/src/main/kotlin/gg/grounds/GroundsPluginServerDiscovery.kt index 6c3eac0..d4d7763 100644 --- a/velocity/src/main/kotlin/gg/grounds/GroundsPluginServerDiscovery.kt +++ b/velocity/src/main/kotlin/gg/grounds/GroundsPluginServerDiscovery.kt @@ -11,7 +11,14 @@ import gg.grounds.discovery.VelocityDiscoveryConfig import gg.grounds.discovery.VelocityDiscoveryService import org.slf4j.Logger -@Plugin(id = "plugin-server-discovery", name = "Grounds Server Discovery Plugin") +@Plugin( + id = "plugin-server-discovery", + name = "Grounds Server Discovery Plugin", + version = BuildInfo.VERSION, + description = "Grounds server discovery plugin for Velocity", + authors = ["Grounds Development Team and contributors"], + url = "https://github.com/groundsgg/plugin-server-discovery", +) class GroundsPluginServerDiscovery @Inject constructor(private val proxyServer: ProxyServer, private val logger: Logger) {