From 56bb639dab71455fe8bc19491ecff644375716f4 Mon Sep 17 00:00:00 2001 From: Paul Hristea Date: Thu, 15 Oct 2026 20:53:14 +0300 Subject: [PATCH] Amend versioning strategy Surface amended version over API and About section Signed-off-by: Paul Hristea --- CONTRIBUTING.md | 11 +++++++++++ .../com/mirth/connect/client/ui/AboutMirth.java | 4 ++++ .../java/com/mirth/connect/client/ui/Frame.java | 1 + .../com/mirth/connect/client/ui/PlatformUI.java | 1 + server/build.gradle | 9 ++++++++- .../java/com/mirth/connect/client/core/Client.java | 10 ++++++++++ .../api/servlets/ConfigurationServletInterface.java | 7 +++++++ .../server/api/servlets/ConfigurationServlet.java | 13 +++++++++++++ .../server/controllers/ConfigurationController.java | 8 ++++++++ .../controllers/DefaultConfigurationController.java | 5 +++++ 10 files changed, 68 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17ec55d4c..233fed010 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,6 +38,17 @@ The build is driven by Gradle through the included wrapper; no separate Gradle i ``` On Windows use `gradlew.bat` instead of `./gradlew`. The assembled distribution lands in `server/setup`, the same location the previous Ant build used. For release artifacts, run a clean build: `./gradlew clean build dist`. Windows with SDKMan may generate an error about the file path being too long in the javadoc step, skip this by adding `-x :server:userApiJavadoc` to your Gradle command. +#### Release versioning (API vs installer) + +The runtime API/schema version stays in Gradle `version` / `mirth.version` (currently `4.6.0`). Patch-train releases can carry a four-part build id without changing that API version: + +```bash +./gradlew clean build dist -PbuildVersion=4.6.0.1 +install4jc -release 4.6.0.1 tools/install4j/oie-installer-config.install4j +``` + +`-PbuildVersion` writes `mirth.build` into `version.properties` (shown in About when set). `install4jc -release` sets the installer/media version only. Serializers and channel compatibility continue to use `4.6.0`. + Dependencies are pinned and checksum-verified. To change a dependency version: edit `gradle/libs.versions.toml`, then refresh the checksum metadata **with a cold dependency cache and CI's flags**: ```bash GRADLE_USER_HOME=$(mktemp -d) ./gradlew --write-verification-metadata sha256 build dist -PdisableSigning=true -Pcoverage=true diff --git a/client/src/main/java/com/mirth/connect/client/ui/AboutMirth.java b/client/src/main/java/com/mirth/connect/client/ui/AboutMirth.java index d2bb42a79..8c80da96f 100644 --- a/client/src/main/java/com/mirth/connect/client/ui/AboutMirth.java +++ b/client/src/main/java/com/mirth/connect/client/ui/AboutMirth.java @@ -57,6 +57,10 @@ public void loadContent() { content.append(String.format("%s Server %s\n\n", BrandingConstants.PRODUCT_NAME, PlatformUI.SERVER_VERSION)); } + if (PlatformUI.BUILD_VERSION != null && !PlatformUI.BUILD_VERSION.isEmpty()) { + content.append("Build ").append(PlatformUI.BUILD_VERSION).append("\n\n"); + } + if (PlatformUI.BUILD_DATE != null) { content.append("Built on ").append(PlatformUI.BUILD_DATE).append("\n\n"); } diff --git a/client/src/main/java/com/mirth/connect/client/ui/Frame.java b/client/src/main/java/com/mirth/connect/client/ui/Frame.java index 7663e346a..2fd4fd222 100644 --- a/client/src/main/java/com/mirth/connect/client/ui/Frame.java +++ b/client/src/main/java/com/mirth/connect/client/ui/Frame.java @@ -625,6 +625,7 @@ public void setupFrame(Client mirthClient) throws ClientException { setTitle(getTitle() + " - (" + PlatformUI.SERVER_VERSION + ")"); PlatformUI.BUILD_DATE = mirthClient.getBuildDate(); + PlatformUI.BUILD_VERSION = mirthClient.getBuildVersion(); // Initialize ObjectXMLSerializer once we know the server version try { diff --git a/client/src/main/java/com/mirth/connect/client/ui/PlatformUI.java b/client/src/main/java/com/mirth/connect/client/ui/PlatformUI.java index 8d40400ed..923a1f675 100644 --- a/client/src/main/java/com/mirth/connect/client/ui/PlatformUI.java +++ b/client/src/main/java/com/mirth/connect/client/ui/PlatformUI.java @@ -35,6 +35,7 @@ public class PlatformUI { public static String CLIENT_VERSION; public static String SERVER_VERSION; public static String BUILD_DATE; + public static String BUILD_VERSION; public static Color DEFAULT_BACKGROUND_COLOR = ServerSettings.DEFAULT_COLOR; public static Color BOLD_RED_BACKGROUND_COLOR = Color.decode("#D40E21"); public static String[] HTTPS_PROTOCOLS = MirthSSLUtil.DEFAULT_HTTPS_CLIENT_PROTOCOLS; diff --git a/server/build.gradle b/server/build.gradle index d928023bb..88cab7a41 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -53,7 +53,9 @@ compileTestJava { def generateVersionProperties = tasks.register('generateVersionProperties') { description = 'Generates version.properties (embedded in mirth-client-core.jar).' def outFile = file('version.properties') + def buildVersion = providers.gradleProperty('buildVersion').orElse('').get() inputs.property 'version', version + inputs.property 'buildVersion', buildVersion // the date must be computed at execution time, not when the daemon // happened to configure the project inputs.property 'date', project.providers.provider { @@ -62,7 +64,12 @@ def generateVersionProperties = tasks.register('generateVersionProperties') { outputs.file outFile doLast { def buildDate = new SimpleDateFormat('MMMM d, yyyy', Locale.US).format(new Date()) - outFile.text = "mirth.version=${version}\nmirth.date=${buildDate}\n" + def text = "mirth.version=${version}\nmirth.date=${buildDate}\n" + + if (buildVersion) { + text += "mirth.build=${buildVersion}\n" + } + outFile.text = text } } diff --git a/server/src/main/java/com/mirth/connect/client/core/Client.java b/server/src/main/java/com/mirth/connect/client/core/Client.java index eaa261fc7..c31bc28b5 100644 --- a/server/src/main/java/com/mirth/connect/client/core/Client.java +++ b/server/src/main/java/com/mirth/connect/client/core/Client.java @@ -558,6 +558,16 @@ public String getBuildDate() throws ClientException { return getServlet(ConfigurationServletInterface.class).getBuildDate(); } + /** + * Returns the patch-train build id of the server. + * + * @see ConfigurationServletInterface#getBuildVersion + */ + @Override + public String getBuildVersion() throws ClientException { + return getServlet(ConfigurationServletInterface.class).getBuildVersion(); + } + /** * Returns the status of the server. * diff --git a/server/src/main/java/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java b/server/src/main/java/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java index 9f8d391bf..619bc1f1a 100644 --- a/server/src/main/java/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java +++ b/server/src/main/java/com/mirth/connect/client/core/api/servlets/ConfigurationServletInterface.java @@ -84,6 +84,13 @@ public interface ConfigurationServletInterface extends BaseServletInterface { @MirthOperation(name = "getBuildDate", display = "Get build date", auditable = false) public String getBuildDate() throws ClientException; + @GET + @Path("/buildVersion") + @Produces(MediaType.TEXT_PLAIN) + @Operation(summary = "Returns the patch-train build id of the server.") + @MirthOperation(name = "getBuildVersion", display = "Get build version", auditable = false) + public String getBuildVersion() throws ClientException; + @GET @Path("/status") @Operation(summary = "Returns the status of the server.") diff --git a/server/src/main/java/com/mirth/connect/server/api/servlets/ConfigurationServlet.java b/server/src/main/java/com/mirth/connect/server/api/servlets/ConfigurationServlet.java index 67dd3419f..b579a3cfe 100644 --- a/server/src/main/java/com/mirth/connect/server/api/servlets/ConfigurationServlet.java +++ b/server/src/main/java/com/mirth/connect/server/api/servlets/ConfigurationServlet.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.SecurityContext; import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -95,6 +96,13 @@ public String getBuildDate() { return configurationController.getBuildDate(); } + @Override + @DontCheckAuthorized + public String getBuildVersion() { + // Authorization not required + return configurationController.getBuildVersion(); + } + @Override @DontCheckAuthorized public int getStatus() { @@ -123,6 +131,11 @@ public Map getAbout() { properties.put("name", configurationController.getServerName()); properties.put("version", configurationController.getServerVersion()); properties.put("date", configurationController.getBuildDate()); + String buildVersion = configurationController.getBuildVersion(); + + if (StringUtils.isNotBlank(buildVersion)) { + properties.put("build", buildVersion); + } properties.put("database", configurationController.getDatabaseType()); properties.put("channelCount", channelController.getChannelIds().size()); diff --git a/server/src/main/java/com/mirth/connect/server/controllers/ConfigurationController.java b/server/src/main/java/com/mirth/connect/server/controllers/ConfigurationController.java index e4a9ce88c..5eb9d25b8 100644 --- a/server/src/main/java/com/mirth/connect/server/controllers/ConfigurationController.java +++ b/server/src/main/java/com/mirth/connect/server/controllers/ConfigurationController.java @@ -242,6 +242,14 @@ public static ConfigurationController getInstance() { */ public abstract String getBuildDate(); + /** + * Returns the patch-train build id (ex. 4.6.0.1), or null/empty when unset. + * Distinct from {@link #getServerVersion()}, which is the API/schema version. + * + * @return the build version, or null/empty if not set + */ + public abstract String getBuildVersion(); + /** * The maximum amount of time that a session can be idle before it is invalidated. */ diff --git a/server/src/main/java/com/mirth/connect/server/controllers/DefaultConfigurationController.java b/server/src/main/java/com/mirth/connect/server/controllers/DefaultConfigurationController.java index bfee2eddb..3d68c1c41 100644 --- a/server/src/main/java/com/mirth/connect/server/controllers/DefaultConfigurationController.java +++ b/server/src/main/java/com/mirth/connect/server/controllers/DefaultConfigurationController.java @@ -763,6 +763,11 @@ public String getBuildDate() { return versionConfig.getString("mirth.date"); } + @Override + public String getBuildVersion() { + return versionConfig.getString("mirth.build", ""); + } + @Override public int getMaxInactiveSessionInterval() { return maxInactiveSessionInterval;