-
-
Notifications
You must be signed in to change notification settings - Fork 638
Closed
Labels
Good first issueA good first issue for people looking to contributeA good first issue for people looking to contribute
Description
Followup from #2458
The general design would be to create our own no_match_rule which could be instantiated as follows:
def compatible_settings(settings):
"""Return a list of strings"""
ret = []
for setting in settings:
ret += select({setting: [setting], "//conditions:default": []})
return ret
no_match(
name = "no_match",
compatible_settings = compatible_settings(ALL_SETTINGS),
# The flags that we use for selecting the wheels
python_version = "@rules_python//python/config_settings:python_version",
...
)The impl of the rule could be as simple as:
def _impl(ctx):
flags = {
name: getattr(ctx.attr, name)[Provider].value
for name in ALL_FLAG_NAMES
}
msg = _TEMPLATE.format(
compatible_settings = render.indent("\n".join(ctx.attr.compatible_settings))
flags = render.indent("\n".join(flags))
)
fail(msg)And it is wired inside the pkg_aliases rule by doing:
actual = {
"//conditions:default": "//_config:no_match"
}This would trigger the _impl rule implementation above and it would fail building the target.
Definition of done:
- We can see compatible config settings with the current configuration.
- We can see the flag values of the current configuration.
- If we do
bazel build //_config/..., the build should not fail. Add abuild_testin the//tests/pypi/integration. - We have an analysis test that checks the failure and (bonus points) checks that the error message is templated with the correct compatible settings. Add an analysis test in
//tests/pypi/pkg_aliases.
Part of #260.
Metadata
Metadata
Assignees
Labels
Good first issueA good first issue for people looking to contributeA good first issue for people looking to contribute