From e63ece3aa0d81276e4091968f9a5f1a74b918329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kr=C3=BChlmann?= Date: Thu, 11 Dec 2025 01:32:06 +0100 Subject: [PATCH] Add manifest version --- .../app/service/GitVersionService.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/imgfloat/app/service/GitVersionService.java b/src/main/java/com/imgfloat/app/service/GitVersionService.java index 4c73372..59fb8d8 100644 --- a/src/main/java/com/imgfloat/app/service/GitVersionService.java +++ b/src/main/java/com/imgfloat/app/service/GitVersionService.java @@ -22,6 +22,20 @@ public class GitVersionService { } private String resolveVersion() { + String gitDescribeVersion = tryGitDescribe(); + if (gitDescribeVersion != null) { + return gitDescribeVersion; + } + + String manifestVersion = getClass().getPackage().getImplementationVersion(); + if (manifestVersion != null && !manifestVersion.isBlank()) { + return manifestVersion; + } + + return "unknown"; + } + + private String tryGitDescribe() { Process process = null; try { process = new ProcessBuilder("git", "describe", "--tags", "--always") @@ -36,7 +50,7 @@ public class GitVersionService { LOG.warn("git describe returned exit code {} with output: {}", exitCode, result); } } catch (IOException e) { - LOG.warn("Unable to determine git version", e); + LOG.warn("Unable to determine git version using git describe", e); if (process != null) { process.destroyForcibly(); } @@ -47,6 +61,6 @@ public class GitVersionService { } Thread.currentThread().interrupt(); } - return "unknown"; + return null; } }