|
|
@ -108,31 +108,13 @@ public abstract class UpgradeDependencies extends DefaultTask {
|
|
|
|
Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade);
|
|
|
|
Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Path modified = upgradeApplicator.apply(upgrade);
|
|
|
|
Path modified = upgradeApplicator.apply(upgrade);
|
|
|
|
int issueNumber;
|
|
|
|
int issueNumber = getOrOpenUpgradeIssue(repository, issueLabels, milestone, title,
|
|
|
|
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.OPEN) {
|
|
|
|
existingUpgradeIssue);
|
|
|
|
issueNumber = existingUpgradeIssue.getNumber();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
issueNumber = repository.openIssue(title,
|
|
|
|
|
|
|
|
(existingUpgradeIssue != null) ? "Supersedes #" + existingUpgradeIssue.getNumber() : "",
|
|
|
|
|
|
|
|
issueLabels, milestone);
|
|
|
|
|
|
|
|
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) {
|
|
|
|
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) {
|
|
|
|
existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded"));
|
|
|
|
existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
System.out.println(" Issue: " + issueNumber + " - " + title
|
|
|
|
if (existingUpgradeIssue != null) {
|
|
|
|
+ getExistingUpgradeIssueMessageDetails(existingUpgradeIssue));
|
|
|
|
if (existingUpgradeIssue.getState() == Issue.State.CLOSED) {
|
|
|
|
|
|
|
|
System.out.println(" Issue: " + issueNumber + " - " + title + " (supersedes #"
|
|
|
|
|
|
|
|
+ existingUpgradeIssue.getNumber() + " " + existingUpgradeIssue.getTitle() + ")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
System.out
|
|
|
|
|
|
|
|
.println(" Issue: " + issueNumber + " - " + title + " (completes existing upgrade)");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
System.out.println(" Issue: " + issueNumber + " - " + title);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new ProcessBuilder().command("git", "add", modified.toFile().getAbsolutePath())
|
|
|
|
if (new ProcessBuilder().command("git", "add", modified.toFile().getAbsolutePath())
|
|
|
|
.start()
|
|
|
|
.start()
|
|
|
|
.waitFor() != 0) {
|
|
|
|
.waitFor() != 0) {
|
|
|
@ -153,6 +135,25 @@ public abstract class UpgradeDependencies extends DefaultTask {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int getOrOpenUpgradeIssue(GitHubRepository repository, List<String> issueLabels, Milestone milestone,
|
|
|
|
|
|
|
|
String title, Issue existingUpgradeIssue) {
|
|
|
|
|
|
|
|
if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.OPEN) {
|
|
|
|
|
|
|
|
return existingUpgradeIssue.getNumber();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String body = (existingUpgradeIssue != null) ? "Supersedes #" + existingUpgradeIssue.getNumber() : "";
|
|
|
|
|
|
|
|
return repository.openIssue(title, body, issueLabels, milestone);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getExistingUpgradeIssueMessageDetails(Issue existingUpgradeIssue) {
|
|
|
|
|
|
|
|
if (existingUpgradeIssue == null) {
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (existingUpgradeIssue.getState() != Issue.State.CLOSED) {
|
|
|
|
|
|
|
|
return " (completes existing upgrade)";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return " (supersedes #" + existingUpgradeIssue.getNumber() + " " + existingUpgradeIssue.getTitle() + ")";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<String> verifyLabels(GitHubRepository repository) {
|
|
|
|
private List<String> verifyLabels(GitHubRepository repository) {
|
|
|
|
Set<String> availableLabels = repository.getLabels();
|
|
|
|
Set<String> availableLabels = repository.getLabels();
|
|
|
|
List<String> issueLabels = this.bom.getUpgrade().getGitHub().getIssueLabels();
|
|
|
|
List<String> issueLabels = this.bom.getUpgrade().getGitHub().getIssueLabels();
|
|
|
|