9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 14:59:29 +00:00
Files
Gale/patches/server/0008-Gale-semantic-version.patch
2023-08-21 21:46:38 +02:00

73 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 9 Aug 2023 19:04:22 +0200
Subject: [PATCH] Gale semantic version
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 2868dab7b100d9c325b0e5056f86660d631dec4b..2acad4c3fd58178b0f8b22bdb04eeeeb689d5afa 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -923,6 +923,16 @@ public class Metrics {
}));
// Gale end - metrics - runtime max memory
+ // Gale start - semantic version - include in metrics
+ Map<String, Map<String, Integer>> semanticVersionMap = new HashMap<>(2);
+ {
+ Map<String, Integer> entry = new HashMap<>(2);
+ entry.put(org.galemc.gale.version.GaleSemanticVersion.version, 1);
+ semanticVersionMap.put(org.galemc.gale.version.GaleSemanticVersion.majorMinorVersion, entry);
+ }
+ metrics.addCustomChart(new Metrics.DrilldownPie("gale_semantic_version", () -> semanticVersionMap));
+ // Gale end - semantic version - include in metrics
+
}
}
diff --git a/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java b/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java
new file mode 100644
index 0000000000000000000000000000000000000000..ba5ba96bbf5250005aca24aa808ef363899dd161
--- /dev/null
+++ b/src/main/java/org/galemc/gale/version/GaleSemanticVersion.java
@@ -0,0 +1,37 @@
+// Gale - semantic version
+
+package org.galemc.gale.version;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A holder for the Gale semantic version.
+ */
+public final class GaleSemanticVersion {
+
+ private GaleSemanticVersion() {
+ throw new RuntimeException();
+ }
+
+ /**
+ * A semantic version in the format "<code>major.minor.patch</code>", for example "<code>1.5.1</code>".
+ * The <code>major</code> version is incremented when a large and overarching set of features, with a large
+ * and overarching common goal or effect, has been added compared to the first release with that major version.
+ * The <code>minor</code> version is incremented for each build that has a different intended feature set
+ * (for example, some features or part of them were added or removed).
+ * The <code>patch</code> version is incremented for small changes that do not affect the goal of any feature,
+ * such as bug fixes, performance improvements or changes in wording.
+ */
+ public static final @NotNull String version = "0.5.5";
+
+ /**
+ * The "<code>major.minor</code>" portion of the {@link #version}.
+ */
+ public static final @NotNull String majorMinorVersion;
+ static {
+ int firstDotIndex = version.indexOf('.');
+ int secondDotIndex = version.indexOf('.', firstDotIndex + 1);
+ majorMinorVersion = version.substring(0, secondDotIndex);
+ }
+
+}