diff options
author | 2018-06-11 01:38:33 -0700 | |
---|---|---|
committer | 2018-06-11 01:40:17 -0700 | |
commit | 2c89206a407d8cae0945abe7eb179ee6bb77d9de (patch) | |
tree | 1314352acb1ccda52be27d8d063104eae891669c /src/main/java/com/google/devtools/build/lib/standalone | |
parent | ce9aafcf63dd198fe16c682dfeedc444f07b5669 (diff) |
Remove ActionContextConsumer
Instead, add some simple APIs to ExecutorBuilder and inline all the previous
subclasses into their corresponding modules. This removes a bunch of
boilerplate.
PiperOrigin-RevId: 200017162
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/standalone')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/standalone/StandaloneActionContextConsumer.java | 37 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/standalone/StandaloneModule.java | 9 |
2 files changed, 8 insertions, 38 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/standalone/StandaloneActionContextConsumer.java b/src/main/java/com/google/devtools/build/lib/standalone/StandaloneActionContextConsumer.java deleted file mode 100644 index 225b3a3a6f..0000000000 --- a/src/main/java/com/google/devtools/build/lib/standalone/StandaloneActionContextConsumer.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.standalone; - -import com.google.devtools.build.lib.actions.SpawnActionContext; -import com.google.devtools.build.lib.exec.ActionContextConsumer; -import com.google.devtools.build.lib.exec.SpawnActionContextMaps; - -/** - * {@link ActionContextConsumer} that requests the action contexts necessary for standalone - * execution. - */ -public class StandaloneActionContextConsumer implements ActionContextConsumer { - - @Override - public void populate(SpawnActionContextMaps.Builder builder) { - // This makes the "sandboxed" strategy the default Spawn strategy, unless it is overridden by a - // later BlazeModule. - builder.strategyByMnemonicMap().put("", "standalone"); - - // This makes the "standalone" strategy available via --spawn_strategy=standalone, but it is not - // necessarily the default. - builder.strategyByContextMap().put(SpawnActionContext.class, "standalone"); - } -} diff --git a/src/main/java/com/google/devtools/build/lib/standalone/StandaloneModule.java b/src/main/java/com/google/devtools/build/lib/standalone/StandaloneModule.java index ead6811fcb..728dc4b6d7 100644 --- a/src/main/java/com/google/devtools/build/lib/standalone/StandaloneModule.java +++ b/src/main/java/com/google/devtools/build/lib/standalone/StandaloneModule.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.standalone; +import com.google.devtools.build.lib.actions.SpawnActionContext; import com.google.devtools.build.lib.buildtool.BuildRequest; import com.google.devtools.build.lib.exec.ExecutorBuilder; import com.google.devtools.build.lib.runtime.BlazeModule; @@ -26,6 +27,12 @@ public class StandaloneModule extends BlazeModule { public void executorInit(CommandEnvironment env, BuildRequest request, ExecutorBuilder builder) { builder.addActionContextProvider(new StandaloneActionContextProvider(env)); builder.addActionContextProvider(new DummyIncludeScanningContextProvider(env)); - builder.addActionContextConsumer(new StandaloneActionContextConsumer()); + // This makes the "sandboxed" strategy the default Spawn strategy, unless it is overridden by a + // later BlazeModule. + builder.addStrategyByMnemonic("", "standalone"); + + // This makes the "standalone" strategy available via --spawn_strategy=standalone, but it is not + // necessarily the default. + builder.addStrategyByContext(SpawnActionContext.class, "standalone"); } } |