erenon / bazel_clang_tidy

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

Errors in the last commit #3

Closed slsyy closed 3 years ago

slsyy commented 3 years ago

The last commit https://github.com/erenon/bazel_clang_tidy/commit/c0d0793ccf65ff80920b31f3b60a04eb5fd43372 introduce changes, which I do not understand:

- '_clang_tidy': attr.label(default = Label('//clang_tidy:clang_tidy')),
+ '_clang_tidy': attr.label(default = Label('//clangtidy:clang_tidy')),

Change in the label, I guess it is an error, because path in the repo has not changed

- cc_toolchain = find_cpp_toolchain(ctx)
+ cc_toolchain = ctx.toolchains['@bazel_tools//tools/cpp:toolchain_type']

The new code complain about expected CcToolchainInfo vs got ToolchainInfo. I have tested it on Bazel 3.4.1 and 4.0.0 and the result is the same. Revert to old find_cpp_toolchain fixed the issue

erenon commented 3 years ago

Thanks for reporting! Fix attempt here: https://github.com/erenon/bazel_clang_tidy/pull/4 It seems to use the cpp toolchain explicitly requires additional incompatible flags.

slsyy commented 3 years ago

Thank you