dev.gradleplugins.runnerkit.BuildFailure Maven / Gradle / Ivy
The newest version!
package dev.gradleplugins.runnerkit;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@EqualsAndHashCode
public final class BuildFailure implements BuildResult.Failure {
private final String description;
private final List causes;
BuildFailure(String description, List causes) {
this.description = description;
this.causes = causes;
}
@Override
public String getDescription() {
return description;
}
@Override
public List getCauses() {
return causes;
}
public static BuildFailure describedBy(String description) {
return new BuildFailure(description, Collections.emptyList());
}
public BuildFailure causedBy(String cause) {
List causes = new ArrayList<>();
causes.addAll(this.causes);
causes.add(cause);
return new BuildFailure(description, Collections.unmodifiableList(causes));
}
}