File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/main/java/org/scijava/util Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,18 @@ public static String getVersionFromPOM(final Class<?> c,
9999 return pom == null ? null : pom .getVersion ();
100100 }
101101
102+ /**
103+ * Looks up the build number (typically an SCM revision) of the specified
104+ * class. This information is retrieved from the JAR manifest's
105+ * <code>Implementation-Build</code> entry, or null if no such value exists.
106+ *
107+ * @param c - Look up this class's build number
108+ * @return Build number of specified {@link Class} or null if not found.
109+ */
110+ public static String getBuildNumber (final Class <?> c ) {
111+ return getBuildNumber (Manifest .getManifest (c ));
112+ }
113+
102114 // -- Helper methods --
103115
104116 private static String getVersionFromManifest (final Manifest m ) {
@@ -107,4 +119,8 @@ private static String getVersionFromManifest(final Manifest m) {
107119 return m .getSpecificationVersion ();
108120 }
109121
122+ private static String getBuildNumber (final Manifest m ) {
123+ return m == null ? null : m .getImplementationBuild ();
124+ }
125+
110126}
You can’t perform that action at this time.
0 commit comments