Skip to content

Latest commit

 

History

History
83 lines (52 loc) · 1.94 KB

File metadata and controls

83 lines (52 loc) · 1.94 KB

Bazel

This mono-repo is configured to build and test with Bazel. Please install bazelisk as it is the recommended way to honor the repo's .bazelversion pin.

The repository currently pins Bazel to 9.0.0 via .bazelversion.

This project now prefers direct Bazel dependencies on canonical package targets (for example //go/pkg/...) rather than compatibility alias shims.

To build all targets with Bazel, run:

    bazel build //...

To build only a specific target and its dependencies, run:

    bazel build //cmd/... 

To test all targets with Bazel, run:

    bazel test //...

To test only a specific target group, run:

    bazel test //cmd/...

To query all available tests to find, for example, all agent tests, run:

    bazel query "kind('go_test', //...)" | grep agent_test 

To run the located test targets:

    bazel test //go/pkg/agent:agent_test

To explore all dependencies of a specific target, run:

    bazel query "deps(//go/pkg/agent:agent)"

To find all reverse dependencies, i.e. packages that depends on a specific crate, run:

    bazel query "rdeps(//..., //go/pkg/agent:agent, 1)"

If you were to refactor the dcl_data_structures crate, the rdepds tell you upfront were its used and thus helps you to estimate upfront the blast radius of braking changes.

To query available vendored external dependencies with Bazel, run:

    bazel query "kind('go_library', //third_party/...)"

Note, these vendored external dependencies are shared across all crates.

To visualize all dependencies of the top level binary agent, run

   bazel query 'deps(//go/cmd/agent, 3) ' --output graph --noimplicit_deps  | dot -Tpng -o graph.png
   
   open graph.png # Works on Mac. 

References:

https://bazel.build/query/guide

https://buildkite.com/resources/blog/a-guide-to-bazel-query/