Skip to content

Commit

Permalink
Use null instead of ImportantOutputHandler#NO_OP.
Browse files Browse the repository at this point in the history
The no-op implementation is no longer invoked since we optimize by special-casing it. Given this, it makes more sense to use `null`.

PiperOrigin-RevId: 637945434
Change-Id: I3f486c699b66d44b62dec785225c3b1ca8608e95
  • Loading branch information
justinhorvitz authored and copybara-github committed May 28, 2024
1 parent d1760bd commit b7a1b21
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ ImmutableMap<String, ActionInput> processAndGetLostArtifacts(
ImmutableCollection<ActionInput> outputs, InputMetadataProvider metadataProvider)
throws ImportantOutputException, InterruptedException;

ImportantOutputHandler NO_OP = (outputs, metadataProvider) -> ImmutableMap.of();

/** Represents an exception encountered during {@link #processAndGetLostArtifacts}. */
final class ImportantOutputException extends Exception implements DetailedException {
private final FailureDetail failureDetail;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.google.devtools.build.lib.actions.BuildFailedException;
import com.google.devtools.build.lib.actions.DynamicStrategyRegistry;
import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.ImportantOutputHandler;
import com.google.devtools.build.lib.actions.MachineLoadProvider;
import com.google.devtools.build.lib.actions.PackageRoots;
import com.google.devtools.build.lib.actions.RemoteArtifactChecker;
Expand Down Expand Up @@ -165,8 +164,6 @@ public class ExecutionTool {
SpawnStrategyRegistry.Builder spawnStrategyRegistryBuilder =
SpawnStrategyRegistry.builder(env.getInvocationPolicy().getStrategyPolicy());
actionContextRegistryBuilder.register(SpawnStrategyResolver.class, new SpawnStrategyResolver());
actionContextRegistryBuilder.register(
ImportantOutputHandler.class, ImportantOutputHandler.NO_OP);

for (BlazeModule module : runtime.getBlazeModules()) {
try (SilentCloseable ignored = Profiler.instance().profile(module + ".executorInit")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ private Reset informImportantOutputHandler(
throws CompletionFunctionException, InterruptedException {
var importantOutputHandler =
skyframeActionExecutor.getActionContextRegistry().getContext(ImportantOutputHandler.class);
if (importantOutputHandler == ImportantOutputHandler.NO_OP) {
return null; // Avoid expanding artifacts if the default no-op handler is installed.
if (importantOutputHandler == null) {
return null;
}

Label label = key.actionLookupKey().getLabel();
Expand Down

0 comments on commit b7a1b21

Please sign in to comment.