aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle28
1 files changed, 26 insertions, 2 deletions
diff --git a/build.gradle b/build.gradle
index adb9fba..c660a31 100644
--- a/build.gradle
+++ b/build.gradle
@@ -32,8 +32,6 @@ plugins {
apply plugin: 'io.github.fvarrui.javapackager.plugin'
-version = "1.0"
-
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
@@ -112,6 +110,28 @@ task pack(type: io.github.fvarrui.javapackager.gradle.PackageTask, dependsOn: bu
}
}
+task createProperties(dependsOn: processResources) {
+ doLast {
+ def stdout = new ByteArrayOutputStream()
+
+ if (project.hasProperty("release")) {
+ project.version = 1.0
+ } else {
+ exec {
+ commandLine "git", "log", "-n", "1", "--pretty=format:\"%h\""
+ standardOutput = stdout
+ }
+ project.version = "git(" + stdout.toString().trim().replaceAll("\"", "") + ")"
+ }
+
+ new File("$buildDir/resources/main/xyz/brysonsteck/ServerCraft/info.properties").withWriter { w ->
+ Properties p = new Properties()
+ p['version'] = project.version.toString()
+ p.store w, null
+ }
+ }
+}
+
build.doLast {
if (OperatingSystem.current().isLinux()) {
exec {
@@ -125,6 +145,10 @@ build.doLast {
}
}
+classes {
+ dependsOn createProperties
+}
+
javafx {
version = "20"
modules = ['javafx.controls', 'javafx.fxml', 'javafx.graphics']