Feature configuration: add a field required_variables on flag_sets.
This allows to prevent expansion of flag sets based on whether build variables
are available. If required_variables is not set, and a variable that is
referenced in the flag_set's flags is not available, the build will fail.
We need the new behavior when some input files (for example profile data in
FDO enabled builds) are only available for a subset of the translation units of
a given target.
RELNOTES: None.
PiperOrigin-RevId: 100028996
diff --git a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
index f59caaf..96a7528 100644
--- a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
+++ b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto
@@ -109,6 +109,16 @@
// If 'with_feature' is omitted, the flag set will be applied
// unconditionally for every action specified.
repeated FeatureSet with_feature = 3;
+
+ // A list of build variables that this feature set needs, but which are
+ // allowed to not be set. If any of the build variables listed is not
+ // set, the feature set will not be expanded.
+ //
+ // NOTE: Consider alternatives before using this; usually tools should
+ // consistently create the same set of files, even if empty; use this
+ // only for backwards compatibility with already existing behavior in tools
+ // that are currently not worth changing.
+ repeated string expand_if_all_available = 4;
}
// Contains all flag specifications for one feature.