protoc

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(opts CompileOptions) error

Exec executes protoc with structured options and mode selection

func ExecWithArgs added in v0.3.0

func ExecWithArgs(args []string, toolManager tools.ToolManager) error

ExecWithArgs executes protoc with raw arguments using pure-go implementation

func WriteGeneratedFiles added in v0.3.0

func WriteGeneratedFiles(resp *pluginpb.CodeGeneratorResponse, outputDir string) error

WriteGeneratedFiles writes the generated files from a CodeGeneratorResponse to disk

Types

type CompileOptions added in v0.3.0

type CompileOptions struct {
	ProtoFiles  []string          // Input .proto files
	ProtoPaths  []string          // --proto_path equivalent
	Generators  []GeneratorConfig // Generator configurations
	ToolManager tools.ToolManager // The tool manager for generator execution
}

CompileOptions represents structured compilation options

type Compiler added in v0.3.0

type Compiler struct {
	// contains filtered or unexported fields
}

Compiler wraps protocompile.Compiler to provide pure-Go protobuf compilation

func NewCompiler added in v0.3.0

func NewCompiler(importPaths []string) *Compiler

NewCompiler creates a new Compiler instance with the given import paths

func (*Compiler) Compile added in v0.3.0

func (c *Compiler) Compile(ctx context.Context, protoFiles []string) ([]*descriptorpb.FileDescriptorProto, error)

Compile compiles the given proto files and returns their descriptors along with all dependencies

type Generator added in v0.3.0

type Generator struct {
	// contains filtered or unexported fields
}

Generator handles execution of protoc plugins for code generation

func NewGenerator added in v0.3.0

func NewGenerator(toolManager tools.ToolManager) *Generator

NewGenerator creates a new Generator instance with the given ToolManager

func (*Generator) Execute added in v0.3.0

Execute executes a generator plugin with the given request

func (*Generator) ExecuteGenerators added in v0.3.0

func (g *Generator) ExecuteGenerators(generators []GeneratorConfig, descriptors []*descriptorpb.FileDescriptorProto, protoFiles []string) error

ExecuteGenerators executes multiple generators with the same request

type GeneratorConfig added in v0.3.0

type GeneratorConfig struct {
	Name    string   // Generator name (e.g., "go", "grpc")
	Out     string   // --<generator>_out equivalent
	Options []string // --<generator>_opt equivalent
}

GeneratorConfig represents a single generator configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL