bazel-gazelle icon indicating copy to clipboard operation
bazel-gazelle copied to clipboard

Using gazelle in custom repository_rule

Open dieend opened this issue 2 years ago • 0 comments

I wanted to create a repository_rule similar to go_repository, where after the rule implementation fetches the external repository, it'll call gazelle with the provided custom plugin and configured lang macro.

It seems we use vanilla gazelle here[1], which is built using go_repository_tools [2]. Is it possible to incorporate a custom gazelle plugin for this gazelle binary? Maybe using some plugin architecture? So we provide another go binary that can the main gazelle can talk with to provide the extended function.

[1] https://github.com/bazelbuild/bazel-gazelle/blob/32dab97bac88b1a35653d33a034b38e55d757983/internal/go_repository.bzl#L139 [2] https://github.com/bazelbuild/bazel-gazelle/blob/c9484cc1da9af07cc69ac3e32eb1c8708d27a989/internal/go_repository_tools.bzl#L140-L143

What version of gazelle are you using?

0.26

What version of rules_go are you using?

v0.34.0

What version of Bazel are you using?

5.2.0

Does this issue reproduce with the latest releases of all the above?

What operating system and processor architecture are you using?

darwin arm/aarch64 - m1

What did you do?

Creating a repository_rule that follow go_repository rules, where it run gazelle after downloading external repository to generate BUILD files. The repository is not go repository, but other languages

What did you expect to see?

The external repo contains correct BUILD files

What did you see instead?

It's not generating correct BUILD files

dieend avatar Sep 08 '22 18:09 dieend