github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/pkg/protoc/language_rule.go (about)

     1  package protoc
     2  
     3  import "github.com/bazelbuild/bazel-gazelle/rule"
     4  
     5  // LanguageRule is capable of taking a compilation and deriving another rule
     6  // based on it.  For example, a java_proto_library LanguageRule implementation
     7  // might collect all the emitted *.srcjar files from the protoc configuration
     8  // and wrap it with a java_library.
     9  type LanguageRule interface {
    10  	// Name returns the name of the rule
    11  	Name() string
    12  	// LoadInfo returns the gazelle LoadInfo.
    13  	LoadInfo() rule.LoadInfo
    14  	// KindInfo returns the gazelle KindInfo.
    15  	KindInfo() rule.KindInfo
    16  	// ProvideRule takes the given configration and compilation and emits a
    17  	// RuleProvider.  If the state of the ProtocConfiguration is such that the
    18  	// rule should not be emitted, implementation should return nil.
    19  	ProvideRule(rc *LanguageRuleConfig, pc *ProtocConfiguration) RuleProvider
    20  }