Bazel Query Deep Dive: From Basics to Advanced Use Cases
summary
Shows concrete commands and gotchas: uses Envoy and a tiny Scala repo to demo --noimplicit_deps to shrink a deps result from ~900 labels, extracts transitive JVM classpath via starlark output, and finds generated targets by filtering the generator_function attribute. Covers aquery action filtering to locate the exact generator of a header and reports counts with the summary output (example: ~1,200 C++ compile actions for a test). Recommends --keep_going, machine‑friendly outputs, query files, and using aspects for single‑run extraction.
AI-written summary · about
chapters (15)
- 0:00Bazel Query basics
- 1:53Target pattern queries
- 5:26Filtering by kind and attributes
- 10:09Set operations and variables
- 11:56Transitive dependencies with deps
- 13:20Visualizing Dependency Graphs
- 14:21Filtering generated files
- 15:03Reverse dependencies with rdeps
- 16:25Configured query (C query)
- 17:30Starlark output mode
- 19:16Action graph queries (A query)
- 20:45Filtering actions by type
- 21:29Finding header generators
- 23:18Query tips and formats
- 25:05Performance and scalability
related talks
31mBazel: Do We Really Need Another Build Tool?
57mVariant analysis
06mLightning Talk: Do You Love or Hate Your C++ Build System?
29mExploring Scala Tooling ecosystem
49mJava's Hidden Gems: Tools and Libraries
09mLightning Talk – Bazel UI
23mPolyglot Builds with Bazel
31mTaming the Beast - Better Bazel in IntelliJ
