Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.aspect.build/llms.txt

Use this file to discover all available pages before exploring further.

Automating and verifying BUILD file generation is a key part of Bazel development. Tools like Gazelle and Aspect Workflows help developers keep BUILD files up-to-date and consistent with project source code.

Automated BUILD file management with Gazelle

Managing BUILD files in Bazel is essential. You must add these files to the source code repository and they must accurately reflect the project’s source code. Maintaining these files manually can be tedious and error-prone. For instance, import statements in the code must match the entries in the deps attribute of *_library targets. This concept explains how Gazelle and its integration with Aspect Workflows handle this maintenance.

What’s Gazelle?

Gazelle is a widely used tool for generating and updating BUILD files automatically.
  • Initially popular for Go projects.
  • Now supports many other languages.
  • Using Gazelle ensures BUILD files stay consistent with your source code.

Integration with Aspect Workflows

Aspect Workflows automates BUILD file generation and verification using Gazelle. To keep BUILD files current, use the gazelle task in the Workflows configuration.
Before enabling this task, configure Gazelle in your repository. This usually involves adding two targets to your root BUILD file, as described in the Gazelle README.