0

I have a configurable bazel build (ie, one with select statements) and I want a list of the used dependencies, not all of the dependencies.

For example, with the following for my BUILD:

config_setting(
   name = "arm",
   define_values = {
       "arm": "True",
   },
)
cc_binary(
    name = "main",
    srcs = ["main.C"] + select({
             "//:arm": ["ARM.C"],
             "//conditions:default": ["X86.C"],
}),

)

bazel query --noimplicit_deps deps(//:main) produces:

//:main
//:main.C
//:arm  
//:X86.C
//:ARM.C

What kind of query do I need to construct so that ARM.C is missing?

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
razeh
  • 2,725
  • 1
  • 20
  • 27

1 Answers1

3

Have you tried cquery? It's fairly new, and I think it would be able to accomplish what you're looking for :)

https://docs.bazel.build/versions/master/cquery.html

  • There's a blog post about it here: https://blog.bazel.build/2018/06/06/introducing-bazel-cquery.html – Jin Jun 11 '18 at 20:02