github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/pkg/language/protobuf/lang.go (about) 1 package protobuf 2 3 import ( 4 "github.com/stackb/rules_proto/pkg/protoc" 5 ) 6 7 // NewProtobufLang create a new protobufLang Gazelle extension implementation. 8 func NewProtobufLang(name string) *protobufLang { 9 return &protobufLang{ 10 name: name, 11 rules: protoc.Rules(), 12 packages: make(map[string]*protoc.Package), 13 resolver: protoc.GlobalResolver(), 14 } 15 } 16 17 // protobufLang implements language.Language. 18 type protobufLang struct { 19 // name of the extension 20 name string 21 // the rule registry 22 rules protoc.RuleRegistry 23 // the packages that we've generated 24 packages map[string]*protoc.Package 25 // configFiles contains yconfig yaml files to parse. May be comma-separated. 26 configFiles string 27 // repoName is the name (if this an external repository) 28 repoName string 29 // importsOutFile is the name of the file to create. If "", skip writing 30 // the file. 31 importsOutFile string 32 // importsInFiles is a comma-separated list of files that contains proto 33 // index csv content. 34 importsInFiles string 35 // reresolveKnownProtoImports performs an additional resolve step for go_googleapis deps 36 reresolveKnownProtoImports bool 37 // the resolver instance used for cross-resolution 38 resolver protoc.ImportResolver 39 // starlarkRules stores custom starlark proto rule names in the form filename%rulename 40 starlarkRules arrayFlags 41 // starlarkPlugins stores custom starlark proto plugin names in the form filename%pluginname 42 starlarkPlugins arrayFlags 43 } 44 45 // Name implements part of the language.Language interface. 46 func (pl *protobufLang) Name() string { return pl.name }