Add no-op trimming flag.
Subsequent safety changes will use this flag before the flag has any effect;
for now, it is a no-op, equivalent to specifying --experimental_dynamic_configs
equal to notrim (the default).
Progress on
@@ -828,13 +828,24 @@ public class BuildConfiguration implements BuildConfigurationApi {
/** 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.
+ *
+ * <p>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 class BuildConfiguration implements BuildConfigurationApi {
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.
*/
