From bdd1f04fb20f04813ac4001521a02358612ef125 Mon Sep 17 00:00:00 2001 From: Jafea7 Date: Sun, 4 May 2025 17:27:18 +1000 Subject: [PATCH] Change version numbering --- client/pom.xml | 2 +- .../java/ctbrec/ui/CamrecApplication.java | 2 +- common/pom.xml | 2 +- common/src/main/java/ctbrec/Version.java | 5 +++++ master/pom.xml | 7 ++++++- server/pom.xml | 2 +- update-version.sh | 19 +++++++++++++++++++ 7 files changed, 34 insertions(+), 5 deletions(-) create mode 100755 update-version.sh diff --git a/client/pom.xml b/client/pom.xml index 17b37eb1..e2dbcf40 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -8,7 +8,7 @@ ctbrec master - 5.3.0 + 25.05.04 ../master diff --git a/client/src/main/java/ctbrec/ui/CamrecApplication.java b/client/src/main/java/ctbrec/ui/CamrecApplication.java index 5702e290..0f5eebc4 100644 --- a/client/src/main/java/ctbrec/ui/CamrecApplication.java +++ b/client/src/main/java/ctbrec/ui/CamrecApplication.java @@ -226,7 +226,7 @@ public class CamrecApplication extends Application { log.debug("Creating GUI"); DesktopIntegration.setRecorder(recorder); DesktopIntegration.setPrimaryStage(primaryStage); - CamrecApplication.title = "CTB Recorder " + Version.getVersion(); + CamrecApplication.title = "CTB Recorder " + Version.getVersion().toDisplayString(); primaryStage.setTitle(title); InputStream icon = getClass().getResourceAsStream("/icon.png"); primaryStage.getIcons().add(new Image(icon)); diff --git a/common/pom.xml b/common/pom.xml index 37954ec0..37f1ee63 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -8,7 +8,7 @@ ctbrec master - 5.3.0 + 25.05.04 ../master diff --git a/common/src/main/java/ctbrec/Version.java b/common/src/main/java/ctbrec/Version.java index c9ef90af..f79c6735 100644 --- a/common/src/main/java/ctbrec/Version.java +++ b/common/src/main/java/ctbrec/Version.java @@ -14,6 +14,11 @@ public class Version implements Comparable { int revision = 0; String designator = ""; + public String toDisplayString() { + return String.format("%02d.%02d.%02d", major, minor, revision) + + (designator.isEmpty() ? "" : "-" + designator); + } + public static Version of(String s) { Objects.requireNonNull(s, "Version string cannot be null"); Pattern p = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)(?:-(.+))?"); diff --git a/master/pom.xml b/master/pom.xml index cf921a11..0e256e14 100644 --- a/master/pom.xml +++ b/master/pom.xml @@ -11,7 +11,7 @@ ctbrec master pom - 5.3.0 + 25.05.04 ../common @@ -59,6 +59,11 @@ true + + org.codehaus.mojo + versions-maven-plugin + 2.15.0 + diff --git a/server/pom.xml b/server/pom.xml index ab9d8450..cf2bec2e 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -8,7 +8,7 @@ ctbrec master - 5.3.0 + 25.05.04 ../master diff --git a/update-version.sh b/update-version.sh new file mode 100755 index 00000000..70a5b465 --- /dev/null +++ b/update-version.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Usage: ./update-version.sh 1.2.3 +NEW_VERSION=$1 + +if [[ -z "$NEW_VERSION" ]]; then + echo "Usage: $0 " + exit 1 +fi + +echo "Updating Maven project version to $NEW_VERSION..." + +# Step 1: Update the parent POM and all modules +mvn versions:set -DnewVersion="$NEW_VERSION" + +# Step 2: Commit changes +mvn versions:commit + +echo "Version updated to $NEW_VERSION in all modules."