Versions in this module Expand all Collapse all v4 v4.2.0 Dec 22, 2025 Changes in this version + const LanguageDirective + const PluginDirective + const ProtoLibraryKey + const ResolveProvidesKey + const ResolverImpLangPrivateKey + const ResolverLangName + const RuleDirective + const UnresolvedDepsPrivateKey + var ErrNoLabel = errors.New("no label") + var ErrUnknownPlugin = errors.New("unknown plugin") + var ErrUnknownRule = errors.New("unknown rule") + func Always(file *File) bool + func DeduplicateAndSort(in []string) (out []string) + func FlatMapFiles(apply func(file *File) []string, filter func(file *File) bool, files ...*File) []string + func ForIntent(in map[string]bool, want bool) []string + func GetKeptFileRuleAttrString(file *rule.File, r *rule.Rule, name string) string + func GetNamedOption(options []proto.Option, name string) (string, bool) + func GetPluginLabels(plugins []*PluginConfiguration) []string + func GetPluginOptions(plugins []*PluginConfiguration, r *rule.Rule, from label.Label) map[string][]string + func GetPluginOuts(plugins []*PluginConfiguration) map[string]string + func GoPackageOption(options []proto.Option) (string, string, bool) + func GoPackagePath(pkg string) string + func HasMessageOrEnum(file *File) bool + func HasMessagesOrEnums(files ...*File) bool + func HasService(file *File) bool + func HasServices(files ...*File) bool + func ImportPrefixRelativeFileNameWithExtensions(stripImportPrefix, reldir string, exts ...string) func(f *File) []string + func IsProtoFile(filename string) bool + func LoadYConfigFile(c *config.Config, cfg *PackageConfig, filename string) error + func MakeStringDict(in map[string]string) build.Expr + func MakeStringListDict(in map[string][]string) build.Expr + func PackageFileNameWithExtensions(exts ...string) func(f *File) []string + func ProtoFilesImportSpecsForKind(kind string, files []*File) []resolve.ImportSpec + func ProtoLibraryImportSpecsForKind(kind string, libs ...ProtoLibrary) []resolve.ImportSpec + func RegisterStarlarkPlugin(c *config.Config, starlarkPlugin string) error + func RegisterStarlarkRule(c *config.Config, starlarkRule string) error + func RelativeFileNameWithExtensions(reldir string, exts ...string) func(f *File) []string + func ResolveFileRewrites(rewrites []Rewrite, file *File) []string + func ResolveImports(resolver ImportResolver, lang, impLang string, imports []string) []label.Label + func ResolveImportsString(resolver ImportResolver, rel, kind, impLang string, imports []string) []string + func ResolveLibraryRewrites(rewrites []Rewrite, library ProtoLibrary) []string + func ResolveRewrites(rewrites []Rewrite, in string) string + func StripRel(rel string, filename string) string + func ToPascalCase(s string) string + type DepsResolver func(c *config.Config, ix *resolve.RuleIndex, r *rule.Rule, imports []string, ...) + func ResolveDepsAttr(attrName string, excludeWkt bool) DepsResolver + type File struct + Basename string + Dir string + Name string + func NewFile(dir, basename string) *File + func (f *File) EnumOptions() []proto.Option + func (f *File) Enums() []proto.Enum + func (f *File) HasEnumOption(name string) bool + func (f *File) HasEnums() bool + func (f *File) HasMessages() bool + func (f *File) HasRPCOption(name string) bool + func (f *File) HasRPCs() bool + func (f *File) HasServices() bool + func (f *File) Imports() []proto.Import + func (f *File) Messages() []proto.Message + func (f *File) Options() []proto.Option + func (f *File) Package() proto.Package + func (f *File) Parse() error + func (f *File) ParseReader(in io.Reader) error + func (f *File) Relname() string + func (f *File) Services() []proto.Service + type FileVisitor interface + VisitFile func(*rule.File) *rule.File + type ImportCrossResolver interface + Install func(c *config.Config) + LoadFile func(filename string) error + SaveFile func(filename, repoName string) error + func GlobalResolver() ImportCrossResolver + type ImportProvider interface + Provided func(lang, impLang string) map[label.Label][]string + type ImportResolver interface + Imports func(lang, impLang string, visitor func(imp string, location []label.Label) bool) + Provide func(lang string, impLang, imp string, location label.Label) + Resolve func(lang, impLang, imp string) []resolve.FindResult + func NewImportResolver(options *ImportResolverOptions) ImportResolver + type ImportResolverOptions struct + Debug bool + Printf func(format string, args ...any) + type LanguageConfig struct + Enabled bool + Name string + Plugins map[string]bool + Protoc string + Rules map[string]bool + func (c *LanguageConfig) GetRulesByIntent(intent bool) []string + type LanguagePluginConfig struct + Deps map[string]bool + Enabled bool + Flags map[string]bool + Implementation string + Label label.Label + Name string + Options map[string]bool + func (c *LanguagePluginConfig) GetDeps() []string + func (c *LanguagePluginConfig) GetFlags() []string + func (c *LanguagePluginConfig) GetOptions() []string + type LanguageRule interface + KindInfo func() rule.KindInfo + LoadInfo func() rule.LoadInfo + Name func() string + ProvideRule func(rc *LanguageRuleConfig, pc *ProtocConfiguration) RuleProvider + func LoadStarlarkLanguageRuleFromFile(workDir, filename, name string, reporter func(msg string), ...) (LanguageRule, error) + type LanguageRuleConfig struct + Attrs map[string]map[string]bool + Config *config.Config + Deps map[string]bool + Enabled bool + Impl LanguageRule + Implementation string + Name string + Options map[string]bool + Resolves []Rewrite + Visibility map[string]bool + func NewLanguageRuleConfig(config *config.Config, name string) *LanguageRuleConfig + func (c *LanguageRuleConfig) GetAttr(name string) []string + func (c *LanguageRuleConfig) GetAttrNames() []string + func (c *LanguageRuleConfig) GetDeps() []string + func (c *LanguageRuleConfig) GetOptions() []string + func (c *LanguageRuleConfig) GetRewrites() []Rewrite + func (c *LanguageRuleConfig) GetVisibility() []string + type OtherProtoLibrary struct + func NewOtherProtoLibrary(source *rule.File, rule *rule.Rule, files ...*File) *OtherProtoLibrary + func (s *OtherProtoLibrary) BaseName() string + func (s *OtherProtoLibrary) Deps() []string + func (s *OtherProtoLibrary) Files() []*File + func (s *OtherProtoLibrary) Imports() []string + func (s *OtherProtoLibrary) Name() string + func (s *OtherProtoLibrary) Rule() *rule.Rule + func (s *OtherProtoLibrary) Srcs() []string + func (s *OtherProtoLibrary) StripImportPrefix() string + type Package struct + func NewPackage(rel string, cfg *PackageConfig, libs ...ProtoLibrary) *Package + func (s *Package) Empty() []*rule.Rule + func (s *Package) RuleProvider(r *rule.Rule) RuleProvider + func (s *Package) Rules() []*rule.Rule + type PackageConfig struct + Config *config.Config + func GetPackageConfig(config *config.Config) *PackageConfig + func NewPackageConfig(config *config.Config) *PackageConfig + func (c *PackageConfig) Clone() *PackageConfig + func (c *PackageConfig) LoadYConfig(y *YConfig) error + func (c *PackageConfig) ParseDirectives(rel string, directives []rule.Directive) (err error) + func (c *PackageConfig) Plugin(name string) (LanguagePluginConfig, bool) + type Plugin interface + Configure func(ctx *PluginContext) *PluginConfiguration + Name func() string + func LoadStarlarkPluginFromFile(workDir, filename, name string, reporter func(msg string), ...) (Plugin, error) + type PluginConfiguration struct + Config *LanguagePluginConfig + Label label.Label + Mappings map[string]string + Options []string + Out string + Outputs []string + Plugin Plugin + type PluginContext struct + PackageConfig PackageConfig + Plugin Plugin + PluginConfig LanguagePluginConfig + ProtoLibrary ProtoLibrary + Rel string + type PluginOptionsResolver interface + ResolvePluginOptions func(ctx *PluginConfiguration, r *rule.Rule, from label.Label) []string + type PluginRegistry interface + LookupPlugin func(name string) (Plugin, error) + MustRegisterPlugin func(plugin Plugin) PluginRegistry + PluginNames func() []string + RegisterPlugin func(name string, plugin Plugin) PluginRegistry + func Plugins() PluginRegistry + type ProtoLibrary interface + BaseName func() string + Deps func() []string + Files func() []*File + Imports func() []string + Name func() string + Rule func() *rule.Rule + Srcs func() []string + StripImportPrefix func() string + type ProtocConfiguration struct + Imports []string + LanguageConfig *LanguageConfig + Library ProtoLibrary + Mappings map[string]string + Outputs []string + PackageConfig *PackageConfig + Plugins []*PluginConfiguration + Prefix string + Rel string + func (c *ProtocConfiguration) GetPluginConfiguration(implementationName string) *PluginConfiguration + func (c *ProtocConfiguration) GetPluginOutputs(implementationName string) []string + type Rewrite struct + Match *regexp.Regexp + Replace string + func ParseRewrite(spec string) (*Rewrite, error) + func (r *Rewrite) ReplaceAll(src string) string + type RuleIndex interface + Get func(label.Label) *rule.Rule + Put func(label.Label, *rule.Rule) + func GlobalRuleIndex() RuleIndex + type RuleProvider interface + Imports func(c *config.Config, r *rule.Rule, file *rule.File) []resolve.ImportSpec + Kind func() string + Name func() string + Resolve func(c *config.Config, ix *resolve.RuleIndex, r *rule.Rule, imports []string, ...) + Rule func(othergen ...*rule.Rule) *rule.Rule + type RuleRegistry interface + LookupRule func(name string) (LanguageRule, error) + MustRegisterRule func(name string, rule LanguageRule) RuleRegistry + RuleNames func() []string + func Rules() RuleRegistry + type Symbol string + func (s Symbol) Freeze() + func (s Symbol) GoString() string + func (s Symbol) Hash() (uint32, error) + func (s Symbol) Index(i int) starlark.Value + func (s Symbol) Len() int + func (s Symbol) String() string + func (s Symbol) Truth() starlark.Bool + func (s Symbol) Type() string + type YConfig struct + Language []*YLanguage + Plugin []*YPlugin + Rule []*YRule + StarlarkPlugin []string + StarlarkRule []string + func ParseYConfigFile(filename string) (*YConfig, error) + type YLanguage struct + Enabled *bool + Implementation string + Name string + Plugin []string + Rule []string + type YPlugin struct + Dep []string + Enabled *bool + Flag []string + Implementation string + Label string + Name string + Option []string + type YRule struct + Deps []string + Enabled *bool + Implementation string + Name string + Option []string + Resolves []string + Visibility []string