diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java index 6bc26ece0a16a4..73fbc53bdf12bc 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java @@ -828,13 +828,24 @@ public static class Options extends FragmentOptions implements Cloneable { /** Values for --experimental_dynamic_configs. */ public enum ConfigsMode { - /** Only include the configuration fragments each rule needs. */ + /** + * Deprecated mode: Each configured target is evaluated with only the configuration fragments + * it needs by loading the target graph and examining the transitive requirements for each + * target before analysis begins. + * + *

To become a no-op soon: b/129289764 + */ ON, - /** Always including all fragments known to Blaze. */ + /** Default mode: Each configured target is evaluated with all fragments known to Blaze. */ NOTRIM, + /** + * Experimental mode: Each configured target is evaluated with only the configuration + * fragments it needs by visiting them with a full configuration to begin with and collapsing + * the configuration down to the fragments which were actually used. + */ + RETROACTIVE; } - /** * Converter for --experimental_dynamic_configs. */ @@ -1757,6 +1768,14 @@ public boolean trimConfigurations() { return options.configsMode == Options.ConfigsMode.ON; } + /** + * Returns whether we should trim configurations to only include the fragments needed to correctly + * analyze a rule. + */ + public boolean trimConfigurationsRetroactively() { + return options.configsMode == Options.ConfigsMode.RETROACTIVE; + } + /** * Returns compilation mode. */