-
Notifications
You must be signed in to change notification settings - Fork 4
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
only filters labels according to parent packages for LanguageClass.C #47
Conversation
This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
.getTargetsToBuildForSourceFile(file).stream(); | ||
|
||
LanguageClass fileLanguage = LanguageClass.fromExtension(FileUtilRt.getExtension(file.getName()).toLowerCase()); | ||
final Stream<Label> maybeFilteredLabels = (fileLanguage == LanguageClass.C) ? |
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.
It would be a great improvement if the name (or more names) communicate what's going on here:
- filter is applicable only for C
- what that filter does for that language
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.
I thought about extracting a private method to express intent but that is not the style of the code. OTOH if we're not going to upstream it then maybe it's not such a big deal.
Regarding what it does for that language- honestly I'm not sure it's easy for me to explain this in a comment let alone in a short name. Maybe a private method with a long comment with roughly the above quoted info?
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.
If you plan to contribute to upstream, then most likely they will inline your methods. I would prefer using at least better name for vars. If this is not enough, please comment.
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.
please review now
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.
What triggered my attention in the first place was name maybeFilteredLabels
. Maybe it makes sense to inline it now?
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.
I inlined it. Not sure I like it that much because it makes me see even more how much I miss partial application :)
In any case please review
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.
Do you still need .filter(l -> l.blazePackage().equals(packagePath))
after the call to filterCRelatedLabelsWhichBelongToOtherPackages
?
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.
Of course not, I’m an ass :) thanks!
Removed
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.
refactoring without tests is not a good idea :)
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.
:) we're good?
LGTM |
@ZachiNachshon @liucijus my original dilemmas were about adding this in and adding it with/without test. |
You are correct about adding at least a basic test to cover this feature so we could catch any possible future issues around it. If it's not possible at the moment, lets add it to our backlog and I'll add it. |
I’ll do it in a separate PR since I want minimum noise here (hoping upstream will consider taking it) |
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
…47) * only filters labels according to parent packages for LanguageClass.C This is to keep supporting CPP need while also supporting aggregate targets More info: https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600 Filter was deliberately added to fix an issue with C++ headers. The original bug was that opening the BUILD file for foo/bar.h caused it to open baz/qux/BUILD because there’s a cc_library target in baz/qux that includes foo/bar.h in its headers. The source-to-target look up queries the index for the target during the last sync which compiled the source file. In this case, it was the cc_library target in baz/qux. So the fix was to ensure that the BUILD file is always for the parent package (foo/bar)
This is to keep supporting CPP need while also supporting aggregate targets
More info:
https://bazelbuild.slack.com/archives/CM8JQCANN/p1566481600003600
OTOH what we have with aggregate targets is that
Open Corresponding BUILD File
action,Copy BUILD Target String
, and some custom dependency lookups don't work (for AutoDep we copied part of the implementation offindBuildTarget
to work around it).Example for aggregate target:
findBuildTarget
at all let alone for the CPP fix. This made me question whether I want to dive into it. My current stand is to add it as is but I also considered covering existing behavior first. Problem is that it's likely a significant investment on this change and they might fix it differently at the end (see slack https://bazelbuild.slack.com/archives/CM8JQCANN/p1566576477000600?thread_ts=1566481600.003600&cid=CM8JQCANN https://bazelbuild.slack.com/archives/CM8JQCANN/p1566576507000800?thread_ts=1566481600.003600&cid=CM8JQCANN). Reason I'm not doing the suggested fix there is that it's much more complicated without fully diving into the code atSourceToTargetMapImpl
(which I haven't done).@ZachiNachshon @liucijus would appreciate your thoughts (more on the issues mentioned above than the really small code change)