use of com.facebook.buck.intellij.ideabuck.ui.utils.CompilerErrorItem in project buck by facebook.
the class BuckEventsConsumer method buildTargetErrorNode.
private BuckTreeNodeTarget buildTargetErrorNode(String target, List<String> errorMessages) {
BuckTreeNodeTarget targetNode = new BuckTreeNodeTarget(mCurrentBuildRootElement, target);
for (String currentError : errorMessages) {
ErrorExtractor errorExtractor = new ErrorExtractor(currentError);
ImmutableList<CompilerErrorItem> errorItems = errorExtractor.getErrors();
BuckTreeNodeFileError currentFileErrorNode = null;
String currentFilePath = "";
for (CompilerErrorItem currentErrorItem : errorItems) {
if (!currentErrorItem.getFilePath().equals(currentFilePath)) {
if (currentFileErrorNode != null) {
// Add to parent
targetNode.addFileError(currentFileErrorNode);
}
// Create the new node, for the new file
currentFileErrorNode = new BuckTreeNodeFileError(targetNode, currentErrorItem.getFilePath(), currentErrorItem);
currentFilePath = currentErrorItem.getFilePath();
} else {
currentFileErrorNode.addError(currentErrorItem);
}
}
if (currentFileErrorNode != null) {
// Add the leftovers
targetNode.addFileError(currentFileErrorNode);
}
}
return targetNode;
}
use of com.facebook.buck.intellij.ideabuck.ui.utils.CompilerErrorItem in project buck by facebook.
the class BuckEventsConsumer method consumeBuildEnd.
@Override
public void consumeBuildEnd(final long timestamp) {
mMainBuildEndTimestamp = timestamp;
float duration = (mMainBuildEndTimestamp - mMainBuildStartTimestamp) / 1000;
final String message = "Build ended, took " + duration + " seconds!";
int errors = 0;
int warnings = 0;
for (String cTarget : mErrors.keySet()) {
List<String> currentErrorMessages = mErrors.get(cTarget);
for (String currentErrorMessage : currentErrorMessages) {
ErrorExtractor errorExtractor = new ErrorExtractor(currentErrorMessage);
for (CompilerErrorItem currentErrorItem : errorExtractor.getErrors()) {
if (currentErrorItem.getType() == CompilerErrorItem.Type.ERROR) {
errors++;
} else {
warnings++;
}
}
}
}
String errorsMessage = "";
if (errors != 0) {
errorsMessage = "Found " + errors + " errors";
}
if (warnings != 0) {
if (errors != 0) {
errorsMessage += " and " + warnings + " warnings";
} else {
errorsMessage = "Found " + warnings + " warnings";
}
}
if (errorsMessage.length() > 0) {
errorsMessage += "!";
}
final String errorsMessageToUse = errorsMessage;
//set progress to 100%
consumeBuckBuildProgressUpdate(timestamp, 1f);
if (errorsMessageToUse.length() > 0) {
clearDisplay();
BuckTreeNodeDetail errorsMessageNode = new BuckTreeNodeDetail(BuckEventsConsumer.this.mCurrentBuildRootElement, BuckTreeNodeDetail.DetailType.ERROR, errorsMessageToUse);
BuckEventsConsumer.this.mCurrentBuildRootElement.addChild(errorsMessageNode);
// Display errors
BuckEventsConsumer.this.displayErrors();
}
BuckEventsConsumer.this.mBuildProgress.setDetail(message);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
BuckEventsConsumer.this.mTreeModel.reload();
}
});
}
Aggregations