-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Header inclusion checking in src/hdrs for cc_library is broken #17055
Comments
If you include
This works even better then the docs mention. While they say "For example, Bazel would not complain if in the example above foo.cc directly includes baz.h.", if you try that, you get this error:
|
Hmm, so in the example, you gave above, it's pretty clear that this feature is working (with the layering check feature enabled). Perhaps, it's just a documentation error and the docs should just mention the layering_check feature? |
I submitted #17057 to improve the documentation of this feature. |
The `layering_check` feature and toolchain support are required to realize header dependency checking in Bazel. If enabled, this also reports errors for explicitly included transitive, non-direct headers. Fixes #17055 Fixes #15632 Closes #17057. PiperOrigin-RevId: 499189567 Change-Id: Ia7978193e4572a358e26d24183d125649f8654b9
Description of the bug:
Header inclusion checking seems to be broken. In the documentation for cc_library, it mentions that adding header files to the
srcs
attribute should make them private to dependent targets. However, this is not the case.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a skeleton repository based on the example in the Bazel documentation;
Try and include
bar-impl.h
fromfoo.cc
. According to the documentation, this should produce an error, however, it does not and instead builds successfully.Which operating system are you running Bazel on?
Ubuntu 20.04 (WSL)
What is the output of
bazel info release
?5.4.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
#14346
#7030
#3828
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: