diff options
author | 2015-11-02 08:45:26 +0000 | |
---|---|---|
committer | 2015-11-02 16:56:28 +0000 | |
commit | 39b18cae5102e7a10272ef2752461c2287d4493d (patch) | |
tree | f45ce24724854ff589f3ddd5c9ff35f1c57a435f /src/main/java/com/google/devtools/build/lib/runtime | |
parent | 1aa49da5e5f9e98ce3a2a0b96f387f2990a2363f (diff) |
Remove BlazeRuntime.reporter; use a BlazeModule to attach event handlers.
This only affects tests that previously set a Reporter on the BlazeRuntime;
the production code is already using the per-command Reporter in all cases.
--
MOS_MIGRATED_REVID=106820846
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
3 files changed, 6 insertions, 17 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java index 100a075d92..2235eb80cf 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java @@ -206,7 +206,7 @@ public class BlazeCommandDispatcher { * client process, or throws {@link ShutdownBlazeServerException} to * indicate that a command wants to shutdown the Blaze server. */ - public int exec(List<String> args, OutErr outErr, long firstContactTime) + int exec(List<String> args, OutErr outErr, long firstContactTime) throws ShutdownBlazeServerException { // Record the start time for the profiler and the timestamp granularity monitor. Do not put // anything before this! diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java index 8339240329..a0ab1bc88b 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java @@ -154,8 +154,6 @@ public final class BlazeRuntime { private final Map<String, BlazeCommand> commandMap = new LinkedHashMap<>(); private final Clock clock; - // Always null in production! Only non-null when tests inject a custom reporter. - private final Reporter reporter; private final PackageFactory packageFactory; private final ConfigurationFactory configurationFactory; private final ConfiguredRuleClassProvider ruleClassProvider; @@ -180,7 +178,7 @@ public final class BlazeRuntime { @Nullable private Range<Long> lastExecutionRange = null; - private BlazeRuntime(BlazeDirectories directories, Reporter reporter, + private BlazeRuntime(BlazeDirectories directories, WorkspaceStatusAction.Factory workspaceStatusActionFactory, final SkyframeExecutor skyframeExecutor, PackageFactory pkgFactory, ConfiguredRuleClassProvider ruleClassProvider, @@ -195,7 +193,6 @@ public final class BlazeRuntime { overrideCommands(commands); this.workspaceStatusActionFactory = workspaceStatusActionFactory; - this.reporter = reporter; this.packageFactory = pkgFactory; this.binTools = binTools; this.projectFileProvider = projectFileProvider; @@ -260,7 +257,7 @@ public final class BlazeRuntime { EventBus eventBus = new EventBus(eventBusExceptionHandler); skyframeExecutor.setEventBus(eventBus); UUID commandId = UUID.randomUUID(); - return new CommandEnvironment(this, commandId, reporter, eventBus); + return new CommandEnvironment(this, commandId, eventBus); } private void clearEventBus() { @@ -1279,7 +1276,6 @@ public final class BlazeRuntime { public static class Builder { private BlazeDirectories directories; - private Reporter reporter; private ConfigurationFactory configurationFactory; private Clock clock; private OptionsProvider startupOptionsProvider; @@ -1447,7 +1443,7 @@ public final class BlazeRuntime { } } - return new BlazeRuntime(directories, reporter, workspaceStatusActionFactory, skyframeExecutor, + return new BlazeRuntime(directories, workspaceStatusActionFactory, skyframeExecutor, pkgFactory, ruleClassProvider, configurationFactory, clock, startupOptionsProvider, ImmutableList.copyOf(blazeModules), timestampMonitor, eventBusExceptionHandler, binTools, projectFileProvider, commands); @@ -1473,11 +1469,6 @@ public final class BlazeRuntime { return this; } - public Builder setReporter(Reporter reporter) { - this.reporter = reporter; - return this; - } - public Builder setConfigurationFactory(ConfigurationFactory configurationFactory) { this.configurationFactory = configurationFactory; return this; diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java index af2d05a611..d4516a021c 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java @@ -20,7 +20,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Range; import com.google.common.eventbus.EventBus; import com.google.devtools.build.lib.actions.PackageRootResolver; import com.google.devtools.build.lib.actions.cache.ActionCache; @@ -104,11 +103,10 @@ public final class CommandEnvironment { } } - public CommandEnvironment(BlazeRuntime runtime, UUID commandId, Reporter reporter, - EventBus eventBus) { + public CommandEnvironment(BlazeRuntime runtime, UUID commandId, EventBus eventBus) { this.runtime = runtime; this.commandId = commandId; - this.reporter = reporter == null ? new Reporter() : reporter; + this.reporter = new Reporter(); this.eventBus = eventBus; this.blazeModuleEnvironment = new BlazeModuleEnvironment(); |