Add --experimental_shadowed_action to graveyard options for all commands.

RELNOTES: None.
PiperOrigin-RevId: 377118820
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java
index fb83f98..1624da1 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java
@@ -44,8 +44,8 @@
 
 /** Module implementing the rule set of Bazel. */
 public final class BazelRulesModule extends BlazeModule {
-  /** This is where deprecated options go to die. */
-  public static final class GraveyardOptions extends OptionsBase {
+  /** This is where deprecated options only needed for the build command go to die. */
+  public static final class BuildGraveyardOptions extends OptionsBase {
     @Option(
         name = "incompatible_load_python_rules_from_bzl",
         defaultValue = "false",
@@ -502,7 +502,11 @@
         },
         help = "No-op")
     public boolean dontUseJavaSourceInfoProvider;
+  }
 
+  /** This is where deprecated options which need to be available for all commands go to die. */
+  public static final class AllCommandGraveyardOptions extends OptionsBase {
+    // Historically passed to all Bazel commands by certain tools.
     @Option(
         name = "experimental_shadowed_action",
         defaultValue = "true",
@@ -546,8 +550,8 @@
   @Override
   public Iterable<Class<? extends OptionsBase>> getCommandOptions(Command command) {
     return "build".equals(command.name())
-        ? ImmutableList.of(GraveyardOptions.class)
-        : ImmutableList.of();
+        ? ImmutableList.of(BuildGraveyardOptions.class, AllCommandGraveyardOptions.class)
+        : ImmutableList.of(AllCommandGraveyardOptions.class);
   }
 
   private static void validateRemoteOutputsMode(CommandEnvironment env) throws AbruptExitException {