From a72be0f1d68ec449d463f825afa0aaabc4f05246 Mon Sep 17 00:00:00 2001 From: Ulf Adams Date: Sat, 26 Sep 2015 10:29:28 +0000 Subject: Move the BuildView over from BlazeRuntime to CommandEnvironment. It doesn't contain any state anymore, so creating a new instance per command is safe. On the other hand, it would be just as safe to merge the remaining code into SkyframeBuildView, which we might do in the future. -- MOS_MIGRATED_REVID=104010694 --- .../com/google/devtools/build/lib/runtime/BlazeRuntime.java | 13 +------------ .../devtools/build/lib/runtime/CommandEnvironment.java | 5 ++++- 2 files changed, 5 insertions(+), 13 deletions(-) (limited to 'src/main/java/com/google') 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 ec59b95010..3a78f0aaa6 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 @@ -174,7 +174,6 @@ public final class BlazeRuntime { private final PackageFactory packageFactory; private final ConfigurationFactory configurationFactory; private final ConfiguredRuleClassProvider ruleClassProvider; - private final BuildView view; private ActionCache actionCache; private final TimestampGranularityMonitor timestampGranularityMonitor; private final Clock clock; @@ -224,8 +223,6 @@ public final class BlazeRuntime { this.blazeModules = blazeModules; this.ruleClassProvider = ruleClassProvider; this.configurationFactory = configurationFactory; - this.view = new BuildView(directories, ruleClassProvider, skyframeExecutor, - getCoverageReportActionFactory(blazeModules)); this.clock = clock; this.timestampGranularityMonitor = Preconditions.checkNotNull(timestampGranularityMonitor); this.startupOptionsProvider = startupOptionsProvider; @@ -240,8 +237,7 @@ public final class BlazeRuntime { setupExecRoot(); } - @Nullable private CoverageReportActionFactory getCoverageReportActionFactory( - Iterable blazeModules) { + @Nullable CoverageReportActionFactory getCoverageReportActionFactory() { CoverageReportActionFactory firstFactory = null; for (BlazeModule module : blazeModules) { CoverageReportActionFactory factory = module.getCoverageReportFactory(); @@ -539,13 +535,6 @@ public final class BlazeRuntime { return loadingPhaseRunner; } - /** - * Returns the build view. - */ - BuildView getView() { - return view; - } - public Iterable getBlazeModules() { return blazeModules; } 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 1aaf945380..83c3cd3b34 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 @@ -61,6 +61,7 @@ public final class CommandEnvironment { private final EventBus eventBus; private final BlazeModule.ModuleEnvironment blazeModuleEnvironment; private final Map clientEnv = new HashMap<>(); + private final BuildView view; private String outputFileSystem; @@ -89,6 +90,8 @@ public final class CommandEnvironment { this.reporter = reporter; this.eventBus = eventBus; this.blazeModuleEnvironment = new BlazeModuleEnvironment(); + this.view = new BuildView(runtime.getDirectories(), runtime.getRuleClassProvider(), + runtime.getSkyframeExecutor(), runtime.getCoverageReportActionFactory()); } public BlazeRuntime getRuntime() { @@ -138,7 +141,7 @@ public final class CommandEnvironment { } public BuildView getView() { - return runtime.getView(); + return view; } public PackageRootResolver getPackageRootResolver() { -- cgit v1.2.3