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

@ -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;
}
}
}