All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sealights.agents.plugin.BuildFailureFormatter Maven / Gradle / Ivy

There is a newer version: 4.0.1125
Show newest version
package io.sealights.agents.plugin;

import java.util.List;

import io.sealights.agents.plugin.MavenEventsListener.FailedProjectInfo;

public class BuildFailureFormatter {
	public static final String BUILD_SUBPROJECTS_FAILED = "Build failed due to sub-projects failure";
	public final static String SPECIAL_CHAR = "\u001B[";
	public final static String EOF_LINE = "\n";
	private final static String EOF_SPECIAL_CHAR = "m";
	
	public static String format(String rawString) {
		String converted = rawString;
		for (;;) {
			String tmp = extractNextSpecialChar(converted);
			if (tmp==null) break;
			else converted = tmp;
		}
		return converted.replace(EOF_LINE, "");
	}
	
	public static String collectFailures(FailedProjectInfo buildFailure, List projectsFailures) {
		if (projectsFailures.isEmpty()) {
			return buildFailure.reason;
		}
		
		StringBuilder builder = new StringBuilder();
		builder.append(buildFailure.reason).append(": {" );
		int ctr = 0;
		int last = projectsFailures.size() -1;
		for (FailedProjectInfo fi: projectsFailures) {
			builder.append(String.format("\nproject:'%s', failure: '%s'", fi.projectName, fi.reason));
			if (ctr




© 2015 - 2025 Weber Informatics LLC | Privacy Policy