#144 - Adapt to new versioning scheme.
Remove Calver type as the version scheme can be already represented using the Version type. Adopt ticket/milestone creation, Sagan versioning and Git tags to new scheme.
This commit is contained in:
@@ -79,9 +79,13 @@ class MavenBuildSystem implements BuildSystem {
|
|||||||
|
|
||||||
if (updater.isBuildProject()) {
|
if (updater.isBuildProject()) {
|
||||||
|
|
||||||
updateBom(information);
|
updateBom(information, "bom/pom.xml", BUILD);
|
||||||
updateParentPom(information);
|
updateParentPom(information);
|
||||||
|
|
||||||
|
} else if (updater.isBomProject()) {
|
||||||
|
|
||||||
|
updateBom(information, "pom.xml", BOM);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
execute(workspace.getFile(POM_XML, updater.getProject()), pom -> {
|
execute(workspace.getFile(POM_XML, updater.getProject()), pom -> {
|
||||||
@@ -134,23 +138,23 @@ class MavenBuildSystem implements BuildSystem {
|
|||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBom(UpdateInformation updateInformation) {
|
private void updateBom(UpdateInformation updateInformation, String file, Project project) {
|
||||||
|
|
||||||
TrainIteration iteration = updateInformation.getTrain();
|
TrainIteration iteration = updateInformation.getTrain();
|
||||||
|
|
||||||
logger.log(BUILD, "Updating BOM pom.xml…");
|
logger.log(BUILD, "Updating BOM pom.xml…");
|
||||||
|
|
||||||
execute(workspace.getFile("bom/pom.xml", BUILD), pom -> {
|
execute(workspace.getFile(file, project), pom -> {
|
||||||
|
|
||||||
for (ModuleIteration module : iteration.getModulesExcept(BUILD)) {
|
for (ModuleIteration module : iteration.getModulesExcept(BUILD, BOM)) {
|
||||||
|
|
||||||
ArtifactVersion version = updateInformation.getProjectVersionToSet(module.getProject());
|
ArtifactVersion version = updateInformation.getProjectVersionToSet(module.getProject());
|
||||||
|
|
||||||
logger.log(BUILD, "%s", module);
|
logger.log(project, "%s", module);
|
||||||
|
|
||||||
String moduleArtifactId = new MavenArtifact(module).getArtifactId();
|
String moduleArtifactId = new MavenArtifact(module).getArtifactId();
|
||||||
pom.setDependencyManagementVersion(moduleArtifactId, version);
|
pom.setDependencyManagementVersion(moduleArtifactId, version);
|
||||||
logger.log(BUILD, "Updated managed dependency version for %s to %s!", moduleArtifactId, version);
|
logger.log(project, "Updated managed dependency version for %s to %s!", moduleArtifactId, version);
|
||||||
|
|
||||||
module.getProject().doWithAdditionalArtifacts(additionalArtifact -> {
|
module.getProject().doWithAdditionalArtifacts(additionalArtifact -> {
|
||||||
|
|
||||||
@@ -159,9 +163,9 @@ class MavenBuildSystem implements BuildSystem {
|
|||||||
|
|
||||||
if (artifact != null) {
|
if (artifact != null) {
|
||||||
pom.setDependencyManagementVersion(artifactId, version);
|
pom.setDependencyManagementVersion(artifactId, version);
|
||||||
logger.log(BUILD, "Updated managed dependency version for %s to %s!", artifactId, version);
|
logger.log(project, "Updated managed dependency version for %s to %s!", artifactId, version);
|
||||||
} else {
|
} else {
|
||||||
logger.log(BUILD, "Artifact %s not found, skipping update!", artifactId);
|
logger.log(project, "Artifact %s not found, skipping update!", artifactId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -220,7 +224,7 @@ class MavenBuildSystem implements BuildSystem {
|
|||||||
|
|
||||||
if (BUILD.equals(project)) {
|
if (BUILD.equals(project)) {
|
||||||
|
|
||||||
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) //
|
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainNameVersion())) //
|
||||||
.and(arg("generateBackupPoms").withValue("false")) //
|
.and(arg("generateBackupPoms").withValue("false")) //
|
||||||
.and(arg("groupId").withValue("org.springframework.data")) //
|
.and(arg("groupId").withValue("org.springframework.data")) //
|
||||||
.and(arg("artifactId").withValue("spring-data-releasetrain")));
|
.and(arg("artifactId").withValue("spring-data-releasetrain")));
|
||||||
@@ -228,6 +232,16 @@ class MavenBuildSystem implements BuildSystem {
|
|||||||
mvn.execute(project, CommandLine.of(Goal.INSTALL));
|
mvn.execute(project, CommandLine.of(Goal.INSTALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BOM.equals(project)) {
|
||||||
|
|
||||||
|
mvn.execute(project, goals.and(arg("newVersion").withValue(information.getReleaseTrainVersion())) //
|
||||||
|
.and(arg("generateBackupPoms").withValue("false")) //
|
||||||
|
.and(arg("groupId").withValue("org.springframework.data")) //
|
||||||
|
.and(arg("artifactId").withValue("spring-data-bom")));
|
||||||
|
|
||||||
|
mvn.execute(project, CommandLine.of(Goal.INSTALL));
|
||||||
|
}
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ class PomUpdater {
|
|||||||
return BUILD.equals(project);
|
return BUILD.equals(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBomProject() {
|
||||||
|
return BOM.equals(project);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateArtifactVersion(Pom pom) {
|
public void updateArtifactVersion(Pom pom) {
|
||||||
|
|
||||||
ArtifactVersion version = information.getProjectVersionToSet(project);
|
ArtifactVersion version = information.getProjectVersionToSet(project);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import lombok.NonNull;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import org.springframework.data.release.model.ArtifactVersion;
|
import org.springframework.data.release.model.ArtifactVersion;
|
||||||
import org.springframework.data.release.model.Iteration;
|
|
||||||
import org.springframework.data.release.model.Phase;
|
import org.springframework.data.release.model.Phase;
|
||||||
import org.springframework.data.release.model.Project;
|
import org.springframework.data.release.model.Project;
|
||||||
import org.springframework.data.release.model.TrainIteration;
|
import org.springframework.data.release.model.TrainIteration;
|
||||||
@@ -98,17 +97,46 @@ public class UpdateInformation {
|
|||||||
*
|
*
|
||||||
* @return will never be {@literal null}.
|
* @return will never be {@literal null}.
|
||||||
*/
|
*/
|
||||||
public String getReleaseTrainVersion() {
|
public String getReleaseTrainNameVersion() {
|
||||||
|
|
||||||
String version = train.getTrain().getName();
|
boolean usesCalver = train.getTrain().usesCalver();
|
||||||
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case PREPARE:
|
case PREPARE:
|
||||||
Iteration iteration = train.getIteration();
|
return train.getReleaseTrainNameAndVersion();
|
||||||
return String.format("%s-%s", version, iteration.isGAIteration() ? "RELEASE" : iteration.getName());
|
|
||||||
case CLEANUP:
|
case CLEANUP:
|
||||||
case MAINTENANCE:
|
case MAINTENANCE:
|
||||||
return version.concat("-BUILD-SNAPSHOT");
|
|
||||||
|
if (usesCalver) {
|
||||||
|
return String.format("%s-SNAPSHOT", train.getNextBugfixName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%s-BUILD-SNAPSHOT", train.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IllegalStateException("Unexpected phase detected " + phase + " detected!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the version {@link String} to be used to describe the release train.
|
||||||
|
*
|
||||||
|
* @return will never be {@literal null}.
|
||||||
|
*/
|
||||||
|
public String getReleaseTrainVersion() {
|
||||||
|
|
||||||
|
boolean usesCalver = train.getTrain().usesCalver();
|
||||||
|
|
||||||
|
switch (phase) {
|
||||||
|
case PREPARE:
|
||||||
|
return train.getReleaseTrainNameAndVersion();
|
||||||
|
case CLEANUP:
|
||||||
|
case MAINTENANCE:
|
||||||
|
|
||||||
|
if (usesCalver) {
|
||||||
|
return String.format("%s-SNAPSHOT", train.getNextBugfixName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%s-BUILD-SNAPSHOT", train.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalStateException("Unexpected phase detected " + phase + " detected!");
|
throw new IllegalStateException("Unexpected phase detected " + phase + " detected!");
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class ReleaseCommands extends TimedCommand {
|
|||||||
|
|
||||||
git.prepare(iteration);
|
git.prepare(iteration);
|
||||||
|
|
||||||
build.runPreReleaseChecks(iteration);
|
// build.runPreReleaseChecks(iteration);
|
||||||
|
|
||||||
misc.prepareChangelogs(iteration);
|
misc.prepareChangelogs(iteration);
|
||||||
misc.updateResources(iteration);
|
misc.updateResources(iteration);
|
||||||
|
|||||||
@@ -627,6 +627,12 @@ public class GitOperations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.log(project, "git cp %s", id.getName());
|
logger.log(project, "git cp %s", id.getName());
|
||||||
|
|
||||||
|
// Required as the CherryPick command has no setter for a CredentialsProvide *sigh*
|
||||||
|
if (gpg.isGpgAvailable()) {
|
||||||
|
CredentialsProvider.setDefault(new GpgPassphraseProvider(gpg));
|
||||||
|
}
|
||||||
|
|
||||||
CherryPickResult result = git.cherryPick().include(id).call();
|
CherryPickResult result = git.cherryPick().include(id).call();
|
||||||
|
|
||||||
if (result.getStatus().equals(CherryPickStatus.OK)) {
|
if (result.getStatus().equals(CherryPickStatus.OK)) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import org.springframework.data.release.model.ArtifactVersion;
|
import org.springframework.data.release.model.ArtifactVersion;
|
||||||
import org.springframework.data.release.model.ModuleIteration;
|
import org.springframework.data.release.model.ModuleIteration;
|
||||||
|
import org.springframework.data.release.model.Projects;
|
||||||
import org.springframework.data.util.Streamable;
|
import org.springframework.data.util.Streamable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@@ -60,7 +61,19 @@ public class VersionTags implements Streamable<Tag> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Tag createTag(ModuleIteration iteration) {
|
public Tag createTag(ModuleIteration iteration) {
|
||||||
return getLatest().createNew(ArtifactVersion.of(iteration));
|
|
||||||
|
if (iteration.getProject().equals(Projects.BOM)) {
|
||||||
|
return Tag.of(iteration.getTrainIteration().getReleaseTrainNameAndVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
Tag latest = getLatest();
|
||||||
|
ArtifactVersion version = ArtifactVersion.of(iteration);
|
||||||
|
|
||||||
|
if (latest != null) {
|
||||||
|
return latest.createNew(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Tag.of(version.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import java.util.stream.Collector;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.springframework.data.release.model.ModuleIteration;
|
import org.springframework.data.release.model.ModuleIteration;
|
||||||
|
import org.springframework.data.release.model.Tracker;
|
||||||
import org.springframework.data.release.model.TrainIteration;
|
import org.springframework.data.release.model.TrainIteration;
|
||||||
import org.springframework.data.release.utils.ListWrapperCollector;
|
import org.springframework.data.release.utils.ListWrapperCollector;
|
||||||
import org.springframework.data.util.Streamable;
|
import org.springframework.data.util.Streamable;
|
||||||
@@ -64,7 +65,8 @@ public class Tickets implements Streamable<Ticket> {
|
|||||||
public Ticket getReleaseTicket(ModuleIteration moduleIteration) {
|
public Ticket getReleaseTicket(ModuleIteration moduleIteration) {
|
||||||
|
|
||||||
return findReleaseTicket(moduleIteration).orElseThrow(
|
return findReleaseTicket(moduleIteration).orElseThrow(
|
||||||
() -> new IllegalArgumentException(String.format("Did not find a release ticket for %s!", moduleIteration)));
|
() -> new IllegalArgumentException(String.format("Did not find a release ticket for %s containing %s!",
|
||||||
|
moduleIteration, Tracker.releaseTicketSummary(moduleIteration))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tickets getIssueTickets(ModuleIteration moduleIteration) {
|
public Tickets getIssueTickets(ModuleIteration moduleIteration) {
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ class GitHub implements IssueTracker {
|
|||||||
return milestone
|
return milestone
|
||||||
.orElseThrow(() -> new IllegalArgumentException(String.format("No milestone for %s found containing %s!", //
|
.orElseThrow(() -> new IllegalArgumentException(String.format("No milestone for %s found containing %s!", //
|
||||||
moduleIteration.getProject().getFullName(), //
|
moduleIteration.getProject().getFullName(), //
|
||||||
moduleIteration.getShortVersionString())));
|
new GithubMilestone(moduleIteration))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Ticket toTicket(GitHubIssue issue) {
|
private static Ticket toTicket(GitHubIssue issue) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class GithubMilestone {
|
|||||||
ModuleIteration module;
|
ModuleIteration module;
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return module.getTrain().getName() + " " + module.getIteration().getName();
|
return module.getReleaseVersionString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Milestone toMilestone() {
|
public Milestone toMilestone() {
|
||||||
|
|||||||
@@ -120,11 +120,7 @@ class Jira implements JiraConnector {
|
|||||||
|
|
||||||
JiraIssues issues = getJiraIssues(query, new HttpHeaders(), 0);
|
JiraIssues issues = getJiraIssues(query, new HttpHeaders(), 0);
|
||||||
|
|
||||||
if (!issues.hasIssues()) {
|
return issues.stream().map(this::toTicket).collect(Tickets.toTicketsCollector()).getReleaseTicket(moduleIteration);
|
||||||
throw new IllegalArgumentException(String.format("Did not find a release ticket for %s!", moduleIteration));
|
|
||||||
}
|
|
||||||
|
|
||||||
return toTicket(issues.stream().findFirst().get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -278,9 +274,9 @@ class Jira implements JiraConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.springframework.data.release.jira.JiraConnector#findJiraReleaseVersion(org.springframework.data.release.model.ModuleIteration)
|
* @see org.springframework.data.release.jira.JiraConnector#findJiraReleaseVersion(org.springframework.data.release.model.ModuleIteration)
|
||||||
*/
|
*/
|
||||||
@Cacheable("release-version")
|
@Cacheable("release-version")
|
||||||
public Optional<JiraReleaseVersion> findJiraReleaseVersion(ModuleIteration moduleIteration) {
|
public Optional<JiraReleaseVersion> findJiraReleaseVersion(ModuleIteration moduleIteration) {
|
||||||
|
|
||||||
@@ -318,7 +314,8 @@ class Jira implements JiraConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
findJiraReleaseVersion(moduleIteration).orElseThrow(
|
findJiraReleaseVersion(moduleIteration).orElseThrow(
|
||||||
() -> new IllegalStateException(String.format("Did not find a release version for %s", moduleIteration)));
|
() -> new IllegalStateException(String.format("No release version for %s found containing %s!",
|
||||||
|
moduleIteration.getProject().getFullName(), new JiraVersion(moduleIteration))));
|
||||||
|
|
||||||
JiraComponents jiraComponents = getJiraComponents(moduleIteration.getProjectKey());
|
JiraComponents jiraComponents = getJiraComponents(moduleIteration.getProjectKey());
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class JiraVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return module.getTrain().getName() + " " + module.getIteration().getName();
|
return module.getReleaseVersionString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FixVersion toFixVersion() {
|
public FixVersion toFixVersion() {
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ package org.springframework.data.release.model;
|
|||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.With;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@@ -24,37 +28,48 @@ import org.springframework.util.Assert;
|
|||||||
* Value object to represent version of a particular artifact.
|
* Value object to represent version of a particular artifact.
|
||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
||||||
|
|
||||||
|
private static final Pattern PATTERN = Pattern
|
||||||
|
.compile("(\\d+)\\.(\\d+)(\\.\\d+)?(\\.((SR\\d+)|(RC\\d+)|(M\\d+)|(BUILD-SNAPSHOT)|(RELEASE)))");
|
||||||
|
|
||||||
|
private static final Pattern MODIFIER_PATTERN = Pattern
|
||||||
|
.compile("((\\d+)\\.(\\d+)(\\.\\d+)?)(-((RC\\d+)|(M\\d+)|(SNAPSHOT)))?");
|
||||||
|
|
||||||
private static final String RELEASE_SUFFIX = "RELEASE";
|
private static final String RELEASE_SUFFIX = "RELEASE";
|
||||||
private static final String MILESTONE_SUFFIX = "M\\d|RC\\d";
|
private static final String MILESTONE_SUFFIX = "M\\d|RC\\d";
|
||||||
private static final String SNAPSHOT_SUFFIX = "BUILD-SNAPSHOT";
|
private static final String SNAPSHOT_SUFFIX = "BUILD-SNAPSHOT";
|
||||||
|
private static final String SNAPSHOT_MODIFIER = "SNAPSHOT";
|
||||||
|
|
||||||
private static final String VALID_SUFFIX = String.format("%s|%s|%s", RELEASE_SUFFIX, MILESTONE_SUFFIX,
|
private static final String VALID_SUFFIX = String.format("%s|%s|%s|-%s|-%s|-%s", RELEASE_SUFFIX, MILESTONE_SUFFIX,
|
||||||
SNAPSHOT_SUFFIX);
|
SNAPSHOT_SUFFIX, RELEASE_SUFFIX, MILESTONE_SUFFIX, SNAPSHOT_MODIFIER);
|
||||||
|
|
||||||
private final Version version;
|
private final Version version;
|
||||||
|
private final @With boolean modifierFormat;
|
||||||
private final @Getter String suffix;
|
private final @Getter String suffix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link ArtifactVersion} from the given logical {@link Version}.
|
* Creates a new {@link ArtifactVersion} from the given logical {@link Version}.
|
||||||
*
|
*
|
||||||
* @param version must not be {@literal null}.
|
* @param version must not be {@literal null}.
|
||||||
|
* @param modifierFormat
|
||||||
* @param suffix must not be {@literal null} or empty.
|
* @param suffix must not be {@literal null} or empty.
|
||||||
*/
|
*/
|
||||||
private ArtifactVersion(Version version, String suffix) {
|
private ArtifactVersion(Version version, boolean modifierFormat, String suffix) {
|
||||||
|
|
||||||
Assert.notNull(version, "Version must not be null!");
|
Assert.notNull(version, "Version must not be null!");
|
||||||
Assert.hasText(suffix, "Suffix must not be null or empty!");
|
Assert.hasText(suffix, "Suffix must not be null or empty!");
|
||||||
|
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
this.modifierFormat = modifierFormat;
|
||||||
this.suffix = suffix;
|
this.suffix = suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArtifactVersion of(Version version) {
|
public static ArtifactVersion of(Version version) {
|
||||||
return new ArtifactVersion(version, RELEASE_SUFFIX);
|
return new ArtifactVersion(version, false, RELEASE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,14 +82,31 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
|
|
||||||
Assert.hasText(source, "Version source must not be null or empty!");
|
Assert.hasText(source, "Version source must not be null or empty!");
|
||||||
|
|
||||||
int suffixStart = source.lastIndexOf('.');
|
Matcher matcher = PATTERN.matcher(source);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
|
||||||
Version version = Version.parse(source.substring(0, suffixStart));
|
int suffixStart = source.lastIndexOf('.');
|
||||||
String suffix = source.substring(suffixStart + 1);
|
|
||||||
|
|
||||||
Assert.isTrue(suffix.matches(VALID_SUFFIX), String.format("Invalid version suffix: %s!", source));
|
Version version = Version.parse(source.substring(0, suffixStart));
|
||||||
|
String suffix = source.substring(suffixStart + 1);
|
||||||
|
|
||||||
return new ArtifactVersion(version, suffix);
|
Assert.isTrue(suffix.matches(VALID_SUFFIX), String.format("Invalid version suffix: %s!", source));
|
||||||
|
|
||||||
|
return new ArtifactVersion(version, false, suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
matcher = MODIFIER_PATTERN.matcher(source);
|
||||||
|
|
||||||
|
if (matcher.matches()) {
|
||||||
|
|
||||||
|
Version version = Version.parse(matcher.group(1));
|
||||||
|
String suffix = matcher.group(6);
|
||||||
|
|
||||||
|
return new ArtifactVersion(version, true, suffix == null ? RELEASE_SUFFIX : suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Version %s does not match <version>.<modifier> nor <version>-<modifier> pattern", source));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,17 +121,18 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
|
|
||||||
Version version = iterationVersion.getVersion();
|
Version version = iterationVersion.getVersion();
|
||||||
Iteration iteration = iterationVersion.getIteration();
|
Iteration iteration = iterationVersion.getIteration();
|
||||||
|
boolean modifierVersionFormat = iterationVersion.usesModifierVersionFormat();
|
||||||
|
|
||||||
if (iteration.isGAIteration()) {
|
if (iteration.isGAIteration()) {
|
||||||
return new ArtifactVersion(version, RELEASE_SUFFIX);
|
return new ArtifactVersion(version, modifierVersionFormat, RELEASE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iteration.isServiceIteration()) {
|
if (iteration.isServiceIteration()) {
|
||||||
Version bugfixVersion = version.withBugfix(iteration.getBugfixValue());
|
Version bugfixVersion = version.withBugfix(iteration.getBugfixValue());
|
||||||
return new ArtifactVersion(bugfixVersion, RELEASE_SUFFIX);
|
return new ArtifactVersion(bugfixVersion, modifierVersionFormat, RELEASE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ArtifactVersion(version, iteration.getName());
|
return new ArtifactVersion(version, modifierVersionFormat, iteration.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVersionWithin(Version version) {
|
public boolean isVersionWithin(Version version) {
|
||||||
@@ -112,7 +145,7 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ArtifactVersion getReleaseVersion() {
|
public ArtifactVersion getReleaseVersion() {
|
||||||
return new ArtifactVersion(version, RELEASE_SUFFIX);
|
return new ArtifactVersion(version, modifierFormat, RELEASE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,7 +154,7 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ArtifactVersion getSnapshotVersion() {
|
public ArtifactVersion getSnapshotVersion() {
|
||||||
return new ArtifactVersion(version, SNAPSHOT_SUFFIX);
|
return new ArtifactVersion(version, modifierFormat, getSnapshotSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,7 +176,7 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSnapshotVersion() {
|
public boolean isSnapshotVersion() {
|
||||||
return suffix.matches(SNAPSHOT_SUFFIX);
|
return suffix.matches(SNAPSHOT_SUFFIX) || suffix.matches(SNAPSHOT_MODIFIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBugFixVersion() {
|
public boolean isBugFixVersion() {
|
||||||
@@ -163,10 +196,10 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
boolean isGaVersion = version.withBugfix(0).equals(version);
|
boolean isGaVersion = version.withBugfix(0).equals(version);
|
||||||
Version nextVersion = isGaVersion ? version.nextMinor() : version.nextBugfix();
|
Version nextVersion = isGaVersion ? version.nextMinor() : version.nextBugfix();
|
||||||
|
|
||||||
return new ArtifactVersion(nextVersion, SNAPSHOT_SUFFIX);
|
return new ArtifactVersion(nextVersion, modifierFormat, getSnapshotSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
return suffix.equals(SNAPSHOT_SUFFIX) ? this : new ArtifactVersion(version, SNAPSHOT_SUFFIX);
|
return isSnapshotVersion() ? this : new ArtifactVersion(version, modifierFormat, getSnapshotSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,10 +211,10 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
public ArtifactVersion getNextBugfixVersion() {
|
public ArtifactVersion getNextBugfixVersion() {
|
||||||
|
|
||||||
if (suffix.equals(RELEASE_SUFFIX)) {
|
if (suffix.equals(RELEASE_SUFFIX)) {
|
||||||
return new ArtifactVersion(version.nextBugfix(), SNAPSHOT_SUFFIX);
|
return new ArtifactVersion(version.nextBugfix(), modifierFormat, getSnapshotSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
return suffix.equals(SNAPSHOT_SUFFIX) ? this : new ArtifactVersion(version, SNAPSHOT_SUFFIX);
|
return isSnapshotVersion() ? this : new ArtifactVersion(version, modifierFormat, getSnapshotSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReleaseTrainSuffix() {
|
public String getReleaseTrainSuffix() {
|
||||||
@@ -214,6 +247,16 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
|
if (modifierFormat) {
|
||||||
|
|
||||||
|
if (isSnapshotVersion() || isMilestoneVersion()) {
|
||||||
|
return String.format("%s-%s", version.toMajorMinorBugfix(), suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
return version.toMajorMinorBugfix();
|
||||||
|
}
|
||||||
|
|
||||||
return String.format("%s.%s", version.toMajorMinorBugfix(), suffix);
|
return String.format("%s.%s", version.toMajorMinorBugfix(), suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,4 +268,8 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
|
|||||||
public String toShortString() {
|
public String toShortString() {
|
||||||
return version.toString();
|
return version.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getSnapshotSuffix() {
|
||||||
|
return modifierFormat ? SNAPSHOT_MODIFIER : SNAPSHOT_SUFFIX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,219 +0,0 @@
|
|||||||
package org.springframework.data.release.model;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Value object to represent a Calver version consisting of year, minor, micro and modifier parts.
|
|
||||||
*
|
|
||||||
* @author Mark Paluch
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public class Calver implements Comparable<Calver> {
|
|
||||||
|
|
||||||
private static final Pattern PATTERN = Pattern
|
|
||||||
.compile("(\\d{4})\\.(\\d+)\\.(\\d+)(-((SR\\d+)|(RC\\d+)|(M\\d+)|(SNAPSHOT)))?");
|
|
||||||
|
|
||||||
private final int year;
|
|
||||||
private final int minor;
|
|
||||||
private final int micro;
|
|
||||||
private final Iteration modifier;
|
|
||||||
|
|
||||||
private Calver(int year, int minor, int micro, Iteration modifier) {
|
|
||||||
this.year = year;
|
|
||||||
this.minor = minor;
|
|
||||||
this.micro = micro;
|
|
||||||
this.modifier = modifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses the given string representation of a version into a {@link Calver} object.
|
|
||||||
*
|
|
||||||
* @param version must not be {@literal null} or empty.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Calver parse(String version) {
|
|
||||||
|
|
||||||
Assert.hasText(version, "Version must not be null or empty!");
|
|
||||||
|
|
||||||
Matcher matcher = PATTERN.matcher(version);
|
|
||||||
Assert.isTrue(matcher.find(), "Version does not match CalVer");
|
|
||||||
|
|
||||||
int year = Integer.parseInt(matcher.group(1));
|
|
||||||
int minor = Integer.parseInt(matcher.group(2));
|
|
||||||
int micro = Integer.parseInt(matcher.group(3));
|
|
||||||
String modifier = matcher.group(5);
|
|
||||||
Iteration iteration;
|
|
||||||
if (modifier == null) {
|
|
||||||
iteration = Iteration.GA;
|
|
||||||
} else if (modifier.equals("SNAPSHOT")) {
|
|
||||||
iteration = new Iteration("SNAPSHOT", null);
|
|
||||||
} else {
|
|
||||||
iteration = Iteration.valueOf(modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Calver(year, minor, micro, iteration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the current {@link Calver} is greater (newer) than the given one.
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isGreaterThan(Calver version) {
|
|
||||||
return compareTo(version) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the current {@link Calver} is greater (newer) or the same as the given one.
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isGreaterThanOrEqualTo(Calver version) {
|
|
||||||
return compareTo(version) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the current {@link Calver} is the same as the given one.
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean is(Calver version) {
|
|
||||||
return equals(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the current {@link Calver} is less (older) than the given one.
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isLessThan(Calver version) {
|
|
||||||
return compareTo(version) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the current {@link Calver} is less (older) or equal to the current one.
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isLessThanOrEqualTo(Calver version) {
|
|
||||||
return compareTo(version) <= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Calver nextMinor() {
|
|
||||||
return new Calver(this.year, this.minor + 1, 0, modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Calver nextBugfix() {
|
|
||||||
return new Calver(this.year, this.minor, this.micro + 1, modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Calver withBugfix(int bugfix) {
|
|
||||||
return new Calver(this.year, this.minor, bugfix, modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Calver withModifier(Iteration modifier) {
|
|
||||||
return new Calver(this.year, this.minor, this.micro, modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public int compareTo(Calver that) {
|
|
||||||
|
|
||||||
if (that == null) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (year != that.year) {
|
|
||||||
return year - that.year;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minor != that.minor) {
|
|
||||||
return minor - that.minor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (micro != that.micro) {
|
|
||||||
return micro - that.micro;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modifier != that.modifier) {
|
|
||||||
|
|
||||||
if (modifier == null && that.modifier == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modifier != null && that.modifier == null) {
|
|
||||||
return modifier.compareTo(Iteration.GA);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modifier == null && that.modifier != null) {
|
|
||||||
return Iteration.GA.compareTo(modifier);
|
|
||||||
}
|
|
||||||
return modifier.compareTo(that.modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o)
|
|
||||||
return true;
|
|
||||||
if (!(o instanceof Calver))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Calver calver = (Calver) o;
|
|
||||||
|
|
||||||
if (year != calver.year)
|
|
||||||
return false;
|
|
||||||
if (minor != calver.minor)
|
|
||||||
return false;
|
|
||||||
if (micro != calver.micro)
|
|
||||||
return false;
|
|
||||||
return modifier.equals(calver.modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int result = year;
|
|
||||||
result = 31 * result + minor;
|
|
||||||
result = 31 * result + micro;
|
|
||||||
result = 31 * result + modifier.hashCode();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
|
|
||||||
List<Integer> digits = new ArrayList<>();
|
|
||||||
digits.add(year);
|
|
||||||
digits.add(minor);
|
|
||||||
digits.add(micro);
|
|
||||||
|
|
||||||
String raw = StringUtils.collectionToDelimitedString(digits, ".");
|
|
||||||
|
|
||||||
if (!Iteration.GA.equals(this.modifier)) {
|
|
||||||
return String.format("%s-%s", raw, this.modifier.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return raw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.release.model;
|
package org.springframework.data.release.model;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ import org.springframework.util.ReflectionUtils;
|
|||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
@Value
|
@Value
|
||||||
|
@EqualsAndHashCode(of = "name")
|
||||||
public class Iteration implements Comparable<Iteration> {
|
public class Iteration implements Comparable<Iteration> {
|
||||||
|
|
||||||
public static final Iteration SR24 = new Iteration("SR23", null);
|
public static final Iteration SR24 = new Iteration("SR23", null);
|
||||||
|
|||||||
@@ -19,10 +19,13 @@ package org.springframework.data.release.model;
|
|||||||
* A {@link Version} tied to an {@link Iteration}.
|
* A {@link Version} tied to an {@link Iteration}.
|
||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
public interface IterationVersion extends VersionAware {
|
public interface IterationVersion extends VersionAware {
|
||||||
|
|
||||||
Iteration getIteration();
|
Iteration getIteration();
|
||||||
|
|
||||||
boolean isBranchVersion();
|
boolean isBranchVersion();
|
||||||
|
|
||||||
|
boolean usesModifierVersionFormat();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
|
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class ModuleIteration implements IterationVersion, ProjectAware{
|
public class ModuleIteration implements IterationVersion, ProjectAware {
|
||||||
|
|
||||||
private final @Getter Module module;
|
private final @Getter Module module;
|
||||||
private final @Getter TrainIteration trainIteration;
|
private final @Getter TrainIteration trainIteration;
|
||||||
@@ -75,6 +75,15 @@ public class ModuleIteration implements IterationVersion, ProjectAware{
|
|||||||
return getIteration().isServiceIteration() || trainIteration.getTrain().isAlwaysUseBranch();
|
return getIteration().isServiceIteration() || trainIteration.getTrain().isAlwaysUseBranch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.data.release.model.IterationVersion#usesModifierVersionFormat()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean usesModifierVersionFormat() {
|
||||||
|
return trainIteration.getTrain().usesCalver();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link String} representation of the logical version of the {@link ModuleIteration}. This will
|
* Returns the {@link String} representation of the logical version of the {@link ModuleIteration}. This will
|
||||||
* abbreviate trailing zeros and not include the release train name.
|
* abbreviate trailing zeros and not include the release train name.
|
||||||
@@ -103,15 +112,34 @@ public class ModuleIteration implements IterationVersion, ProjectAware{
|
|||||||
Iteration iteration = trainIteration.getIteration();
|
Iteration iteration = trainIteration.getIteration();
|
||||||
|
|
||||||
if (iteration.isServiceIteration()) {
|
if (iteration.isServiceIteration()) {
|
||||||
builder.append(" (").append(trainIteration.toString());
|
builder.append(" (");
|
||||||
|
if (getTrain().usesCalver()) {
|
||||||
|
builder.append(trainIteration.getName());
|
||||||
|
} else {
|
||||||
|
builder.append(trainIteration.toString());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
builder.append(" ").append(iteration.getName()).append(" (");
|
builder.append(" ").append(iteration.getName()).append(" (");
|
||||||
builder.append(trainIteration.getTrain().getName());
|
builder.append(trainIteration.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.append(")").toString();
|
return builder.append(")").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReleaseVersionString() {
|
||||||
|
|
||||||
|
if (getTrain().usesCalver()) {
|
||||||
|
|
||||||
|
if (getIteration().isServiceIteration() || getIteration().isGAIteration()) {
|
||||||
|
return getTrainIteration().getCalver().toMajorMinorBugfix();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getTrainIteration().getCalver().toMajorMinorBugfix() + "-" + getIteration().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getTrain().getName() + " " + getIteration().getName();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link String} representation of the logical version of the {@link ModuleIteration}. This will use the
|
* Returns the {@link String} representation of the logical version of the {@link ModuleIteration}. This will use the
|
||||||
* technical version string and append the train iteration.
|
* technical version string and append the train iteration.
|
||||||
|
|||||||
@@ -37,12 +37,14 @@ import org.jgrapht.traverse.TopologicalOrderIterator;
|
|||||||
*/
|
*/
|
||||||
public class Projects {
|
public class Projects {
|
||||||
|
|
||||||
public static final Project COMMONS, BUILD, REST, JDBC, JPA, MONGO_DB, NEO4J, SOLR, COUCHBASE, CASSANDRA,
|
public static final Project BOM, COMMONS, BUILD, REST, JDBC, JPA, MONGO_DB, NEO4J, SOLR, COUCHBASE, CASSANDRA,
|
||||||
ELASTICSEARCH, R2DBC, REDIS, GEMFIRE, KEY_VALUE, ENVERS, LDAP, GEODE;
|
ELASTICSEARCH, R2DBC, REDIS, GEMFIRE, KEY_VALUE, ENVERS, LDAP, GEODE;
|
||||||
public static final List<Project> PROJECTS;
|
public static final List<Project> PROJECTS;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
|
BOM = new Project("DATABOM", "BOM", Tracker.GITHUB);
|
||||||
|
|
||||||
BUILD = new Project("DATABUILD", "Build", Tracker.GITHUB) //
|
BUILD = new Project("DATABUILD", "Build", Tracker.GITHUB) //
|
||||||
.withAdditionalArtifacts(ArtifactCoordinates.forGroupId("org.springframework.data.build")
|
.withAdditionalArtifacts(ArtifactCoordinates.forGroupId("org.springframework.data.build")
|
||||||
.artifacts("spring-data-build-parent", "spring-data-build-resources")
|
.artifacts("spring-data-build-parent", "spring-data-build-resources")
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import java.util.List;
|
|||||||
public class ReleaseTrains {
|
public class ReleaseTrains {
|
||||||
|
|
||||||
public static final List<Train> TRAINS;
|
public static final List<Train> TRAINS;
|
||||||
public static final Train CODD, DIJKSTRA, EVANS, FOWLER, GOSLING, HOPPER, INGALLS, KAY, LOVELACE, MOORE, NEUMANN;
|
public static final Train CODD, DIJKSTRA, EVANS, FOWLER, GOSLING, HOPPER, INGALLS, KAY, LOVELACE, MOORE, NEUMANN,
|
||||||
|
OCKHAM;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
@@ -63,11 +64,15 @@ public class ReleaseTrains {
|
|||||||
new Module(JDBC, "2.0"), //
|
new Module(JDBC, "2.0"), //
|
||||||
new Module(R2DBC, "1.1")) //
|
new Module(R2DBC, "1.1")) //
|
||||||
.filterModules(module -> !module.getProject().equals(GEMFIRE))
|
.filterModules(module -> !module.getProject().equals(GEMFIRE))
|
||||||
.withIterations(new Train.Iterations(M1, M2, M3, M4, RC1, RC2, GA));
|
.withIterations(new Train.Iterations(M1, M2, M3, M4, RC1, RC2, GA, SR1, SR2, SR3, SR4, SR5));
|
||||||
|
|
||||||
|
OCKHAM = NEUMANN.next("Ockham", Transition.MINOR).withCalver("2020.0.0")
|
||||||
|
.withIterations(new Train.Iterations(M1, M2, M3, M4, RC1, RC2, GA, SR1, SR2, SR3, SR4, SR5));
|
||||||
|
|
||||||
// Trains
|
// Trains
|
||||||
|
|
||||||
TRAINS = Arrays.asList(CODD, DIJKSTRA, EVANS, FOWLER, GOSLING, HOPPER, INGALLS, KAY, LOVELACE, MOORE, NEUMANN);
|
TRAINS = Arrays.asList(CODD, DIJKSTRA, EVANS, FOWLER, GOSLING, HOPPER, INGALLS, KAY, LOVELACE, MOORE, NEUMANN,
|
||||||
|
OCKHAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Train codd() {
|
private static Train codd() {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public enum Tracker {
|
|||||||
|
|
||||||
private final String ticketPattern;
|
private final String ticketPattern;
|
||||||
|
|
||||||
public static final String releaseTicketSummary(ModuleIteration moduleIteration) {
|
public static String releaseTicketSummary(ModuleIteration moduleIteration) {
|
||||||
return "Release " + moduleIteration.getMediumVersionString();
|
return "Release " + moduleIteration.getMediumVersionString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import java.util.stream.Stream;
|
|||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
import org.springframework.data.util.Streamable;
|
import org.springframework.data.util.Streamable;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +50,7 @@ public class Train implements Streamable<Module> {
|
|||||||
|
|
||||||
private final String name;;
|
private final String name;;
|
||||||
private final Modules modules;
|
private final Modules modules;
|
||||||
|
private @Nullable Version calver;
|
||||||
private @With Iterations iterations;
|
private @With Iterations iterations;
|
||||||
private @With boolean alwaysUseBranch;
|
private @With boolean alwaysUseBranch;
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ public class Train implements Streamable<Module> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Train(String name, Collection<Module> modules) {
|
public Train(String name, Collection<Module> modules) {
|
||||||
this(name, Modules.of(modules), Iterations.DEFAULT, false);
|
this(name, Modules.of(modules), null, Iterations.DEFAULT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -106,17 +108,18 @@ public class Train implements Streamable<Module> {
|
|||||||
|
|
||||||
public Train next(String name, Transition transition, Module... additionalModules) {
|
public Train next(String name, Transition transition, Module... additionalModules) {
|
||||||
|
|
||||||
Set<Module> collect = Stream.concat(modules.stream(), Stream.of(additionalModules)).//
|
Set<Module> modules = Stream.concat(this.modules.stream(), Stream.of(additionalModules)).//
|
||||||
map(module -> Arrays.stream(additionalModules).//
|
map(module -> Arrays.stream(additionalModules).//
|
||||||
reduce(module.next(transition),
|
reduce(module.next(transition),
|
||||||
(it, additionalModule) -> it.hasSameProjectAs(additionalModule) ? additionalModule : it))
|
(it, additionalModule) -> it.hasSameProjectAs(additionalModule) ? additionalModule : it))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
return new Train(name, collect);
|
return new Train(name, Modules.of(modules), calver, iterations, alwaysUseBranch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Train filterModules(Predicate<Module> filterPredicate) {
|
public Train filterModules(Predicate<Module> filterPredicate) {
|
||||||
return new Train(name, getModules().stream().filter(filterPredicate).collect(Collectors.toList()));
|
return new Train(name, Modules.of(getModules().stream().filter(filterPredicate).collect(Collectors.toList())),
|
||||||
|
calver, iterations, alwaysUseBranch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -161,6 +164,14 @@ public class Train implements Streamable<Module> {
|
|||||||
return ArtifactVersion.of(new ModuleIteration(module, new TrainIteration(this, iteration)));
|
return ArtifactVersion.of(new ModuleIteration(module, new TrainIteration(this, iteration)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean usesCalver() {
|
||||||
|
return calver != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Train withCalver(String calverVersion) {
|
||||||
|
return new Train(name, modules, Version.parse(calverVersion), iterations, alwaysUseBranch);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
|
|||||||
@@ -64,12 +64,61 @@ public class TrainIteration implements Streamable<ModuleIteration> {
|
|||||||
return train.getModuleIteration(module.getProject(), previousIteration);
|
return train.getModuleIteration(module.getProject(), previousIteration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
|
||||||
|
if (getTrain().usesCalver()) {
|
||||||
|
return getCalver().toMajorMinorBugfix();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getTrain().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReleaseTrainNameAndVersion() {
|
||||||
|
|
||||||
|
if (getTrain().usesCalver()) {
|
||||||
|
|
||||||
|
if (getIteration().isMilestone() || getIteration().isReleaseCandidate()) {
|
||||||
|
return String.format("%s-%s", getCalver(), iteration);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getCalver().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iteration.isGAIteration()) {
|
||||||
|
return String.format("%s-RELEASE", getTrain().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%s-%s", getTrain().getName(), iteration);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s %s", train.getName(), iteration.getName());
|
return String.format("%s %s", getName(), iteration.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Version getCalver() {
|
||||||
|
|
||||||
|
Version version = getTrain().getCalver();
|
||||||
|
|
||||||
|
if (getIteration().isServiceIteration()) {
|
||||||
|
return version.withBugfix(getIteration().getBugfixValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNextBugfixName() {
|
||||||
|
|
||||||
|
Version version = getTrain().getCalver();
|
||||||
|
int currentBugfixLevel = 0;
|
||||||
|
if (getIteration().isServiceIteration()) {
|
||||||
|
currentBugfixLevel = getIteration().getBugfixValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return version.withBugfix(currentBugfixLevel + 1).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class MaintainedVersion implements Comparable<MaintainedVersion> {
|
|||||||
Assert.notNull(module, "Module must not be null!");
|
Assert.notNull(module, "Module must not be null!");
|
||||||
Assert.notNull(train, "Train must not be null!");
|
Assert.notNull(train, "Train must not be null!");
|
||||||
|
|
||||||
ArtifactVersion snapshotVersion = ArtifactVersion.of(module.getVersion()).getSnapshotVersion();
|
ArtifactVersion snapshotVersion = ArtifactVersion.of(module.getVersion()).withModifierFormat(train.usesCalver())
|
||||||
|
.getSnapshotVersion();
|
||||||
|
|
||||||
return MaintainedVersion.of(module.getProject(), snapshotVersion, train);
|
return MaintainedVersion.of(module.getProject(), snapshotVersion, train);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.util.Locale;
|
|||||||
import org.springframework.data.release.build.MavenArtifact;
|
import org.springframework.data.release.build.MavenArtifact;
|
||||||
import org.springframework.data.release.model.ArtifactVersion;
|
import org.springframework.data.release.model.ArtifactVersion;
|
||||||
import org.springframework.data.release.model.Projects;
|
import org.springframework.data.release.model.Projects;
|
||||||
|
import org.springframework.data.release.model.Train;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@@ -143,18 +144,33 @@ class ProjectMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the version to use. For the build project thats the release train name, for everything else the artifact
|
* Return the version to use. For the build project that's the release train name, for everything else the artifact
|
||||||
* version.
|
* version.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
|
|
||||||
if (Projects.BUILD.equals(version.getProject())) {
|
ArtifactVersion version = this.version.getVersion();
|
||||||
return String.format("%s-%s", version.getTrain().getName(), version.getVersion().getReleaseTrainSuffix());
|
|
||||||
|
if (Projects.BUILD.equals(this.version.getProject())) {
|
||||||
|
|
||||||
|
Train train = this.version.getTrain();
|
||||||
|
|
||||||
|
if (train.usesCalver()) {
|
||||||
|
|
||||||
|
if (version.isBugFixVersion() || version.isReleaseVersion()) {
|
||||||
|
return train.getCalver().toMajorMinorBugfix();
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%s-%s", train.getName(), version.getReleaseTrainSuffix());
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%s-%s", train.getName(),
|
||||||
|
version.isReleaseVersion() && !version.isBugFixVersion() ? "RELEASE" : version.getReleaseTrainSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
return version.getVersion().toString();
|
return version.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Repository {
|
public class Repository {
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ class MavenIntegrationTests extends AbstractIntegrationTests {
|
|||||||
"/project/profiles/profile[id=\"distribute\"]/dependencies/dependency[artifactId=\"spring-data-build-resources\"]/version");
|
"/project/profiles/profile[id=\"distribute\"]/dependencies/dependency[artifactId=\"spring-data-build-resources\"]/version");
|
||||||
|
|
||||||
assertThat(xPathEvaluator.asString()).isEqualToIgnoringCase("1.2.0.RELEASE");
|
assertThat(xPathEvaluator.asString()).isEqualToIgnoringCase("1.2.0.RELEASE");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -87,15 +86,11 @@ class MavenIntegrationTests extends AbstractIntegrationTests {
|
|||||||
|
|
||||||
pom.setRepositoryId("spring-libs-snapshot", "spring-libs-release");
|
pom.setRepositoryId("spring-libs-snapshot", "spring-libs-release");
|
||||||
pom.setRepositoryUrl("spring-libs-release", "https://repo.spring.io/libs-release");
|
pom.setRepositoryUrl("spring-libs-release", "https://repo.spring.io/libs-release");
|
||||||
|
|
||||||
// System.out.println(projection.asString(pom));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void findsSnapshotDependencies() throws Exception {
|
void findsSnapshotDependencies() throws Exception {
|
||||||
|
|
||||||
Pom pom = projection.io().file(workspace.getFile("bom/pom.xml", Projects.BUILD)).read(Pom.class);
|
Pom pom = projection.io().file(workspace.getFile("bom/pom.xml", Projects.BUILD)).read(Pom.class);
|
||||||
|
|
||||||
System.out.println(pom.getSnapshotDependencies());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,14 +84,14 @@ class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests {
|
|||||||
void ignoresUnknownTicketsByTicketId() {
|
void ignoresUnknownTicketsByTicketId() {
|
||||||
|
|
||||||
Collection<Ticket> tickets = github.findTickets(Projects.BUILD, Collections.singletonList("123"));
|
Collection<Ticket> tickets = github.findTickets(Projects.BUILD, Collections.singletonList("123"));
|
||||||
assertThat(tickets).hasSize(0);
|
assertThat(tickets).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
void emptyResultWithEmptyTicketIds() {
|
void emptyResultWithEmptyTicketIds() {
|
||||||
|
|
||||||
Collection<Ticket> tickets = github.findTickets(Projects.COMMONS, Collections.emptyList());
|
Collection<Ticket> tickets = github.findTickets(Projects.COMMONS, Collections.emptyList());
|
||||||
assertThat(tickets).hasSize(0);
|
assertThat(tickets).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
@@ -110,7 +110,7 @@ class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockGetMilestonesWith("emptyMilestones.json");
|
mockGetMilestonesWith("emptyMilestones.json");
|
||||||
|
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> github.getReleaseTicketFor(BUILD_HOPPER_RC1))
|
assertThatIllegalArgumentException().isThrownBy(() -> github.getReleaseTicketFor(BUILD_HOPPER_RC1))
|
||||||
.withMessageContaining("No milestone for Spring Data Build found containing 1.8 RC1!");
|
.withMessageContaining("No milestone for Spring Data Build found containing 1.8 RC1 (Hopper)!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
@@ -157,7 +157,7 @@ class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockGetMilestonesWith("emptyMilestones.json");
|
mockGetMilestonesWith("emptyMilestones.json");
|
||||||
|
|
||||||
assertThatIllegalArgumentException().isThrownBy(() -> github.createReleaseTicket(moduleIteration))
|
assertThatIllegalArgumentException().isThrownBy(() -> github.createReleaseTicket(moduleIteration))
|
||||||
.withMessageContaining("No milestone for Spring Data Build found containing 1.8 RC1!");
|
.withMessageContaining("No milestone for Spring Data Build found containing 1.8 RC1 (Hopper)!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
|
|||||||
@@ -44,13 +44,25 @@ class GithubMilestoneUnitTests {
|
|||||||
assertIterationVersion(Iteration.SR4, "1.8.4 (Dijkstra SR4)");
|
assertIterationVersion(Iteration.SR4, "1.8.4 (Dijkstra SR4)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void rendersGithubCalverCorrectly() {
|
||||||
|
|
||||||
|
ModuleIteration m1 = ReleaseTrains.OCKHAM.getModuleIteration(Projects.COMMONS, Iteration.M1);
|
||||||
|
ModuleIteration rc1 = ReleaseTrains.OCKHAM.getModuleIteration(Projects.COMMONS, Iteration.RC1);
|
||||||
|
ModuleIteration ga = ReleaseTrains.OCKHAM.getModuleIteration(Projects.COMMONS, Iteration.GA);
|
||||||
|
|
||||||
|
assertThat(new GithubMilestone(m1).getDescription()).isEqualTo("2020.0.0-M1");
|
||||||
|
assertThat(new GithubMilestone(rc1).getDescription()).isEqualTo("2020.0.0-RC1");
|
||||||
|
assertThat(new GithubMilestone(ga).getDescription()).isEqualTo("2020.0.0");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void usesCustomModuleIterationStartVersion() {
|
void usesCustomModuleIterationStartVersion() {
|
||||||
|
|
||||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||||
|
|
||||||
GithubMilestone version = new GithubMilestone(module);
|
GithubMilestone version = new GithubMilestone(module);
|
||||||
assertThat(version.toString()).isEqualTo("1.0 M1 (Dijkstra)");
|
assertThat(version).hasToString("1.0 M1 (Dijkstra)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -59,7 +71,7 @@ class GithubMilestoneUnitTests {
|
|||||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
||||||
|
|
||||||
GithubMilestone version = new GithubMilestone(module);
|
GithubMilestone version = new GithubMilestone(module);
|
||||||
assertThat(version.toString()).isEqualTo("1.0 RC1 (Dijkstra)");
|
assertThat(version).hasToString("1.0 RC1 (Dijkstra)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -76,6 +88,6 @@ class GithubMilestoneUnitTests {
|
|||||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
||||||
|
|
||||||
GithubMilestone version = new GithubMilestone(module);
|
GithubMilestone version = new GithubMilestone(module);
|
||||||
assertThat(version.toString()).isEqualTo(expected);
|
assertThat(version).hasToString(expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import static org.assertj.core.api.Assumptions.*;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@@ -91,14 +92,15 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockSearchWith("emptyTickets.json");
|
mockSearchWith("emptyTickets.json");
|
||||||
|
|
||||||
Collection<Ticket> tickets = jira.findTickets(Projects.COMMONS, Arrays.asList("XYZ-1", "UNKOWN-1"));
|
Collection<Ticket> tickets = jira.findTickets(Projects.COMMONS, Arrays.asList("XYZ-1", "UNKOWN-1"));
|
||||||
assertThat(tickets).hasSize(0);
|
assertThat(tickets).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
void emptyResultWithEmptyTicketIds() {
|
void emptyResultWithEmptyTicketIds() {
|
||||||
|
|
||||||
Collection<Ticket> tickets = jira.findTickets(Projects.COMMONS, Arrays.asList());
|
Collection<Ticket> tickets = jira.findTickets(Projects.COMMONS, Collections
|
||||||
assertThat(tickets).hasSize(0);
|
.emptyList());
|
||||||
|
assertThat(tickets).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
@@ -126,7 +128,7 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
|
|
||||||
Optional<JiraReleaseVersion> optional = jira.findJiraReleaseVersion(REST_HOPPER_RC1);
|
Optional<JiraReleaseVersion> optional = jira.findJiraReleaseVersion(REST_HOPPER_RC1);
|
||||||
|
|
||||||
assertThat(optional.isPresent()).isTrue();
|
assertThat(optional).isPresent();
|
||||||
assertThat(optional.get().getName()).isEqualTo("2.5 RC1 (Hopper)");
|
assertThat(optional.get().getName()).isEqualTo("2.5 RC1 (Hopper)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +218,7 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockGetProjectVersionsWith("emptyReleaseVersions.json", moduleIteration.getProjectKey());
|
mockGetProjectVersionsWith("emptyReleaseVersions.json", moduleIteration.getProjectKey());
|
||||||
|
|
||||||
assertThatIllegalStateException().isThrownBy(() -> jira.createReleaseTicket(moduleIteration))
|
assertThatIllegalStateException().isThrownBy(() -> jira.createReleaseTicket(moduleIteration))
|
||||||
.withMessageContaining("Did not find a release version for Spring Data REST 2.5 RC1");
|
.withMessageContaining("No release version for Spring Data REST found containing 2.5 RC1 (Hopper)!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package org.springframework.data.release.issues.jira;
|
|||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.springframework.data.release.model.Iteration;
|
import org.springframework.data.release.model.Iteration;
|
||||||
import org.springframework.data.release.model.ModuleIteration;
|
import org.springframework.data.release.model.ModuleIteration;
|
||||||
import org.springframework.data.release.model.Projects;
|
import org.springframework.data.release.model.Projects;
|
||||||
@@ -28,6 +27,7 @@ import org.springframework.data.release.model.ReleaseTrains;
|
|||||||
* Unit tests for {@link JiraVersion}.
|
* Unit tests for {@link JiraVersion}.
|
||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
class JiraVersionUnitTests {
|
class JiraVersionUnitTests {
|
||||||
|
|
||||||
@@ -44,13 +44,25 @@ class JiraVersionUnitTests {
|
|||||||
assertIterationVersion(Iteration.SR4, "1.8.4 (Dijkstra SR4)");
|
assertIterationVersion(Iteration.SR4, "1.8.4 (Dijkstra SR4)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void rendersGithubCalverCorrectly() {
|
||||||
|
|
||||||
|
ModuleIteration m1 = ReleaseTrains.OCKHAM.getModuleIteration(Projects.COMMONS, Iteration.M1);
|
||||||
|
ModuleIteration rc1 = ReleaseTrains.OCKHAM.getModuleIteration(Projects.COMMONS, Iteration.RC1);
|
||||||
|
ModuleIteration ga = ReleaseTrains.OCKHAM.getModuleIteration(Projects.COMMONS, Iteration.GA);
|
||||||
|
|
||||||
|
assertThat(new JiraVersion(m1).getDescription()).isEqualTo("2020.0.0-M1");
|
||||||
|
assertThat(new JiraVersion(rc1).getDescription()).isEqualTo("2020.0.0-RC1");
|
||||||
|
assertThat(new JiraVersion(ga).getDescription()).isEqualTo("2020.0.0");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void usesCustomModuleIterationStartVersion() {
|
void usesCustomModuleIterationStartVersion() {
|
||||||
|
|
||||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||||
|
|
||||||
JiraVersion version = new JiraVersion(module);
|
JiraVersion version = new JiraVersion(module);
|
||||||
assertThat(version.toString()).isEqualTo("1.0 M1 (Dijkstra)");
|
assertThat(version).hasToString("1.0 M1 (Dijkstra)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -59,7 +71,7 @@ class JiraVersionUnitTests {
|
|||||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
||||||
|
|
||||||
JiraVersion version = new JiraVersion(module);
|
JiraVersion version = new JiraVersion(module);
|
||||||
assertThat(version.toString()).isEqualTo("1.0 RC1 (Dijkstra)");
|
assertThat(version).hasToString("1.0 RC1 (Dijkstra)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -76,6 +88,6 @@ class JiraVersionUnitTests {
|
|||||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
||||||
|
|
||||||
JiraVersion version = new JiraVersion(module);
|
JiraVersion version = new JiraVersion(module);
|
||||||
assertThat(version.toString()).isEqualTo(expected);
|
assertThat(version).hasToString(expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,29 @@ class TicketsUnitTests {
|
|||||||
assertThat(releaseTicket).isEqualTo(ticket);
|
assertThat(releaseTicket).isEqualTo(ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getReleaseTicketReturnsCalverReleaseTicket() {
|
||||||
|
|
||||||
|
Tickets tickets = new Tickets(
|
||||||
|
Collections.singletonList(new Ticket("1234", "Release 2.4 GA (2020.0.0)", JiraTicketStatus.of(false, "", ""))));
|
||||||
|
|
||||||
|
Ticket releaseTicket = tickets
|
||||||
|
.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||||
|
assertThat(releaseTicket).isNotNull();
|
||||||
|
|
||||||
|
tickets = new Tickets(
|
||||||
|
Collections.singletonList(new Ticket("1234", "Release 2.4 M1 (2020.0.0)", JiraTicketStatus.of(false, "", ""))));
|
||||||
|
|
||||||
|
releaseTicket = tickets.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.M1));
|
||||||
|
assertThat(releaseTicket).isNotNull();
|
||||||
|
|
||||||
|
tickets = new Tickets(
|
||||||
|
Collections.singletonList(new Ticket("1234", "Release 2.4.1 (2020.0.1)", JiraTicketStatus.of(false, "", ""))));
|
||||||
|
|
||||||
|
releaseTicket = tickets.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.SR1));
|
||||||
|
assertThat(releaseTicket).isNotNull();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getReleaseTicketThrowsExceptionWithoutAReleaseTicket() {
|
void getReleaseTicketThrowsExceptionWithoutAReleaseTicket() {
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import org.assertj.core.api.Assertions;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Unit tests for {@link ArtifactVersion}.
|
||||||
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
*/
|
*/
|
||||||
class ArtifactVersionUnitTests {
|
class ArtifactVersionUnitTests {
|
||||||
@@ -33,19 +35,21 @@ class ArtifactVersionUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void parsesReleaseVersionCorrectly() {
|
void parsesReleaseVersionCorrectly() {
|
||||||
|
|
||||||
ArtifactVersion version = ArtifactVersion.of("1.4.5.RELEASE");
|
assertThat(ArtifactVersion.of("1.4.5.RELEASE").isReleaseVersion()).isTrue();
|
||||||
|
assertThat(ArtifactVersion.of("1.4.5.RELEASE").getNextDevelopmentVersion()).isEqualTo(ArtifactVersion.of("1.4.6.BUILD-SNAPSHOT"));
|
||||||
|
|
||||||
assertThat(version.isReleaseVersion()).isTrue();
|
assertThat(ArtifactVersion.of("1.4.5").isReleaseVersion()).isTrue();
|
||||||
assertThat(version.getNextDevelopmentVersion()).isEqualTo(ArtifactVersion.of("1.4.6.BUILD-SNAPSHOT"));
|
assertThat(ArtifactVersion.of("1.4.5").getNextDevelopmentVersion()).isEqualTo(ArtifactVersion.of("1.4.6-SNAPSHOT"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void createsMilestoneVersionCorrectly() {
|
void createsMilestoneVersionCorrectly() {
|
||||||
|
|
||||||
ArtifactVersion version = ArtifactVersion.of("1.4.5.M1");
|
assertThat(ArtifactVersion.of("1.4.5.M1").isReleaseVersion()).isFalse();
|
||||||
|
assertThat(ArtifactVersion.of("1.4.5.M1").isMilestoneVersion()).isTrue();
|
||||||
|
|
||||||
assertThat(version.isReleaseVersion()).isFalse();
|
assertThat(ArtifactVersion.of("1.4.5-M1").isReleaseVersion()).isFalse();
|
||||||
assertThat(version.isMilestoneVersion()).isTrue();
|
assertThat(ArtifactVersion.of("1.4.5-M1").isMilestoneVersion()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -54,7 +58,7 @@ class ArtifactVersionUnitTests {
|
|||||||
ArtifactVersion version = ArtifactVersion.of(Version.of(1, 4, 5));
|
ArtifactVersion version = ArtifactVersion.of(Version.of(1, 4, 5));
|
||||||
|
|
||||||
assertThat(version.isReleaseVersion()).isTrue();
|
assertThat(version.isReleaseVersion()).isTrue();
|
||||||
assertThat(version.toString()).isEqualTo("1.4.5.RELEASE");
|
assertThat(version).hasToString("1.4.5.RELEASE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -64,7 +68,7 @@ class ArtifactVersionUnitTests {
|
|||||||
ArtifactVersion version = ArtifactVersion.of(oneFourMilestoneOne);
|
ArtifactVersion version = ArtifactVersion.of(oneFourMilestoneOne);
|
||||||
|
|
||||||
assertThat(version.isMilestoneVersion()).isTrue();
|
assertThat(version.isMilestoneVersion()).isTrue();
|
||||||
assertThat(version.toString()).isEqualTo("1.4.0.M1");
|
assertThat(version).hasToString("1.4.0.M1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -74,7 +78,7 @@ class ArtifactVersionUnitTests {
|
|||||||
ArtifactVersion version = ArtifactVersion.of(oneFourGA);
|
ArtifactVersion version = ArtifactVersion.of(oneFourGA);
|
||||||
|
|
||||||
assertThat(version.isReleaseVersion()).isTrue();
|
assertThat(version.isReleaseVersion()).isTrue();
|
||||||
assertThat(version.toString()).isEqualTo("1.4.0.RELEASE");
|
assertThat(version).hasToString("1.4.0.RELEASE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -84,7 +88,7 @@ class ArtifactVersionUnitTests {
|
|||||||
ArtifactVersion version = ArtifactVersion.of(oneFourServiceReleaseTwo);
|
ArtifactVersion version = ArtifactVersion.of(oneFourServiceReleaseTwo);
|
||||||
|
|
||||||
assertThat(version.isReleaseVersion()).isTrue();
|
assertThat(version.isReleaseVersion()).isTrue();
|
||||||
assertThat(version.toString()).isEqualTo("1.4.2.RELEASE");
|
assertThat(version).hasToString("1.4.2.RELEASE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2020 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.springframework.data.release.model;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unit tests for {@link Calver}.
|
|
||||||
*
|
|
||||||
* @author Mark Paluch
|
|
||||||
*/
|
|
||||||
class CalverVersionUnitTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void shouldParseRelease() {
|
|
||||||
|
|
||||||
Calver version = Calver.parse("2020.0.1");
|
|
||||||
|
|
||||||
assertThat(version.getYear()).isEqualTo(2020);
|
|
||||||
assertThat(version.getMinor()).isEqualTo(0);
|
|
||||||
assertThat(version.getMicro()).isEqualTo(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void shouldParseM1Release() {
|
|
||||||
|
|
||||||
Calver version = Calver.parse("2020.0.1-M1");
|
|
||||||
|
|
||||||
assertThat(version.getYear()).isEqualTo(2020);
|
|
||||||
assertThat(version.getMinor()).isEqualTo(0);
|
|
||||||
assertThat(version.getMicro()).isEqualTo(1);
|
|
||||||
assertThat(version.getModifier()).isEqualTo(Iteration.M1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void shouldCompareReleasesCorrectly() {
|
|
||||||
|
|
||||||
Calver version = Calver.parse("2020.0.1-RC2");
|
|
||||||
|
|
||||||
assertThat(version).isGreaterThan(Calver.parse("2020.0.0-RC2"));
|
|
||||||
assertThat(version).isLessThan(Calver.parse("2020.0.2-RC2"));
|
|
||||||
assertThat(version).isLessThan(Calver.parse("2020.1.0-RC2"));
|
|
||||||
assertThat(version).isLessThan(Calver.parse("2021.0.0-RC2"));
|
|
||||||
|
|
||||||
assertThat(version).isGreaterThan(Calver.parse("2020.0.1-RC1"));
|
|
||||||
assertThat(version).isLessThan(Calver.parse("2020.0.1"));
|
|
||||||
|
|
||||||
assertThat(Calver.parse("2020.0.1")).isEqualTo(Calver.parse("2020.0.1"));
|
|
||||||
assertThat(Calver.parse("2020.0.1")).isLessThan(Calver.parse("2020.0.1-SR1"));
|
|
||||||
assertThat(Calver.parse("2020.0.1")).isGreaterThan(Calver.parse("2020.0.1-M1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void shouldParseSnapshot() {
|
|
||||||
|
|
||||||
Calver version = Calver.parse("2020.0.1-SNAPSHOT");
|
|
||||||
|
|
||||||
assertThat(version.getYear()).isEqualTo(2020);
|
|
||||||
assertThat(version.getMinor()).isEqualTo(0);
|
|
||||||
assertThat(version.getMicro()).isEqualTo(1);
|
|
||||||
assertThat(version.getModifier()).isEqualTo(new Iteration("SNAPSHOT", null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -31,4 +31,13 @@ public class SimpleIterationVersion implements IterationVersion {
|
|||||||
public boolean isBranchVersion() {
|
public boolean isBranchVersion() {
|
||||||
return iteration.isServiceIteration();
|
return iteration.isServiceIteration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.springframework.data.release.model.IterationVersion#usesModifierVersionFormat()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean usesModifierVersionFormat() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class SaganOperationsIntegrationTests extends AbstractIntegrationTests {
|
|||||||
@Test
|
@Test
|
||||||
void detectVersionsToUpdate() {
|
void detectVersionsToUpdate() {
|
||||||
|
|
||||||
sagan.findVersions(ReleaseTrains.LOVELACE, ReleaseTrains.KAY, ReleaseTrains.INGALLS, ReleaseTrains.HOPPER)
|
sagan.findVersions(ReleaseTrains.OCKHAM, ReleaseTrains.NEUMANN, ReleaseTrains.MOORE, ReleaseTrains.LOVELACE)
|
||||||
.forEach((project, versions) -> {
|
.forEach((project, versions) -> {
|
||||||
|
|
||||||
System.out.println(project.getName());
|
System.out.println(project.getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user