-
Notifications
You must be signed in to change notification settings - Fork 325
handling for debugging python test targets with transitions #7198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling for debugging python test targets with transitions #7198
Conversation
4735bbe
to
88f37b6
Compare
Note that an example project exhibiting the problem has been added to the issue. |
6fac996
to
65dc1de
Compare
Pushed to resolve a tree conflict. |
65dc1de
to
d119afd
Compare
d119afd
to
ac027d8
Compare
@@ -58,7 +60,7 @@ public Future<Collection<TargetInfo>> targetsForSourceFiles( | |||
if (projectData == null) { | |||
return Futures.immediateFuture(ImmutableList.of()); | |||
} | |||
ImmutableSet<TargetInfo> targets = | |||
List<TargetInfo> targets = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This collection should be immutable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is handled here in a new PR
@@ -85,11 +89,13 @@ public Future<Collection<TargetInfo>> targetsForSourceFiles( | |||
if (targetMap == null) { | |||
return Futures.immediateFuture(ImmutableList.of()); | |||
} | |||
ImmutableSet<TargetInfo> targets = | |||
List<TargetInfo> targets = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be immutable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is handled here in a new PR.
A prior pr bazelbuild#7198 introduced some stream handling. It was later pointed out that the collection of the stream should be immutable; this PR will fix that.
"_java_grpc_library", "_kotlin_library", "_java_lite_grpc_library", "_iml_module_", | ||
"cc_library", "cc_binary", "cc_shared_library", "cc_test", "proto_library", "py_library", | ||
"py_binary", "py_test") | ||
.flatMap(k -> Stream.of(k, "_transition_" + k)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This is a regex, right? I think "(_transition_)?(" + kindsExpression + ")"
matches the same cases without doubling back tracking cost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @anguslees ; I experimented with this and although my testing method is rough, there does seem to be a very small improvement with the approach you are suggesting over a large project. I do get the same results either way. I will try come back to this and swap the implementation out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See here for a PR covering this suggestion. Thanks; that is much more elegant in any case.
A prior pr bazelbuild#7198 introduced ability for Bazel queries to handle Rules that have transitions applied to them. This change introduced a modified Bazel query used in the plugin. This commit will optimize the query so it is more compact and performs slightly better.
A prior pr bazelbuild#7198 introduced ability for Bazel queries to handle Rules that have transitions applied to them. This change introduced a modified Bazel query used in the plugin. This commit will optimize the query so it is more compact and performs slightly better.
A prior pr bazelbuild#7198 introduced ability for Bazel queries to handle Rules that have transitions applied to them. This change introduced a modified Bazel query used in the plugin. This commit will optimize the query so it is more compact and performs slightly better.
A prior pr bazelbuild#7198 introduced ability for Bazel queries to handle Rules that have transitions applied to them. This change introduced a modified Bazel query used in the plugin. This commit will optimize the query so it is more compact and performs slightly better.
A prior pr bazelbuild#7198 introduced ability for Bazel queries to handle Rules that have transitions applied to them. This change introduced a modified Bazel query used in the plugin. This commit will optimize the query so it is more compact and performs slightly better.
A prior pr #7198 introduced ability for Bazel queries to handle Rules that have transitions applied to them. This change introduced a modified Bazel query used in the plugin. This commit will optimize the query so it is more compact and performs slightly better.
Checklist
Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See
the Contributions section in the README for more
details.
Discussion thread for this change
Issue number: 7196
Description of this change
_transition_
prefix as being the Kind with with_transition_
prefix stripped._
prefix.rules_python
PyInfo
provider to be considered with Bazel < 8. I am unsure of all the wider ramifications of this so it may require some discussion. I think internal Bazel rules were dropped on Bazel 5 so perhaps it is a reasonable assumption that the user would be usingrules_python
if they are using Python at all?