Questions tagged [bazel-query]

Bazel supports different kinds of queries: `query`, `cquery` and `aquery`. All questions releated to Bazel queries should be tagged with this tag.

14 questions
3
votes
2 answers

Running bazel query without downloading external dependencies

Given a rather big repository built with bazel and tons of third party dependencies in multiple languages (including heavy docker containers), I have the following problem: running Bazel queries triggers the downloading of many of these…
Shastick
  • 1,218
  • 1
  • 12
  • 29
2
votes
1 answer

How to query repository rule in bazel?

I'm trying to translate my company's project from legacy build tool to bazel. Now I'm facing this problem and searched a lot, but unfortunately, I haven't had a clue so far. Here's the thing: For compliance with open source audit, we must provide a…
Chen Zhuo
  • 71
  • 5
1
vote
1 answer

Write manifest file without building the target

When running aquery on a target, I can see two actions being performed by bazel: bazel aquery '//bazel_test/a:foo' action 'Writing file bazel_test/a/foo.manifest' Mnemonic: FileWrite Target: //bazel_test/a:foo Configuration: k8-fastbuild …
Victor
  • 13
  • 2
1
vote
1 answer

Exclude @npm// Dependencies from Bazel Dependency Graph (bazel query)

I use the following commands to generate a graph for my Bazel project. bazel query 'deps(//services/gateway:lib)' --output graph --nohost_deps --noimplicit_deps > graph.in dot -Tpng < graph.in > graph.png The following graph is generated: digraph…
Florian Ludewig
  • 4,338
  • 11
  • 71
  • 137
0
votes
1 answer

How do I query for targets visible from a specific targets?

Bazel uses the concept of visibility to limit which targets can depend on which targets. Given a target //my:foo, I am looking for a way to query Bazel for a list of targets visible to //my:foo. Basically, I am trying to figure out which targets in…
Gunnar
  • 2,264
  • 17
  • 31
0
votes
1 answer

Query for Java toolchain details in Bazel

I'd like to use bazel query to get more details about the Java toolchain. Specifically Java source level to be used. From the java_library target I was able to query for the Java toolchain: rule_input:…
Gunnar
  • 2,264
  • 17
  • 31
0
votes
1 answer

How do I query only for the dependencies declared under deps in the BUILD file?

How do I query only for the dependencies declared under deps? For example, given the given target java_library( name = "my-library", srcs = glob(["src/main/java/**/*.java"]), deps = [ ":some-target", …
ugabade
  • 23
  • 4
0
votes
1 answer

How can I query the attribute of a rule in Bazel?

If I have cc_binary( name = "stooges", srcs = [ "larry.cc", "curly.cc", "moe.cc" ], ) Is there a Bazel query which will return "larry.cc", "curly.cc", "moe.cc" ? At the moment the only thing I can think of is $ bazel query --output=build…
Bulletmagnet
  • 5,665
  • 2
  • 26
  • 56
0
votes
1 answer

How to pass a bash variable to a "bazel 'set' query"

I have the following set of files that I want to pass into Bazel using res=$(git diff --name-only ${COMMIT_HASH}^! | grep '^src/' | uniq | cut -d/ -f2-) # echo $res # services/service-a/README.md # services/service-a/main.go # ... bazel query…
Arash Outadi
  • 446
  • 7
  • 16
0
votes
1 answer

Use `bazel query` inside a build file

I am using Bazel with Golang, but the question is no Go-specific. I have a common go directory structure: cmd/ ├── mycommand/ │ ├── BUILD.bazel │ ├── main.go │ └── somefolder │ └── other.go ├── othercommand/ │ ├── BUILD.bazel │ └──…
vbence
  • 20,084
  • 9
  • 69
  • 118
0
votes
1 answer

Bazel query on every kind but source files, ie inverted kind search

I was running a bazel deps query with an output configured as --output label_kind and found a ton of source file hits. Is there a mechanism for excluding source files from the results, some kind of inverse search retaining every kind but the source…
jxramos
  • 7,356
  • 6
  • 57
  • 105
0
votes
1 answer

How to pass custom flags in a `bazel query` command?

I try to query deps with a custom flags. For example, bazel query --define=using_cuda=true "deps(@org_tensorflow//tensorflow/core:lib)" Bazel complained: ERROR: Unrecognized option: --define=using_cuda=true How could I pass a custom flag to bazel…
highfly22
  • 1,691
  • 2
  • 10
  • 11
0
votes
1 answer

Bazel query that doesn't follow all select branches

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 = { …
razeh
  • 2,725
  • 1
  • 20
  • 27