use of com.google.common.eventbus.Subscribe in project buck by facebook.
the class JavaUtilsLoggingBuildListener method ruleSuspended.
@Subscribe
public void ruleSuspended(BuildRuleEvent.Suspended suspended) {
LogRecord record = new LogRecord(LEVEL, suspended.toString());
record.setMillis(suspended.getTimestamp());
LOG.log(record);
}
use of com.google.common.eventbus.Subscribe in project buck by facebook.
the class RuleKeyLoggerListener method onArtifactCacheEvent.
@Subscribe
public void onArtifactCacheEvent(HttpArtifactCacheEvent.Finished event) {
if (event.getOperation() != ArtifactCacheEvent.Operation.FETCH || !event.getCacheResult().isPresent()) {
return;
}
CacheResultType cacheResultType = event.getCacheResult().get().getType();
if (cacheResultType != CacheResultType.MISS && cacheResultType != CacheResultType.ERROR) {
return;
}
List<String> newLogLines = Lists.newArrayList();
for (RuleKey key : event.getRuleKeys()) {
newLogLines.add(toTsv(key, cacheResultType));
}
synchronized (lock) {
logLines.addAll(newLogLines);
}
flushLogLinesIfNeeded();
}
use of com.google.common.eventbus.Subscribe in project buck by facebook.
the class SuperConsoleEventBusListener method testSummaryFinished.
@Subscribe
public void testSummaryFinished(TestSummaryEvent.Finished finished) {
threadsToRunningTestSummaryEvent.put(finished.getThreadId(), Optional.empty());
TestResultSummary testResult = finished.getTestResultSummary();
ResultType resultType = testResult.getType();
switch(resultType) {
case SUCCESS:
numPassingTests.incrementAndGet();
break;
case FAILURE:
numFailingTests.incrementAndGet();
// We don't use TestResultFormatter.reportResultSummary() here since that also
// includes the stack trace and stdout/stderr.
logEvents.add(ConsoleEvent.severe(String.format(locale, "%s %s %s: %s", testResult.getType().toString(), testResult.getTestCaseName(), testResult.getTestName(), testResult.getMessage())));
break;
case ASSUMPTION_VIOLATION:
numAssumptionViolationTests.incrementAndGet();
break;
case DISABLED:
numDisabledTests.incrementAndGet();
break;
case DRY_RUN:
numDryRunTests.incrementAndGet();
break;
case EXCLUDED:
numExcludedTests.incrementAndGet();
break;
}
}
use of com.google.common.eventbus.Subscribe in project buck by facebook.
the class AbstractConsoleEventBusListener method parseStarted.
@Subscribe
public void parseStarted(ParseEvent.Started started) {
parseStarted.add(started);
EventKey eventKey = started.getEventKey();
if (!buckFilesProcessing.containsKey(eventKey)) {
buckFilesProcessing.put(eventKey, EventPair.builder().setStart(started).build());
} else {
EventPair pair = buckFilesProcessing.get(eventKey);
buckFilesProcessing.put(eventKey, pair.withStart(started));
}
}
use of com.google.common.eventbus.Subscribe in project buck by facebook.
the class AbstractConsoleEventBusListener method parseFinished.
@Subscribe
public void parseFinished(ParseEvent.Finished finished) {
parseFinished.add(finished);
if (progressEstimator.isPresent()) {
progressEstimator.get().didFinishParsing();
}
EventKey eventKey = finished.getEventKey();
if (!buckFilesProcessing.containsKey(eventKey)) {
buckFilesProcessing.put(eventKey, EventPair.builder().setFinish(finished).build());
} else {
EventPair pair = buckFilesProcessing.get(eventKey);
buckFilesProcessing.put(eventKey, pair.withFinish(finished));
}
}
Aggregations