erenon / bazel_clang_tidy

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

Error: 'OutputGroupInfo' value has no field or method 'report' #2

Closed devjgm closed 3 years ago

devjgm commented 3 years ago

I'm trying to get this aspect working with my project https://github.com/googleapis/google-cloud-cpp, but I'm getting the following error:

ERROR: /workspace/google/cloud/storage/BUILD:36:17: in //clang_tidy:clang_tidy.bzl%clang_tidy_aspect aspect on cc_proto_library rule //google/cloud/storage:google_cloud_cpp_storage_internal_grpc_resumable_session_url_cc_proto:
Traceback (most recent call last):
        File "/workspace/google/cloud/storage/BUILD", line 36, column 17, in //clang_tidy:clang_tidy.bzl%clang_tidy_aspect
                cc_proto_library(
        File "/workspace/clang_tidy/clang_tidy.bzl", line 97, column 29, in _clang_tidy_aspect_impl
                dep[OutputGroupInfo].report
Error: 'OutputGroupInfo' value has no field or method 'report'
Available attributes: _hidden_top_level_INTERNAL_, temp_files_INTERNAL_
ERROR: Analysis of aspect '//clang_tidy:clang_tidy.bzl%clang_tidy_aspect of //google/cloud/storage:google_cloud_cpp_storage_internal_grpc_resumable_session_url_cc_proto' failed; build aborted: Analysis of target '//google/cloud/storage:google_cloud_cpp_storage_internal_grpc_resumable_session_url_cc_proto' failed
INFO: Elapsed time: 3.980s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (3 packages loaded, 5341 targets configured)

I'm using:

   kernel: #1 SMP Debian 5.7.17-1rodete5 (2021-01-08)
       os: PRETTY_NAME="Fedora 33 (Container Image)"
    clang: clang version 11.0.0 (Fedora 11.0.0-2.fc33)
    bazel: bazel 3.5.0

Steps to reproduce:

  1. Clone my repo (sorry, this can be a bit slow)

    git clone https://github.com/googleapis/google-cloud-cpp
    cd google-cloud-cpp
  2. Clone your repo, and follow your install steps.

    git clone https://github.com/erenon/bazel_clang_tidy
    mv bazel_clang_tidy/clang_tidy .
    rm -rf bazel_clang_tidy
    cat >>BUILD <<EOF
    filegroup(
    name = 'clang_tidy_config',
    data = [
    '.clang-tidy',
    ],
    visibility = ['//visibility:public'],
    )
    EOF
  3. Run my build using the command you show here.

    bazel build //... --aspects clang_tidy/clang_tidy.bzl%clang_tidy_aspect --output_groups=report

ERROR: This is where I get the error shown above.

erenon commented 3 years ago

Hi, thanks for the detailed report. I pushed a change that should fix the issue - by making a few things simpler, while also potentially increasing the required bazel version - I could only test with bazel 4.0 atm.

devjgm commented 3 years ago

Sorry for the slow reply. I haven't verified the fix yet, but thank you for the quick response and the fix. Much appreciated.

erenon commented 3 years ago

No problem. Please reopen if the issue persists.