Search in sources :

Example 31 with Subscribe

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);
}
Also used : LogRecord(java.util.logging.LogRecord) Subscribe(com.google.common.eventbus.Subscribe)

Example 32 with Subscribe

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();
}
Also used : RuleKey(com.facebook.buck.rules.RuleKey) CacheResultType(com.facebook.buck.artifact_cache.CacheResultType) Subscribe(com.google.common.eventbus.Subscribe)

Example 33 with Subscribe

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;
    }
}
Also used : ResultType(com.facebook.buck.test.result.type.ResultType) TestResultSummary(com.facebook.buck.test.TestResultSummary) Subscribe(com.google.common.eventbus.Subscribe)

Example 34 with Subscribe

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));
    }
}
Also used : EventKey(com.facebook.buck.event.EventKey) Subscribe(com.google.common.eventbus.Subscribe)

Example 35 with Subscribe

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));
    }
}
Also used : EventKey(com.facebook.buck.event.EventKey) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)179 GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)46 SimpleCommand (net.kodehawa.mantarobot.core.modules.commands.SimpleCommand)44 MessageEmbed (net.dv8tion.jda.core.entities.MessageEmbed)29 EmoteReference (net.kodehawa.mantarobot.utils.commands.EmoteReference)26 MantaroData (net.kodehawa.mantarobot.data.MantaroData)25 List (java.util.List)23 Category (net.kodehawa.mantarobot.core.modules.commands.base.Category)22 Utils (net.kodehawa.mantarobot.utils.Utils)22 CommandRegistry (net.kodehawa.mantarobot.core.CommandRegistry)21 Module (net.kodehawa.mantarobot.core.modules.Module)21 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)18 TimeUnit (java.util.concurrent.TimeUnit)16 Collectors (java.util.stream.Collectors)16 MantaroBot (net.kodehawa.mantarobot.MantaroBot)15 Player (net.kodehawa.mantarobot.db.entities.Player)15 DiscordUtils (net.kodehawa.mantarobot.utils.DiscordUtils)15 RateLimiter (net.kodehawa.mantarobot.utils.commands.RateLimiter)14 SubCommand (net.kodehawa.mantarobot.core.modules.commands.SubCommand)13 DBGuild (net.kodehawa.mantarobot.db.entities.DBGuild)13