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 fa637ed8dd
commit 672c5365f4
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8
7 changed files with 26 additions and 13 deletions

View file

@ -16,10 +16,12 @@ index e431e3435737e28394d81b56568a08b3c3148b9b..c484aff2c192bf42059b5689327909e4
/.project
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..a0f1c1d1ac63fdcce942922ffe68a8d44c712513
index 0000000000000000000000000000000000000000..f3dd92e136a71aa39e422de7b2c5f2f3fdec554e
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,54 @@
@@ -0,0 +1,67 @@
+import java.util.Locale
+
+plugins {
+ `java-library`
+ checkstyle
@ -53,7 +55,18 @@ index 0000000000000000000000000000000000000000..a0f1c1d1ac63fdcce942922ffe68a8d4
+ 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"