Skip to content

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

Conversation

andponlin-canva
Copy link
Contributor

Checklist

  • I have filed an issue about this change and discussed potential changes with the maintainers.
  • I have received the approval from the maintainers to make this change.
  • This is not a stylistic, refactoring, or cleanup change.

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

  • The change will recognize Kinds with a _transition_ prefix as being the Kind with with _transition_ prefix stripped.
  • The selection of the Target to map to from a source file will avoid, where possible, any with a _ prefix.
  • The Python templated aspect logic will allow the 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 using rules_python if they are using Python at all?

@andponlin-canva
Copy link
Contributor Author

Note that an example project exhibiting the problem has been added to the issue.

@jastice jastice requested a review from sellophane January 21, 2025 23:29
@andponlin-canva andponlin-canva force-pushed the handle-transition-py-rules-on-debugger branch from 6fac996 to 65dc1de Compare January 29, 2025 00:59
@andponlin-canva
Copy link
Contributor Author

Pushed to resolve a tree conflict.

@andponlin-canva andponlin-canva force-pushed the handle-transition-py-rules-on-debugger branch from 65dc1de to d119afd Compare February 11, 2025 19:43
@sellophane sellophane force-pushed the handle-transition-py-rules-on-debugger branch from d119afd to ac027d8 Compare February 12, 2025 10:04
@sellophane sellophane merged commit 3b1963d into bazelbuild:master Feb 12, 2025
5 checks passed
@github-actions github-actions bot removed the awaiting-review Awaiting review from Bazel team on PRs label Feb 12, 2025
@@ -58,7 +60,7 @@ public Future<Collection<TargetInfo>> targetsForSourceFiles(
if (projectData == null) {
return Futures.immediateFuture(ImmutableList.of());
}
ImmutableSet<TargetInfo> targets =
List<TargetInfo> targets =
Copy link
Collaborator

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.

Copy link
Contributor Author

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 =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be immutable

Copy link
Contributor Author

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.

odisseus added a commit to VirtuslabRnD/intellij that referenced this pull request Feb 12, 2025
odisseus added a commit to VirtuslabRnD/intellij that referenced this pull request Feb 12, 2025
andponlin-canva added a commit to andponlin-canva/bazelbuild_intellij that referenced this pull request Feb 12, 2025
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))
Copy link

@anguslees anguslees Feb 12, 2025

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

andponlin-canva added a commit to andponlin-canva/bazelbuild_intellij that referenced this pull request Feb 14, 2025
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.
LeFrosch pushed a commit that referenced this pull request Feb 14, 2025
sellophane pushed a commit to andponlin-canva/bazelbuild_intellij that referenced this pull request Feb 21, 2025
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.
andponlin-canva added a commit to andponlin-canva/bazelbuild_intellij that referenced this pull request Feb 24, 2025
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.
sellophane pushed a commit to andponlin-canva/bazelbuild_intellij that referenced this pull request Feb 25, 2025
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.
sellophane pushed a commit to andponlin-canva/bazelbuild_intellij that referenced this pull request Feb 25, 2025
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.
sellophane pushed a commit that referenced this pull request Feb 25, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin
Projects
Development

Successfully merging this pull request may close these issues.

6 participants