本文整理了Java中com.github.zafarkhaja.semver.Version.incrementPreReleaseVersion()
方法的一些代码示例,展示了Version.incrementPreReleaseVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.incrementPreReleaseVersion()
方法的具体详情如下:
包路径:com.github.zafarkhaja.semver.Version
类名称:Version
方法名:incrementPreReleaseVersion
[英]Increments the pre-release version.
[中]增加预发布版本。
代码示例来源:origin: gradle.plugin.br.com.sabium/gradle-bump
public String nextPreReleaseVersion(final String releaseTag, final String releaseTagPattern) {
if (releaseTag.matches(releaseTagPattern)) {
final Pattern pattern = Pattern.compile(releaseTagPattern);
final Matcher m = pattern.matcher(releaseTag);
m.matches();
Version v = Version.valueOf(m.group(0));
if (!m.group(2).contains("-")) {
v = v.incrementPatchVersion().setPreReleaseVersion("rc").incrementPreReleaseVersion();
} else {
v = v.incrementPreReleaseVersion();
}
return v.toString();
}
return StringUtils.EMPTY;
}
代码示例来源:origin: org.ajoberstar/semver-vcs-api
/**
* Fixed stages will always use pre-release information of the form
* {@code <stage name>.<incremented count>}, where the count is always 1,
* unless the previous version used the same stage. In that case the
* count will be incremented from the previous.
* @param name the name of the stage
* @return a fixed stage
*/
public static Stage fixedStage(String name) {
return new Stage(name, (base, vcs) -> {
Version sanitized = sanitizeStage(base, name, true);
String previousStage = sanitized.getPreReleaseVersion().split("\\.")[0];
if (name.equals(previousStage)) {
return sanitized.incrementPreReleaseVersion();
} else {
return base.setPreReleaseVersion(name).incrementPreReleaseVersion();
}
});
}
代码示例来源:origin: org.ajoberstar/semver-vcs-api
/**
* Floating stages will behave as a fixed stage if the previous versions stage
* either doesn't exist or has a lower precedence. If the previous has a higher
* precedence, the pre-release information will be of the form
* {@code <previous stage>.<previous count>.<stage name>.<incremented count>}.
* @param name the name of the stage
* @return a floating stage
*/
public static Stage floatingStage(String name) {
return new Stage(name, (base, vcs) -> {
Version sanitized = sanitizeStage(base, name, false);
String[] prevStages = sanitized.getPreReleaseVersion().split("\\.");
if (Arrays.binarySearch(prevStages, name) >= 0) {
return sanitized.incrementPreReleaseVersion();
} else if (name.compareTo(prevStages[0]) > 0) {
return sanitized.setPreReleaseVersion(name).incrementPreReleaseVersion();
} else {
return sanitized.setPreReleaseVersion(sanitized.getPreReleaseVersion() + "." + name).incrementPreReleaseVersion();
}
});
}
内容来源于网络,如有侵权,请联系作者删除!