From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers 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 7e1405d5e2b847b28b07cb94fcbf5dec78706e34..66477f772ffb9271cf647dfb7567d75c3d5145fb 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> semanticVersionMap = new HashMap<>(2); + { + Map 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..f873cac7566e1951fc2977d6f7c4ba3cefa1a9f1 --- /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 "major.minor.patch", for example "1.5.1". + * The major 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 minor 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 patch 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.6.15"; + + /** + * The "major.minor" 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); + } + +}