Polish
This commit is contained in:
		
							parent
							
								
									dc45532c94
								
							
						
					
					
						commit
						527b2f2cac
					
				|  | @ -109,31 +109,13 @@ public abstract class UpgradeDependencies extends DefaultTask { | |||
| 			Issue existingUpgradeIssue = findExistingUpgradeIssue(existingUpgradeIssues, upgrade); | ||||
| 			try { | ||||
| 				Path modified = upgradeApplicator.apply(upgrade); | ||||
| 				int issueNumber; | ||||
| 				if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.OPEN) { | ||||
| 					issueNumber = existingUpgradeIssue.getNumber(); | ||||
| 				} | ||||
| 				else { | ||||
| 					issueNumber = repository.openIssue(title, | ||||
| 							(existingUpgradeIssue != null) ? "Supersedes #" + existingUpgradeIssue.getNumber() : "", | ||||
| 							issueLabels, milestone); | ||||
| 					if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) { | ||||
| 						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); | ||||
| 				int issueNumber = getOrOpenUpgradeIssue(repository, issueLabels, milestone, title, | ||||
| 						existingUpgradeIssue); | ||||
| 				if (existingUpgradeIssue != null && existingUpgradeIssue.getState() == Issue.State.CLOSED) { | ||||
| 					existingUpgradeIssue.label(Arrays.asList("type: task", "status: superseded")); | ||||
| 				} | ||||
| 				System.out.println("   Issue: " + issueNumber + " - " + title | ||||
| 						+ getExistingUpgradeIssueMessageDetails(existingUpgradeIssue)); | ||||
| 				if (new ProcessBuilder().command("git", "add", modified.toFile().getAbsolutePath()) | ||||
| 					.start() | ||||
| 					.waitFor() != 0) { | ||||
|  | @ -154,6 +136,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) { | ||||
| 		Set<String> availableLabels = repository.getLabels(); | ||||
| 		List<String> issueLabels = this.bom.getUpgrade().getGitHub().getIssueLabels(); | ||||
|  |  | |||
|  | @ -117,9 +117,8 @@ public class JobLauncherApplicationRunner | |||
| 	public void afterPropertiesSet() { | ||||
| 		if (StringUtils.hasText(this.jobNames)) { | ||||
| 			for (String jobName : jobsToRun()) { | ||||
| 				if (!isLocalJob(jobName) && !isRegisteredJob(jobName)) { | ||||
| 					throw new IllegalArgumentException("No job found with name '" + jobName + "'"); | ||||
| 				} | ||||
| 				Assert.isTrue(isLocalJob(jobName) || isRegisteredJob(jobName), | ||||
| 						() -> "No job found with name '" + jobName + "'"); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  |  | |||
|  | @ -187,9 +187,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { | |||
| 		} | ||||
| 		IllegalStateException ex = new IllegalStateException( | ||||
| 				String.format("Logback configuration error detected: %n%s", errors)); | ||||
| 		for (Throwable suppressedException : suppressedExceptions) { | ||||
| 			ex.addSuppressed(suppressedException); | ||||
| 		} | ||||
| 		suppressedExceptions.forEach(ex::addSuppressed); | ||||
| 		throw ex; | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue