Added keysPrefix property.
This commit is contained in:
parent
9e899b2d88
commit
26e43b09d4
4 changed files with 49 additions and 57 deletions
|
@ -51,6 +51,10 @@ public final class Constants {
|
|||
* The default java type.
|
||||
**/
|
||||
public static final String DEFAULT_JAVA_TYPE = "java";
|
||||
/**
|
||||
* The default keys prefix.
|
||||
*/
|
||||
public static final String DEFAULT_KEYS_PREFIX = "version." ;
|
||||
/**
|
||||
* The default Kotlin mustache template.
|
||||
*/
|
||||
|
@ -70,7 +74,7 @@ public final class Constants {
|
|||
/**
|
||||
* The default mustache template.
|
||||
*/
|
||||
public static final String DEFAULT_TEMPLATE_NAME = "version.mustache";
|
||||
public static final String DEFAULT_TEMPLATE_NAME = "mustache";
|
||||
/**
|
||||
* The empty string.
|
||||
*/
|
||||
|
@ -78,27 +82,27 @@ public final class Constants {
|
|||
/**
|
||||
* The build metadata property key.
|
||||
*/
|
||||
public static final String KEY_VERSION_BUILDMETA = "version.buildmeta";
|
||||
public static final String KEY_VERSION_BUILDMETA = "buildmeta";
|
||||
/**
|
||||
* The major version property key.
|
||||
*/
|
||||
public static final String KEY_VERSION_MAJOR = "version.major";
|
||||
public static final String KEY_VERSION_MAJOR = "major";
|
||||
/**
|
||||
* The minor version property key.
|
||||
*/
|
||||
public static final String KEY_VERSION_MINOR = "version.minor";
|
||||
public static final String KEY_VERSION_MINOR = "minor";
|
||||
/**
|
||||
* The patch version property key.
|
||||
*/
|
||||
public static final String KEY_VERSION_PATCH = "version.patch";
|
||||
public static final String KEY_VERSION_PATCH = "patch";
|
||||
/**
|
||||
* The pre-release version property key.
|
||||
*/
|
||||
public static final String KEY_VERSION_PRERELEASE = "version.prerelease";
|
||||
public static final String KEY_VERSION_PRERELEASE = "prerelease";
|
||||
/**
|
||||
* The project property key.
|
||||
*/
|
||||
public static final String KEY_VERSION_PROJECT = "version.project";
|
||||
public static final String KEY_VERSION_PROJECT = "project";
|
||||
/**
|
||||
* The kotlin type.
|
||||
*/
|
||||
|
|
|
@ -79,4 +79,6 @@ public @interface Version {
|
|||
String template() default Constants.DEFAULT_JAVA_TEMPLATE;
|
||||
|
||||
String type() default Constants.DEFAULT_JAVA_TYPE;
|
||||
|
||||
String keysPefix() default Constants.DEFAULT_KEYS_PREFIX;
|
||||
}
|
|
@ -82,12 +82,18 @@ public class VersionProcessor extends AbstractProcessor {
|
|||
try (FileReader reader = new FileReader(propsFile)) {
|
||||
p.load(reader);
|
||||
|
||||
versionInfo.setProject(p.getProperty(version.projectKey(), version.project()));
|
||||
versionInfo.setMajor(parseIntProperty(p, version.majorKey(), version.major()));
|
||||
versionInfo.setMinor(parseIntProperty(p, version.minorKey(), version.minor()));
|
||||
versionInfo.setPatch(parseIntProperty(p, version.patchKey(), version.patch()));
|
||||
versionInfo.setBuildMeta(p.getProperty(version.buildMetaKey(), version.buildMeta()));
|
||||
versionInfo.setPreRelease(p.getProperty(version.preReleaseKey(), version.preRelease()));
|
||||
versionInfo.setProject(
|
||||
p.getProperty(version.keysPefix() + version.projectKey(), version.project()));
|
||||
versionInfo.setMajor(
|
||||
parseIntProperty(p, version.keysPefix() + version.majorKey(), version.major()));
|
||||
versionInfo.setMinor(
|
||||
parseIntProperty(p, version.keysPefix() + version.minorKey(), version.minor()));
|
||||
versionInfo.setPatch(
|
||||
parseIntProperty(p, version.keysPefix() + version.patchKey(), version.patch()));
|
||||
versionInfo.setBuildMeta(
|
||||
p.getProperty(version.keysPefix() + version.buildMetaKey(), version.buildMeta()));
|
||||
versionInfo.setPreRelease(
|
||||
p.getProperty(version.keysPefix() + version.preReleaseKey(), version.preRelease()));
|
||||
}
|
||||
} else {
|
||||
error("Could not find: " + propsFile);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue