Skip to content

Commit 4d75f2c

Browse files
committed
Improve log output when applying upgrades
Closes gh-35296
1 parent 1765f4e commit 4d75f2c

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,12 @@ private void applyUpgrades(GitHubRepository repository, List<String> issueLabels
101101
Path gradleProperties = new File(getProject().getRootProject().getProjectDir(), "gradle.properties").toPath();
102102
UpgradeApplicator upgradeApplicator = new UpgradeApplicator(buildFile, gradleProperties);
103103
List<Issue> existingUpgradeIssues = repository.findIssues(issueLabels, milestone);
104+
System.out.println("Applying upgrades...");
105+
System.out.println("");
104106
for (Upgrade upgrade : upgrades) {
107+
System.out.println(upgrade.getLibrary().getName() + " " + upgrade.getVersion());
105108
String title = issueTitle(upgrade);
106109
Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade);
107-
if (existingUpgradeIssue != null) {
108-
if (existingUpgradeIssue.getState() == Issue.State.CLOSED) {
109-
System.out.println(title + " (supersedes #" + existingUpgradeIssue.getNumber() + " "
110-
+ existingUpgradeIssue.getTitle() + ")");
111-
}
112-
else {
113-
System.out.println(title + " (completes existing upgrade)");
114-
}
115-
}
116-
else {
117-
System.out.println(title);
118-
}
119110
try {
120111
Path modified = upgradeApplicator.apply(upgrade);
121112
int issueNumber;
@@ -130,16 +121,29 @@ private void applyUpgrades(GitHubRepository repository, List<String> issueLabels
130121
existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded"));
131122
}
132123
}
124+
if (existingUpgradeIssue != null) {
125+
if (existingUpgradeIssue.getState() == Issue.State.CLOSED) {
126+
System.out.println(" Issue: " + issueNumber + " - " + title + " (supersedes #"
127+
+ existingUpgradeIssue.getNumber() + " " + existingUpgradeIssue.getTitle() + ")");
128+
}
129+
else {
130+
System.out
131+
.println(" Issue: " + issueNumber + " - " + title + " (completes existing upgrade)");
132+
}
133+
}
134+
else {
135+
System.out.println(" Issue: " + issueNumber + " - " + title);
136+
}
133137
if (new ProcessBuilder().command("git", "add", modified.toFile().getAbsolutePath())
134138
.start()
135139
.waitFor() != 0) {
136140
throw new IllegalStateException("git add failed");
137141
}
138-
if (new ProcessBuilder().command("git", "commit", "-m", commitMessage(upgrade, issueNumber))
139-
.start()
140-
.waitFor() != 0) {
142+
String commitMessage = commitMessage(upgrade, issueNumber);
143+
if (new ProcessBuilder().command("git", "commit", "-m", commitMessage).start().waitFor() != 0) {
141144
throw new IllegalStateException("git commit failed");
142145
}
146+
System.out.println(" Commit: " + commitMessage.substring(commitMessage.indexOf('\n')));
143147
}
144148
catch (IOException ex) {
145149
throw new TaskExecutionException(this, ex);

0 commit comments

Comments
 (0)