-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: Document gazelle integration (#6894)
- Loading branch information
Tomasz Pasternak
authored
Oct 15, 2024
1 parent
711519d
commit 3c0d903
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Using Gazelle to Keep BUILD Files Updated | ||
|
||
Gazelle can automatically generate and update your Bazel `BUILD` files based on the imports in your source code. To keep your `BUILD` files in sync without manual intervention, configure Gazelle to run before each sync operation. | ||
|
||
## Setup Instructions | ||
|
||
1. **Add `gazelle_target` to Your Project View File**: Include the `gazelle_target` attribute in your project view file to specify the Gazelle target to run. | ||
|
||
```yaml | ||
# Example project view file | ||
directories: | ||
src/ | ||
gazelle_target: //:gazelle | ||
``` | ||
2. **Automatic Execution**: With the `gazelle_target` set, Gazelle will run automatically before every sync, updating your `BUILD` files according to your source code imports. | ||
|
||
## Example Project | ||
|
||
For a practical example, see this [Gazelle project setup](https://github.com/bazelbuild/intellij/tree/master/examples/go/with_proto). | ||
|
||
## Demo | ||
|
||
https://github.com/user-attachments/assets/b130bf56-49ec-46cc-810f-c831672e2601 | ||
|