[Skymeld] Implement --experimental_extra_action_top_level_only

This logic was missing for Skymeld.

PiperOrigin-RevId: 530248435
Change-Id: I196317bfd711dec557ebc6b30206b920c98072bb
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java b/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java
index d126acb..16beb59 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BuildDriverKey.java
@@ -33,12 +33,15 @@
   private final boolean skipIncompatibleExplicitTargets;
   private final boolean isTopLevelAspectDriver;
 
+  private final boolean extraActionTopLevelOnly;
+
   private BuildDriverKey(
       ActionLookupKeyOrProxy actionLookupKey,
       TopLevelArtifactContext topLevelArtifactContext,
       boolean strictActionConflictCheck,
       boolean explicitlyRequested,
       boolean skipIncompatibleExplicitTargets,
+      boolean extraActionTopLevelOnly,
       boolean isTopLevelAspectDriver,
       TestType testType) {
     this.actionLookupKey = actionLookupKey;
@@ -47,6 +50,7 @@
     this.explicitlyRequested = explicitlyRequested;
     this.skipIncompatibleExplicitTargets = skipIncompatibleExplicitTargets;
     this.isTopLevelAspectDriver = isTopLevelAspectDriver;
+    this.extraActionTopLevelOnly = extraActionTopLevelOnly;
     this.testType = testType;
   }
 
@@ -55,13 +59,15 @@
       TopLevelArtifactContext topLevelArtifactContext,
       boolean strictActionConflictCheck,
       boolean explicitlyRequested,
-      boolean skipIncompatibleExplicitTargets) {
+      boolean skipIncompatibleExplicitTargets,
+      boolean extraActionTopLevelOnly) {
     return new BuildDriverKey(
         actionLookupKey,
         topLevelArtifactContext,
         strictActionConflictCheck,
         explicitlyRequested,
         skipIncompatibleExplicitTargets,
+        extraActionTopLevelOnly,
         /* isTopLevelAspectDriver= */ true,
         TestType.NOT_TEST);
   }
@@ -72,6 +78,7 @@
       boolean strictActionConflictCheck,
       boolean explicitlyRequested,
       boolean skipIncompatibleExplicitTargets,
+      boolean extraActionTopLevelOnly,
       TestType testType) {
     return new BuildDriverKey(
         actionLookupKey,
@@ -79,6 +86,7 @@
         strictActionConflictCheck,
         explicitlyRequested,
         skipIncompatibleExplicitTargets,
+        extraActionTopLevelOnly,
         /* isTopLevelAspectDriver= */ false,
         testType);
   }
@@ -115,6 +123,10 @@
     return isTopLevelAspectDriver;
   }
 
+  public boolean isExtraActionTopLevelOnly() {
+    return extraActionTopLevelOnly;
+  }
+
   @Override
   public SkyFunctionName functionName() {
     return SkyFunctions.BUILD_DRIVER;