Split dynamic configurations mode into:

 --experimental_dynamic_configs=off - don't use dynamic configs
 --experimental_dynamic_configs=on - use dynamic configs with trimmed fragments
 --experimental_dynamic_configs=notrim - use dynamic configs with all fragments

This lets us decouple two independent dimensions of dynamic configurations: 1) being able to trigger new configurations and transitions anywhere and 2) only including the fragments needed by a target's transitive closure.

2) is likely to take much more time and effort to properly finesse (three notable challenges: late-bound attributes, aspects, and dynamic shedding of output path names). But 1) by itself already yields significant benefits. So in the name of starting to shift the config work from backend theory to stuff real builds actually use, this change lets us focus on productionizing 1) without blocking on getting all of 2) working first.

tl;dr: iterable deployment and all that.

--
MOS_MIGRATED_REVID=133874661
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
index 95912b4..6376fd5 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
@@ -738,14 +738,17 @@
       }
     }
     return configurations.useDynamicConfigurations()
-        ? trimConfigurations(nodes, eventHandler)
+        ? getDynamicConfigurations(nodes, eventHandler)
         : ImmutableList.copyOf(nodes);
   }
 
   /**
-   * Transforms a collection of <Target, Configuration> pairs by trimming each target's
+   * <p>If {@link BuildConfiguration.Options#trimConfigurations()} is true, transforms a collection
+   * of <Target, Configuration> pairs by trimming each target's
    * configuration to only the fragments the target and its transitive dependencies need.
    *
+   * <p>Else returns configurations that unconditionally include all fragments.
+   *
    * <p>Preserves the original input order. Uses original (untrimmed) configurations for targets
    * that can't be evaluated (e.g. due to loading phase errors).
    *
@@ -756,8 +759,9 @@
    */
   // TODO(bazel-team): error out early for targets that fail - untrimmed configurations should
   // never make it through analysis (and especially not seed ConfiguredTargetValues)
-  private List<TargetAndConfiguration> trimConfigurations(Iterable<TargetAndConfiguration> inputs,
-      EventHandler eventHandler) throws InterruptedException {
+  private List<TargetAndConfiguration> getDynamicConfigurations(
+      Iterable<TargetAndConfiguration> inputs, EventHandler eventHandler)
+      throws InterruptedException {
     Map<Label, TargetAndConfiguration> labelsToTargets = new LinkedHashMap<>();
     BuildConfiguration topLevelConfig = null;
     List<Dependency> asDeps = new ArrayList<Dependency>();
@@ -805,12 +809,16 @@
   }
 
   /**
-   * Trims a configuration to the fragments needed by the given target.
+   * Gets a dynamic configuration for the given target.
+   *
+   * <p>If {@link BuildConfiguration.Options#trimConfigurations()} is true, the configuration only
+   * includes the fragments needed by the fragment and its transitive closure. Else unconditionally
+   * includes all fragments.
    */
   @VisibleForTesting
-  public BuildConfiguration trimConfigurationForTesting(Target target, BuildConfiguration config,
-      EventHandler eventHandler) throws InterruptedException {
-    return Iterables.getOnlyElement(trimConfigurations(
+  public BuildConfiguration getDynamicConfigurationForTesting(Target target,
+      BuildConfiguration config, EventHandler eventHandler) throws InterruptedException {
+    return Iterables.getOnlyElement(getDynamicConfigurations(
         ImmutableList.<TargetAndConfiguration>of(new TargetAndConfiguration(target, config)),
         eventHandler)).getConfiguration();
   }