Write API version to pom.properties for Versioning to read

Maven writes this metadata normally, but we don't use maven. Maybe should modify Versioning instead in the future, but this works just fine for now.
This commit is contained in:
Jason Penilla 2021-06-12 18:28:41 -07:00
parent 3d38374f46
commit 3a7b3b35c3
2 changed files with 14 additions and 1 deletions

View file

@ -1,4 +1,4 @@
group = "io.papermc.paper"
group = io.papermc.paper
version = 1.17-R0.1-SNAPSHOT
mcVersion = 1.17

View file

@ -20,6 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@
+import java.util.Locale
+
+plugins {
+ `java-library`
+ checkstyle
@ -53,7 +55,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ checkstyle("com.puppycrawl.tools:checkstyle:8.39")
+}
+
+val generateApiVersioningFile by tasks.registering {
+ val pomProps = layout.buildDirectory.file("pom.properties")
+ outputs.file(pomProps)
+ doLast {
+ pomProps.get().asFile.writeText("version=${project.version}")
+ }
+}
+
+tasks.jar {
+ from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
+ into("META-INF/maven/${project.group}/${project.name.toLowerCase(Locale.ENGLISH)}")
+ }
+ manifest {
+ attributes += mapOf(
+ "Automatic-Module-Name" to "org.bukkit"