aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-09-26 10:29:28 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-09-28 11:39:54 +0000
commita72be0f1d68ec449d463f825afa0aaabc4f05246 (patch)
tree7bd923bca0d610eab13162e2c451c2d69f6720b7 /src
parent003fe96262be45e600ccba6c687dc6b770f734cf (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java5
2 files changed, 5 insertions, 13 deletions
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<BlazeModule> 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<BlazeModule> 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<String, String> 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() {