Allow conditioning flags on the _absence_ of a feature.

This allows a flag_set to emit one flag when a feature is enabled, and a
different flag when that feature is disabled.

And while I was in there, I noticed and fixed a couple other issues:

1. env_set didn't actually implement with_feature, despite having the field in
   its proto.
2. action_config implemented with_feature as an optional field, instead of
   repeated field.

RELNOTES: None
PiperOrigin-RevId: 176510960
This commit is contained in:
Googler 2017-11-21 17:21:49 +01:00 committed by Marcel Hlopko
parent 199f7d9280
commit 851eed198a
1 changed files with 24 additions and 10 deletions

View File

@ -127,11 +127,19 @@ message CToolchain {
}
// A set of features; used to support logical 'and' when specifying feature
// requirements in FlagSet and Feature.
// requirements in Feature.
message FeatureSet {
repeated string feature = 1;
}
// A set of positive and negative features. This stanza will
// evaluate to true when every 'feature' is enabled, and every
// 'not_feature' is not enabled.
message WithFeatureSet {
repeated string feature = 1;
repeated string not_feature = 2;
}
// A set of flags that are expanded in the command line for specific actions.
message FlagSet {
// The actions this flag set applies to; each flag set must specify at
@ -142,12 +150,13 @@ message CToolchain {
repeated FlagGroup flag_group = 2;
// A list of feature sets defining when this flag set gets applied. The
// flag set will be applied when any of the feature sets fully apply, that
// is, when all features of the feature set are enabled.
// flag set will be applied when any one of the feature sets evaluate to
// true. (That is, when when every 'feature' is enabled, and every
// 'not_feature' is not enabled.)
//
// If 'with_feature' is omitted, the flag set will be applied
// unconditionally for every action specified.
repeated FeatureSet with_feature = 3;
repeated WithFeatureSet 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
@ -171,12 +180,13 @@ message CToolchain {
repeated EnvEntry env_entry = 2;
// A list of feature sets defining when this env set gets applied. The
// env set will be applied when any of the feature sets fully apply, that
// is, when all features of the feature set are enabled.
// env set will be applied when any one of the feature sets evaluate to
// true. (That is, when when every 'feature' is enabled, and every
// 'not_feature' is not enabled.)
//
// If 'with_feature' is omitted, the env set will be applied
// unconditionally for every action specified.
repeated FeatureSet with_feature = 3;
repeated WithFeatureSet with_feature = 3;
}
// Contains all flag specifications for one feature.
@ -235,10 +245,14 @@ message CToolchain {
// Path to the tool, relative to the location of the crosstool.
required string tool_path = 1;
// A feature set defining when this tool is applicable. If this attribute
// is left out, the Tool will be assumed to apply for any feature
// A list of feature sets defining when this tool is applicable. The tool
// will used when any one of the feature sets evaluate to true. (That is,
// when when every 'feature' is enabled, and every 'not_feature' is not
// enabled.)
//
// If 'with_feature' is omitted, the tool will apply for any feature
// configuration.
optional FeatureSet with_feature = 2;
repeated WithFeatureSet with_feature = 2;
// Requirements on the execution environment for the execution of this tool,
// to be passed as out-of-band "hints" to the execution backend.