-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Add support for layering_check
#246
Conversation
@jsharpe I saw that you were interested in this feature, any kind of testing would be highly appreciated. |
8ce1411
to
b1a44e4
Compare
b1a44e4
to
200fe6d
Compare
6e9188c
to
455bf61
Compare
The general support for this feature is inherited from the Bazel-provided Unix C++ toolchain, except that a module map for the toolchain and sysroot headers has to be supplied to the `cc_toolchain`. Requires an update of abseil-cpp to make it compatible with `layering_check`.
455bf61
to
c09b634
Compare
c09b634
to
212a84c
Compare
Yep; I'll try this in the next few days hopefully! |
3bbfb69
to
ce87a8b
Compare
44e689f
to
63680cc
Compare
`/tmp` is hermetic by default in Bazel 7.
@jsharpe The remaining failure appears to be unrelated to the changes in this PR. Have you tested Edit: I looked into this. With |
@siddharthab After quite a bit of trial and error, this is ready for review now. Let me know if you want me to move the unrelated CI fixes required due to the Bazel 7 release out into a separate PR. |
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.
Overall looks good. Let me know if you have the bandwidth to do the changes I have suggested. If not, maybe I can push to your branch. I am going to give some time to the repo this weekend.
Also, thank you so much for working through the nits from Bazel 7 upgrade, and maybe other causes.
/*) ;; | ||
*) header=${EXECROOT_PREFIX}"${header}" ;; | ||
esac | ||
echo " textual header \"${header}\"" |
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.
Did you really want to echo this line under all cases, i.e. even under the /*
case?
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.
Yes, added a comment.
doc = """Generates a Clang module map for the toolchain and sysroot headers.""", | ||
implementation = _system_module_map, | ||
attrs = { | ||
"toolchain": attr.label(mandatory = True), |
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 seems to me that it will be better if we renamed this cxx_builtin_include_filegroup
or something like that, instead of calling it toolchain
. It makes the code easier to read.
Likewise, we should create a separate filegroup
target to pass here instead of all-files
.
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 renamed the attribute (I chose a files
suffix as it wouldn't strictly have to be a filegroup
) and introduced a separate filegroup
.
Co-authored-by: Siddhartha Bagaria <[email protected]>
/*) ;; | ||
*) header=${EXECROOT_PREFIX}"${header}" ;; | ||
esac | ||
echo " textual header \"${header}\"" |
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.
Yes, added a comment.
doc = """Generates a Clang module map for the toolchain and sysroot headers.""", | ||
implementation = _system_module_map, | ||
attrs = { | ||
"toolchain": attr.label(mandatory = True), |
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 renamed the attribute (I chose a files
suffix as it wouldn't strictly have to be a filegroup
) and introduced a separate filegroup
.
a9e88cf
to
bb38ddf
Compare
toolchain/internal/configure.bzl
Outdated
system_module_map( | ||
name = "module-{suffix}", | ||
cxx_builtin_include_files = ":include-components-{suffix}", | ||
cxx_builtin_include_directories = cxx_builtin_include_directories, |
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.
@siddharthab Nvm, this is problematic: The builtin include directories are computed in the cc_toolchain_config
rule and not available here. I could either extract this into a separate function and pass the result into cc_toolchain_config
or have cc_toolchain_config
return the information via a provider. That's why I went for the macro in the first place. Maybe you see a better way to pass around this information.
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.
Yes, I was thinking that we would compute it outside of the macro (i.e. the BUILD file should already have that info) and pass it in.
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.
Done
d980a59
to
92662c5
Compare
I tried to use your |
Thank you for all the hard work. This looks very good. I might do some very minor cleanup for nitpicks later. Let's merge this! |
The general support for this feature is inherited from the Bazel-provided Unix C++ toolchain, except that a module map for the toolchain and sysroot headers has to be supplied to the
cc_toolchain
.This requires updates of rules_go, abseil-cpp and openssl BUILD file changes to become compatible with the stricter checks. Also fixes CI issues caused by the release of Bazel 7.0.0.
Fixes #203