Learn how to use Bazel query to explore and visualize dependency graphs, analyze package relationships, identify and troubleshoot dependencies, make informed refactoring decisions, and optimize build performance in your Bazel-managed codebase. The guide provides practical examples, detailed explanations of various Bazel query functions, and tips for combining queries to gather powerful insights.

13m read timeFrom buildkite.com
Post cover image
Table of contents
Bazel query by example: a hypothetical Go monorepoThe basic query: Understanding your workspaceExploring dependencies with deps()Identifying dependents with rdeps()Visualizing dependency pathsTailoring queries by filtering on target typeCombining queries for powerful insightsBeyond the basics with cquery and aqueryPractical scenarios in Go developmentUnderstanding Bazel's build phasesWrapping up, and next steps

Sort: