bazel-compile-commands-extractor icon indicating copy to clipboard operation
bazel-compile-commands-extractor copied to clipboard

Can't exclude headers - probably user error

Open PSmithsonp4 opened this issue 1 year ago • 0 comments

Hi,

I doubt this is a bug. I'm very new to Bazel and have probably done something wrong.

I've got a "hello world" project with just one source file - main.cc. I edited MODULE.bazel as per the instructions and now I get a compile_commands.json when I do bazel run @hedron_compile_commands//:refresh_all. I'd like that file to only contain "main.cc" but there's 178 header files. I'm trying to use exclude_headers but I must have done something wrong. This is my BUILD file -

load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")

refresh_compile_commands(
    name = "refresh_compile_commands",
    exclude_headers = "all",
)

cc_binary(
	name = "main",
	srcs = ["main.cc"],
)

I do bazel run @hedron_compile_commands//:refresh_all again. I still have 179 files in the compile_commands.json so I've obviously done something wrong. The instructions recommend adding //BUILD but I don't know what that means exactly or if I needed to do it.

Thanks

PSmithsonp4 avatar Oct 03 '24 12:10 PSmithsonp4