mirror of https://github.com/bazelbuild/rules_cc
Rename ExpandArgs to NestedArgs
After discussion with @amontanez in unknown commit, we decided that NestedArgs was a more appropriate name. BEGIN_PUBLIC Rename ExpandArgs to NestedArgs END_PUBLIC PiperOrigin-RevId: 617085672 Change-Id: I1d7190cac79f8fa953d23be7d0db3b028a84cf30
This commit is contained in:
parent
bbb0615a87
commit
aa19278bbd
|
@ -25,8 +25,8 @@ load(
|
||||||
"ActionTypeSetInfo",
|
"ActionTypeSetInfo",
|
||||||
"ArgsInfo",
|
"ArgsInfo",
|
||||||
"ArgsListInfo",
|
"ArgsListInfo",
|
||||||
"ExpandArgsInfo",
|
|
||||||
"FeatureConstraintInfo",
|
"FeatureConstraintInfo",
|
||||||
|
"NestedArgsInfo",
|
||||||
)
|
)
|
||||||
|
|
||||||
visibility("public")
|
visibility("public")
|
||||||
|
@ -39,12 +39,12 @@ def _cc_args_impl(ctx):
|
||||||
files = collect_files(ctx.attr.data)
|
files = collect_files(ctx.attr.data)
|
||||||
requires = collect_provider(ctx.attr.requires_any_of, FeatureConstraintInfo)
|
requires = collect_provider(ctx.attr.requires_any_of, FeatureConstraintInfo)
|
||||||
|
|
||||||
expand = None
|
nested = None
|
||||||
if ctx.attr.args:
|
if ctx.attr.args:
|
||||||
# TODO: This is temporary until cc_expand_args is implemented.
|
# TODO: This is temporary until cc_nested_args is implemented.
|
||||||
expand = ExpandArgsInfo(
|
nested = NestedArgsInfo(
|
||||||
label = ctx.label,
|
label = ctx.label,
|
||||||
expand = tuple(),
|
nested = tuple(),
|
||||||
iterate_over = None,
|
iterate_over = None,
|
||||||
files = files,
|
files = files,
|
||||||
requires_types = {},
|
requires_types = {},
|
||||||
|
@ -55,7 +55,7 @@ def _cc_args_impl(ctx):
|
||||||
label = ctx.label,
|
label = ctx.label,
|
||||||
actions = actions,
|
actions = actions,
|
||||||
requires_any_of = tuple(requires),
|
requires_any_of = tuple(requires),
|
||||||
expand = expand,
|
nested = nested,
|
||||||
env = ctx.attr.env,
|
env = ctx.attr.env,
|
||||||
files = files,
|
files = files,
|
||||||
)
|
)
|
||||||
|
|
|
@ -45,12 +45,12 @@ ActionTypeSetInfo = provider(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
ExpandArgsInfo = provider(
|
NestedArgsInfo = provider(
|
||||||
doc = "A provider representation of Args.add/add_all/add_joined parameters",
|
doc = "A provider representation of Args.add/add_all/add_joined parameters",
|
||||||
# @unsorted-dict-items
|
# @unsorted-dict-items
|
||||||
fields = {
|
fields = {
|
||||||
"label": "(Label) The label defining this provider. Place in error messages to simplify debugging",
|
"label": "(Label) The label defining this provider. Place in error messages to simplify debugging",
|
||||||
"expand": "(Sequence[ExpandArgsInfo]) The nested arg expansion. Mutually exclusive with args",
|
"nested": "(Sequence[NestedArgsInfo]) The nested arg expansion. Mutually exclusive with args",
|
||||||
"iterate_over": "(Optional[str]) The variable to iterate over",
|
"iterate_over": "(Optional[str]) The variable to iterate over",
|
||||||
"files": "(depset[File]) The files required to use this variable",
|
"files": "(depset[File]) The files required to use this variable",
|
||||||
"requires_types": "(dict[str, str]) A mapping from variables to their expected type name (not type). This means that we can require the generic type Option, rather than an Option[T]",
|
"requires_types": "(dict[str, str]) A mapping from variables to their expected type name (not type). This means that we can require the generic type Option, rather than an Option[T]",
|
||||||
|
@ -65,7 +65,7 @@ ArgsInfo = provider(
|
||||||
"label": "(Label) The label defining this provider. Place in error messages to simplify debugging",
|
"label": "(Label) The label defining this provider. Place in error messages to simplify debugging",
|
||||||
"actions": "(depset[ActionTypeInfo]) The set of actions this is associated with",
|
"actions": "(depset[ActionTypeInfo]) The set of actions this is associated with",
|
||||||
"requires_any_of": "(Sequence[FeatureConstraintInfo]) This will be enabled if any of the listed predicates are met. Equivalent to with_features",
|
"requires_any_of": "(Sequence[FeatureConstraintInfo]) This will be enabled if any of the listed predicates are met. Equivalent to with_features",
|
||||||
"expand": "(Optional[ExpandArgsInfo]) The args to expand. Equivalent to a flag group.",
|
"nested": "(Optional[NestedArgsInfo]) The args to expand. Equivalent to a flag group.",
|
||||||
"files": "(depset[File]) Files required for the args",
|
"files": "(depset[File]) Files required for the args",
|
||||||
"env": "(dict[str, str]) Environment variables to apply",
|
"env": "(dict[str, str]) Environment variables to apply",
|
||||||
},
|
},
|
||||||
|
|
|
@ -64,11 +64,11 @@ def convert_args(args):
|
||||||
]
|
]
|
||||||
|
|
||||||
flag_sets = []
|
flag_sets = []
|
||||||
if args.expand != None:
|
if args.nested != None:
|
||||||
flag_sets.append(legacy_flag_set(
|
flag_sets.append(legacy_flag_set(
|
||||||
actions = actions,
|
actions = actions,
|
||||||
with_features = with_features,
|
with_features = with_features,
|
||||||
flag_groups = [args.expand.legacy_flag_group],
|
flag_groups = [args.nested.legacy_flag_group],
|
||||||
))
|
))
|
||||||
|
|
||||||
env_sets = []
|
env_sets = []
|
||||||
|
|
|
@ -23,11 +23,11 @@ load(
|
||||||
"ActionTypeSetInfo",
|
"ActionTypeSetInfo",
|
||||||
"ArgsInfo",
|
"ArgsInfo",
|
||||||
"ArgsListInfo",
|
"ArgsListInfo",
|
||||||
"ExpandArgsInfo",
|
|
||||||
"FeatureConstraintInfo",
|
"FeatureConstraintInfo",
|
||||||
"FeatureInfo",
|
"FeatureInfo",
|
||||||
"FeatureSetInfo",
|
"FeatureSetInfo",
|
||||||
"MutuallyExclusiveCategoryInfo",
|
"MutuallyExclusiveCategoryInfo",
|
||||||
|
"NestedArgsInfo",
|
||||||
"ToolInfo",
|
"ToolInfo",
|
||||||
"ToolchainConfigInfo",
|
"ToolchainConfigInfo",
|
||||||
)
|
)
|
||||||
|
@ -106,8 +106,8 @@ _FeatureConstraintFactory = generate_factory(
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
_EXPAND_ARGS_FLAGS = dict(
|
_NESTED_ARGS_FLAGS = dict(
|
||||||
expand = None,
|
nested = None,
|
||||||
files = _subjects.depset_file,
|
files = _subjects.depset_file,
|
||||||
iterate_over = optional_subject(_subjects.str),
|
iterate_over = optional_subject(_subjects.str),
|
||||||
legacy_flag_group = unknown_subject,
|
legacy_flag_group = unknown_subject,
|
||||||
|
@ -115,18 +115,18 @@ _EXPAND_ARGS_FLAGS = dict(
|
||||||
)
|
)
|
||||||
|
|
||||||
# buildifier: disable=name-conventions
|
# buildifier: disable=name-conventions
|
||||||
_FakeExpandArgsFactory = generate_factory(
|
_FakeNestedArgsFactory = generate_factory(
|
||||||
ExpandArgsInfo,
|
NestedArgsInfo,
|
||||||
"ExpandArgsInfo",
|
"NestedArgsInfo",
|
||||||
_EXPAND_ARGS_FLAGS,
|
_NESTED_ARGS_FLAGS,
|
||||||
)
|
)
|
||||||
|
|
||||||
# buildifier: disable=name-conventions
|
# buildifier: disable=name-conventions
|
||||||
_ExpandArgsFactory = generate_factory(
|
_NestedArgsFactory = generate_factory(
|
||||||
ExpandArgsInfo,
|
NestedArgsInfo,
|
||||||
"ExpandArgsInfo",
|
"NestedArgsInfo",
|
||||||
_EXPAND_ARGS_FLAGS | dict(
|
_NESTED_ARGS_FLAGS | dict(
|
||||||
expand = ProviderSequence(_FakeExpandArgsFactory),
|
nested = ProviderSequence(_FakeNestedArgsFactory),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ _ArgsFactory = generate_factory(
|
||||||
env = _subjects.dict,
|
env = _subjects.dict,
|
||||||
files = _subjects.depset_file,
|
files = _subjects.depset_file,
|
||||||
# Use .factory so it's not inlined.
|
# Use .factory so it's not inlined.
|
||||||
expand = optional_subject(_ExpandArgsFactory.factory),
|
nested = optional_subject(_NestedArgsFactory.factory),
|
||||||
requires_any_of = ProviderSequence(_FeatureConstraintFactory),
|
requires_any_of = ProviderSequence(_FeatureConstraintFactory),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -220,7 +220,7 @@ _ToolchainConfigFactory = generate_factory(
|
||||||
FACTORIES = [
|
FACTORIES = [
|
||||||
_ActionTypeFactory,
|
_ActionTypeFactory,
|
||||||
_ActionTypeSetFactory,
|
_ActionTypeSetFactory,
|
||||||
_ExpandArgsFactory,
|
_NestedArgsFactory,
|
||||||
_ArgsFactory,
|
_ArgsFactory,
|
||||||
_ArgsListFactory,
|
_ArgsListFactory,
|
||||||
_MutuallyExclusiveCategoryFactory,
|
_MutuallyExclusiveCategoryFactory,
|
||||||
|
|
Loading…
Reference in New Issue