#160 - Add flag to signal that GitHub issues migration is complete.
Verify that all Projects use GitHub once GitHubMigration.isDone is true. Use different commit message structure after GitHub issues migration.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public enum GitHubMigration {
|
||||
|
||||
;
|
||||
|
||||
// TODO: Flip this switch once the GitHub migration is done.
|
||||
public static final boolean isDone = false;
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.release.GitHubMigration;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ public class Commit {
|
||||
private final String summary;
|
||||
private final Optional<String> details;
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@@ -42,6 +43,26 @@ public class Commit {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
if (GitHubMigration.isDone) {
|
||||
|
||||
builder.append(summary);
|
||||
|
||||
if (!summary.endsWith(".")) {
|
||||
builder.append(".");
|
||||
}
|
||||
|
||||
details.ifPresent(it -> {
|
||||
builder.append("\n");
|
||||
builder.append("\n");
|
||||
builder.append(it);
|
||||
});
|
||||
|
||||
builder.append("\nSee ").append(ticket.getId());
|
||||
|
||||
return builder.toString();
|
||||
|
||||
}
|
||||
|
||||
builder.append(ticket.getId()).append(" - ").append(summary);
|
||||
|
||||
if (!summary.endsWith(".")) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@@ -122,16 +121,23 @@ public class GitOperations {
|
||||
});
|
||||
}
|
||||
|
||||
public void checkout(Train train) {
|
||||
checkout(train, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks out all projects of the given {@link Train}.
|
||||
*
|
||||
* @param train
|
||||
* @param update whether to fetch an update from origin.
|
||||
*/
|
||||
public void checkout(Train train) {
|
||||
public void checkout(Train train, boolean update) {
|
||||
|
||||
Assert.notNull(train, "Train must not be null!");
|
||||
|
||||
update(train);
|
||||
if (update) {
|
||||
update(train);
|
||||
}
|
||||
|
||||
AtomicBoolean masterSwitch = new AtomicBoolean();
|
||||
ExecutionUtils.run(executor, train, module -> {
|
||||
@@ -596,10 +602,9 @@ public class GitOperations {
|
||||
*
|
||||
* @param module must not be {@literal null}.
|
||||
* @param summary must not be {@literal null} or empty.
|
||||
* @param files can be empty.
|
||||
*/
|
||||
public void commit(ModuleIteration module, String summary, File... files) {
|
||||
commit(module, summary, Optional.empty(), files);
|
||||
public void commit(ModuleIteration module, String summary) {
|
||||
commit(module, summary, Optional.empty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -609,10 +614,8 @@ public class GitOperations {
|
||||
* @param module must not be {@literal null}.
|
||||
* @param summary must not be {@literal null} or empty.
|
||||
* @param details can be {@literal null} or empty.
|
||||
* @param files can be empty.
|
||||
* @throws Exception
|
||||
*/
|
||||
public void commit(ModuleIteration module, String summary, Optional<String> details, File... files) {
|
||||
public void commit(ModuleIteration module, String summary, Optional<String> details) {
|
||||
|
||||
Assert.notNull(module, "Module iteration must not be null!");
|
||||
Assert.hasText(summary, "Summary must not be null or empty!");
|
||||
@@ -622,7 +625,7 @@ public class GitOperations {
|
||||
() -> String.format("No issue tracker found for project %s!", project));
|
||||
Ticket ticket = tracker.getReleaseTicketFor(module);
|
||||
|
||||
commit(module, ticket, summary, details, files);
|
||||
commit(module, ticket, summary, details);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -632,10 +635,8 @@ public class GitOperations {
|
||||
* @param module must not be {@literal null}.
|
||||
* @param summary must not be {@literal null} or empty.
|
||||
* @param details can be {@literal null} or empty.
|
||||
* @param files can be empty.
|
||||
* @throws Exception
|
||||
*/
|
||||
public void commit(ModuleIteration module, Ticket ticket, String summary, Optional<String> details, File... files) {
|
||||
public void commit(ModuleIteration module, Ticket ticket, String summary, Optional<String> details) {
|
||||
|
||||
Assert.notNull(module, "Module iteration must not be null!");
|
||||
Assert.hasText(summary, "Summary must not be null or empty!");
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import org.springframework.data.release.GitHubMigration;
|
||||
import org.springframework.data.release.git.GitOperations;
|
||||
import org.springframework.data.release.io.Workspace;
|
||||
import org.springframework.data.release.issues.Changelog;
|
||||
@@ -51,8 +52,6 @@ import org.springframework.util.Assert;
|
||||
@RequiredArgsConstructor
|
||||
public class ReleaseOperations {
|
||||
|
||||
public static boolean COMMIT_BASED_CHANGELOG = true;
|
||||
|
||||
private static final Set<String> CHANGELOG_LOCATIONS;
|
||||
|
||||
static {
|
||||
@@ -122,12 +121,12 @@ public class ReleaseOperations {
|
||||
|
||||
Changelog changelog;
|
||||
|
||||
if (COMMIT_BASED_CHANGELOG) {
|
||||
if (GitHubMigration.isDone) {
|
||||
|
||||
List<TicketReference> ticketReferences = git.getTicketReferencesBetween(module.getProject(), previousIteration,
|
||||
iteration);
|
||||
|
||||
// TODO: Remove once all tickets are migrated to GitHub
|
||||
// TODO: Use only associated tracker
|
||||
List<Ticket> tickets = new ArrayList<>();
|
||||
|
||||
for (IssueTracker tracker : trackers) {
|
||||
@@ -141,7 +140,7 @@ public class ReleaseOperations {
|
||||
return changelog;
|
||||
}
|
||||
|
||||
public void updateResources(TrainIteration iteration) throws Exception {
|
||||
public void updateResources(TrainIteration iteration) {
|
||||
|
||||
iteration.stream().forEach(module -> {
|
||||
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.With;
|
||||
|
||||
@@ -30,6 +28,7 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.data.release.GitHubMigration;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -37,7 +36,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class Project implements Comparable<Project> {
|
||||
|
||||
private final @Getter ProjectKey key;
|
||||
@@ -60,6 +58,25 @@ public class Project implements Comparable<Project> {
|
||||
this(new ProjectKey(key), name, fullName, Collections.emptySet(), tracker, ArtifactCoordinates.SPRING_DATA, false);
|
||||
}
|
||||
|
||||
@java.beans.ConstructorProperties({ "key", "name", "fullName", "dependencies", "tracker", "additionalArtifacts",
|
||||
"skipTests" })
|
||||
private Project(ProjectKey key, String name, String fullName, Collection<Project> dependencies, Tracker tracker,
|
||||
ArtifactCoordinates additionalArtifacts, boolean skipTests) {
|
||||
|
||||
if (GitHubMigration.isDone) {
|
||||
if (tracker != Tracker.GITHUB) {
|
||||
throw new IllegalStateException(String.format("Cannot have other trackers than GitHub (Project: %s)", name));
|
||||
}
|
||||
}
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
this.fullName = fullName;
|
||||
this.dependencies = dependencies;
|
||||
this.tracker = tracker;
|
||||
this.additionalArtifacts = additionalArtifacts;
|
||||
this.skipTests = skipTests;
|
||||
}
|
||||
|
||||
public boolean uses(Tracker tracker) {
|
||||
return this.tracker.equals(tracker);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user