Open mpatou opened 5 months ago
I would like to discuss this a bit more as I'm thinking about trying to do something.
I had a look at how language/go
handle protobuf and I think this could be extended to support other generator.
My current train of thought is that you would pass a configuration to gazelle
that would map a given type of generator to the macro to call to to the generation:
{
"counterfeiter": {
"macro": "go_generate_counterfeiter",
"macro_path": "@//bazel:generator.bzl"
},
"cue": {
"macro": "go_generate_cue",
"macro_path": "@//bazel:generator.bzl",
"package": "github.com/company/repo/go/cluster"
...
}
Package name would be either inferred from the package where the code with the comment is contained or if specified in the configuration it would use the one specified.
What version of gazelle are you using?
0.35
What version of rules_go are you using?
0.46
What version of Bazel are you using?
6.5
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
x86-64
What did you do?
We are using
counterfeiter
to generate mocks structs for our unit tests. Currentlygazelle
do parse anygenerate
comment so we have to generate the file manually and then rungazelle
What did you expect to see?
gazelle
generates the targets to call the generator and then references those targets in other targets that use the modules.What did you see instead?
gazelle
does nothing.