|
|
@ -101,21 +101,12 @@ public abstract class UpgradeDependencies extends DefaultTask {
|
|
|
|
Path gradleProperties = new File(getProject().getRootProject().getProjectDir(), "gradle.properties").toPath();
|
|
|
|
Path gradleProperties = new File(getProject().getRootProject().getProjectDir(), "gradle.properties").toPath();
|
|
|
|
UpgradeApplicator upgradeApplicator = new UpgradeApplicator(buildFile, gradleProperties);
|
|
|
|
UpgradeApplicator upgradeApplicator = new UpgradeApplicator(buildFile, gradleProperties);
|
|
|
|
List<Issue> existingUpgradeIssues = repository.findIssues(issueLabels, milestone);
|
|
|
|
List<Issue> existingUpgradeIssues = repository.findIssues(issueLabels, milestone);
|
|
|
|
|
|
|
|
System.out.println("Applying upgrades...");
|
|
|
|
|
|
|
|
System.out.println("");
|
|
|
|
for (Upgrade upgrade : upgrades) {
|
|
|
|
for (Upgrade upgrade : upgrades) {
|
|
|
|
|
|
|
|
System.out.println(upgrade.getLibrary().getName() + " " + upgrade.getVersion());
|
|
|
|
String title = issueTitle(upgrade);
|
|
|
|
String title = issueTitle(upgrade);
|
|
|
|
Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade);
|
|
|
|
Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade);
|
|
|
|
if (existingUpgradeIssue != null) {
|
|
|
|
|
|
|
|
if (existingUpgradeIssue.getState() == Issue.State.CLOSED) {
|
|
|
|
|
|
|
|
System.out.println(title + " (supersedes #" + existingUpgradeIssue.getNumber() + " "
|
|
|
|
|
|
|
|
+ existingUpgradeIssue.getTitle() + ")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
System.out.println(title + " (completes existing upgrade)");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
System.out.println(title);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Path modified = upgradeApplicator.apply(upgrade);
|
|
|
|
Path modified = upgradeApplicator.apply(upgrade);
|
|
|
|
int issueNumber;
|
|
|
|
int issueNumber;
|
|
|
@ -130,16 +121,29 @@ public abstract class UpgradeDependencies extends DefaultTask {
|
|
|
|
existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded"));
|
|
|
|
existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (existingUpgradeIssue != null) {
|
|
|
|
|
|
|
|
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) {
|
|
|
|
throw new IllegalStateException("git add failed");
|
|
|
|
throw new IllegalStateException("git add failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (new ProcessBuilder().command("git", "commit", "-m", commitMessage(upgrade, issueNumber))
|
|
|
|
String commitMessage = commitMessage(upgrade, issueNumber);
|
|
|
|
.start()
|
|
|
|
if (new ProcessBuilder().command("git", "commit", "-m", commitMessage).start().waitFor() != 0) {
|
|
|
|
.waitFor() != 0) {
|
|
|
|
|
|
|
|
throw new IllegalStateException("git commit failed");
|
|
|
|
throw new IllegalStateException("git commit failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println(" Commit: " + commitMessage.substring(commitMessage.indexOf('\n')));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (IOException ex) {
|
|
|
|
catch (IOException ex) {
|
|
|
|
throw new TaskExecutionException(this, ex);
|
|
|
|
throw new TaskExecutionException(this, ex);
|
|
|
|