Automatic BUILD generation
In most languages, BUILD files can be automatically created and updated by running this command:
srcscontains all files in the current package with the typical file extension.depscan be determined by looking at all theimportstatements in thesrcsand mapping them to labels which provide that symbol.- tests can be separated out by a file convention
The 200-series courses discuss how to modify or extend the conventions, either using Gazelle’s Go API, or using the same “Starlark” language as Bazel rules and macros.
Manual BUILD Authoring.
In some cases, there’s no BUILD generator for your language, or it doesn’t include the feature you need for configuration. In this case, you will edit BUILD files on your own.
- Look around the repo for examples.
- Ask your DevInfra team to provide more documentation, or write the missing
BUILDgenerator. - Consider using Macros to reduce the boilerplate you have to type.
- Use
#keepto avoid the BUILD generator changing your code.

