The version is now calculated internally.

This commit is contained in:
Erik C. Thauvin 2019-04-14 22:25:01 -07:00
parent 909b03e861
commit 6455662d23
10 changed files with 60 additions and 198 deletions

View file

@ -122,7 +122,7 @@ public class VersionInfo {
*
* @param buildMetaPrefix The meta-data prefix.
*/
public void setBuildMetaPrefix(String buildMetaPrefix) {
public void setBuildMetaPrefix(final String buildMetaPrefix) {
this.buildMetaPrefix = buildMetaPrefix;
}
@ -140,7 +140,7 @@ public class VersionInfo {
*
* @param className The new class name.
*/
public void setClassName(String className) {
public void setClassName(final String className) {
this.className = className;
}
@ -203,7 +203,7 @@ public class VersionInfo {
*
* @param packageName The new package name.
*/
public void setPackageName(String packageName) {
public void setPackageName(final String packageName) {
this.packageName = packageName;
}
@ -257,7 +257,7 @@ public class VersionInfo {
*
* @param preReleasePrefix The new pre-release prefix.
*/
public void setPreReleasePrefix(String preReleasePrefix) {
public void setPreReleasePrefix(final String preReleasePrefix) {
this.preReleasePrefix = preReleasePrefix;
}
@ -279,6 +279,14 @@ public class VersionInfo {
this.project = project;
}
/**
* Sames as {@link #getVersion()}
*/
public String getSemver() {
return getVersion();
}
/**
* Returns the version separator.
*
@ -289,11 +297,11 @@ public class VersionInfo {
}
/**
* Setsthe version separtor.
* Sets the version separator.
*
* @param separator The new version separator.
*/
public void setSeparator(String separator) {
public void setSeparator(final String separator) {
this.separator = separator;
}

View file

@ -1,11 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Semantic Version Annotation Processor</TITLE>
</HEAD>
<BODY>
An annotation processor that automatically generates a <code>GeneratedVersion</code> class containing the semantic version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.
<html lang="en">
<head>
<title>Semantic Version Annotation Processor</title>
</head>
<body>
An annotation processor that automatically generates a <code>GeneratedVersion</code> class containing the semantic
version (major, minor, patch, etc.) that is read from a Properties file or defined in the annotation.
@since 1.0
</BODY>
</HTML>
</body>
</html>

View file

@ -32,42 +32,6 @@ object {{className}} {
val BUILDMEATA_PREFIX = "{{buildMetaPrefix}}"
@JvmField
val SEPARATOR = "{{separator}}"
/**
* The full semantic version string.
*/
@JvmField
val VERSION = "$MAJOR$SEPARATOR$MINOR$SEPARATOR$PATCH" + preReleaseWithPrefix() + buildMetaWithPrefix()
/**
* Returns the pre-release version with prefix.
*
* @param prefix The prefix, defaults to [PRERELEASE_PREFIX].
* @return The pre-release version, if any.
*/
@JvmStatic
@JvmOverloads
fun preReleaseWithPrefix(prefix: String = PRERELEASE_PREFIX): String {
return if (PRERELEASE.isNotEmpty()) {
"$prefix$PRERELEASE"
} else {
PRERELEASE
}
}
/**
* Returns the build metadata with prefix.
*
* @param prefix The prefix, defaults to [BUILDMEATA_PREFIX].
* @return The build metadata, if any.
*/
@JvmStatic
@JvmOverloads
fun buildMetaWithPrefix(prefix: String = BUILDMEATA_PREFIX): String {
return if (BUILDMETA.isNotEmpty()) {
"$prefix$BUILDMETA"
} else {
BUILDMETA
}
}
val VERSION = "{{version}}"
}

View file

@ -22,12 +22,7 @@ public final class {{className}} {
public final static String BUILDMETA = "{{buildMeta}}";
public final static String BUILDMETA_PREFIX = "{{buildMetaPrefix}}";
public final static String SEPARATOR = "{{separator}}";
/**
* The full semantic version string.
*/
public final static String VERSION = Integer.toString(MAJOR) + SEPARATOR + Integer.toString(MINOR) + SEPARATOR
+ Integer.toString(PATCH) + preReleaseWithPrefix() + buildMetaWithPrefix();
public final static String VERSION = "{{version}}";
/**
* Disables the default constructor.
@ -35,50 +30,4 @@ public final class {{className}} {
private {{className}}() {
throw new UnsupportedOperationException("Illegal constructor call.");
}
/**
* Returns the build metadata with {@value #BUILDMETA_PREFIX} prefix.
*
* @return The build metadata, if any.
*/
public static String buildMetaWithPrefix() {
return buildMetaWithPrefix(BUILDMETA_PREFIX);
}
/**
* Returns the build metadata.
*
* @param prefix Prefix to prepend.
* @return The build metadata, if any.
*/
public static String buildMetaWithPrefix(final String prefix) {
if (BUILDMETA.length() > 0) {
return prefix + BUILDMETA;
} else {
return BUILDMETA;
}
}
/**
* Returns the pre-release version with {@value #PRERELEASE_PREFIX} prefix.
*
* @return The pre-release version, if any.
*/
public static String preReleaseWithPrefix() {
return preReleaseWithPrefix(PRERELEASE_PREFIX);
}
/**
* Returns the pre-release version.
*
* @param prefix The prefix to prepend.
* @return The pre-release version, if any.
*/
public static String preReleaseWithPrefix(final String prefix) {
if (PRERELEASE.length() > 0) {
return prefix + PRERELEASE;
} else {
return PRERELEASE;
}
}
}