erenon / bazel_clang_tidy

Run clang-tidy on Bazel C++ targets directly, efficiently, with caching enabled
MIT License
109 stars 58 forks source link

Doesn't work with --experimental_cc_implementation_deps #30

Open HappyCerberus opened 2 years ago

HappyCerberus commented 2 years ago

It seems that the implementation dependencies are not included in the compilation context, so clang-tidy doesn't see the headers.

I tried to debug this problem, but I actually have no idea where bazel puts the implementation dependencies since they are not in the sandbox directory.

jelle282 commented 1 year ago

FYI ran into the same issue, one suggestion I got to my question on the bazel slack channel was to walk the implementation_deps manually, which seems to work. It was by design that the compilation context only returns public properties.

Unsure whether manually combining all the depset propererties of the target's compilation context, as well as the implementation_dep's compilation contexts, is a general solution, but it seems to work in our case.

zpzjzj commented 1 year ago
  1. I overcome this by adding implementation compilation_contexts https://github.com/zpzjzj/bazel_clang_tidy/commit/867182a4683a4357b940498ef4d544738d34b5cc
  2. Bazel 6.0.0 may fix this, I did not tested yet : https://github.com/bazelbuild/bazel/issues/14731
dotnwat commented 1 month ago

also hitting this and interested in a solution. @zpzjzj would your solution make sense to push up as a PR?