selects.bzl: Add config_setting_group for config_setting AND/OR-chaining#89
selects.bzl: Add config_setting_group for config_setting AND/OR-chaining#89c-parsons merged 8 commits intobazelbuild:masterfrom
Conversation
|
CC'ing @serynth who reviewed the proposal. |
|
Given that this function covers functionality in Bazel that I'm not intimately familiar with and @c-parsons has already discussed parts of the design with you (and because he's the owner of Skylib now), I prefer to defer to him on the review. |
Oh, my bad. Hello new owner! |
|
@c-parsons - given the state of bazelbuild/bazel#6237, do you think I can start integrating this with that now? |
|
If by "integrating this with that" you mean: testing your Pull Request using the analysis-testing framework proposed in that issue? If so, yes! Please do! |
|
Is there something preventing this to be merged ? Thanks! |
|
See the previous two comments. @c-parsons was writing some Starlark testing infrastructure that this change needed to get proper testing. That wasn't ready at first but now it is. So that's what I need to integrate. I want to tackle this in O(weeks) but it's not something I'll practically be able to have done tomorrow. |
|
No worries, I'm running off the patch from the PR. Thanks for the clarification! |
|
Update: I'm revisiting this PR. @c-parsons - I added a bunch of tests. It was fun using the new analysis-aware infrastructure. I would have liked to hide each test behind a single call, but that doesn't seem possible. It would also be nice to have test suite support. I have two commented out tests which require checking that a macro Otherwise, PTAL. |
|
@gregestren FYI, i've had some issues when ANDing with |
|
Happy to test that. Can you share an example?
…On Wed, May 29, 2019 at 6:11 AM Steeve Morin ***@***.***> wrote:
@gregestren <https://github.com/gregestren> FYI, i've had some issues
when ANDing with config_setting that had constraint_values where bazel
would fail. It seems it had to do with the alias.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=ABHEQ7RYROUI54F63756FR3PXZJETA5CNFSM4GM5NW3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWO3JGA#issuecomment-496874648>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABHEQ7TBNCPA4ZYMEEHRKPDPXZJETANCNFSM4GM5NW3A>
.
|
|
I seems it has to do with AND'ing on a platform and a config_setting: native.config_setting(
name = "something",
define_values = {
"something": "1",
},
visibility = ["//visibility:public"],
)
selects.config_setting_group(
name = "mymegarule",
match_all = [
"@io_bazel_rules_go//go/toolchain:android_arm64",
":something",
],
)It fails with: |
|
Oddly enough, if I invert the match_all, then it works |
|
All tests on bazel 0.25.3, for the record |
c-parsons
left a comment
There was a problem hiding this comment.
@c-parsons - I added a bunch of tests. It was fun using the new analysis-aware infrastructure. I would have liked to hide each test behind a single call, but that doesn't seem possible. It would also be nice to have test suite support.
I'm glad to hear it!
What are you looking for in test suite support? It looks like you somewhat do this by having all targets created under
Is it that you'd like to be able to test specifically your whole "suite" given a single target?
If so, I'll give it some thought :) Thanks for the feedback!
I have two commented out tests which require checking that a macro fail()s. Is there any way to test that?
If there's a failure during loading phase, unfortunately not. We can test rules failing (see https://docs.bazel.build/versions/master/skylark/testing.html#failure-testing). analysistest is mostly designed for rule implementation tests; macro tests are a whole other ballgame.
| _config_setting_and_group(name, match_all) | ||
|
|
||
| def _check_duplicates(settings): | ||
| """ Fails if any entry in settings appears more than once. |
There was a problem hiding this comment.
nit: Any reason we can't just have this be a single line? (And remove the extra space at the beginning of string?
(same for other docstrings of private functions in this file)
|
|
||
| The core idea is to create a sequential chain of alias targets where each is | ||
| select-resolved as follows: If alias n matches config_setting n, the chain | ||
| is true so it resolves to config_setting n. Else it resolves to alias n+1 |
So it's a TODO to be able to put You can fix that in the interim by putting your As for inverting the order, an |
Yes, exactly. I just see a huge explosion of the number of tests at the top level so I imagine at some point of scale that could be a problem. No major issue as things stand now though. |
| name_off = name + "_stamp_binary_off_check" | ||
| native.config_setting( | ||
| name = name_on, | ||
| values = {"stamp": True}, |
There was a problem hiding this comment.
When I try to manually create such a rule, Bazel complains
expected value of type 'string' for dict value element, but got True (bool)
so it seems like this is not valid. Is it possible this function is not being exercised?
There was a problem hiding this comment.
You're absolutely right. That's a bug and I didn't add coverage for //conditions:default.
Implements https://github.com/bazelbuild/proposals/blob/master/designs/2018-11-09-config-setting-chaining.md.
I started adding tests, but I don't think the current testing infrastructure is powerful enough for this feature. @c-parsons suggests using the upcoming improved In-Build Starlark Testing as an inaugural user. That feature's destined for the next Bazel release. Progress trackable at bazelbuild/bazel#6237.
So now I'm just seeding the review. Should merging be hard-blocked on the above considerations?