Documentation
¶
Index ¶
- type Dependency
- type Generator
- type Module
- type PackageDescriptor
- type PackageDescriptorV1
- func (proj *PackageDescriptorV1) BuildOptions(cfg config.Config) (protoc.CompileOptions, error)
- func (proj *PackageDescriptorV1) Cleanup(cfg config.Config) error
- func (proj *PackageDescriptorV1) CreateOutputDirectories() error
- func (proj *PackageDescriptorV1) Prepare(cfg config.Config) error
- func (proj *PackageDescriptorV1) SetPath(path string)
- func (proj *PackageDescriptorV1) Update(cfg config.Config) error
- type Project
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct {
Name string `yaml:"name"`
Repository string `yaml:"repository"`
Ref string `yaml:"ref"`
}
Dependency represents an external protocol buffer dependency that can be fetched from a Git repository at a specific reference (branch, tag, or commit).
type Generator ¶
type Generator struct {
Name string `yaml:"name"`
Out string `yaml:"out"`
Options []string `yaml:"opt"`
}
Generator defines a protoc code generator configuration including its name, output directory, and generation options.
type Module ¶
type Module struct {
Path string `yaml:"path"`
}
Module represents a directory containing .proto files within a project.
type PackageDescriptor ¶ added in v0.3.0
type PackageDescriptor interface {
SetPath(path string)
Update(cfg config.Config) error
Prepare(cfg config.Config) error
BuildOptions(cfg config.Config) (protoc.CompileOptions, error)
Cleanup(cfg config.Config) error
CreateOutputDirectories() error
}
PackageDescriptor defines the interface for different package descriptor versions. It provides methods for managing package lifecycle including dependency updates, preparation, building, and cleanup operations.
type PackageDescriptorV1 ¶ added in v0.3.0
type PackageDescriptorV1 struct {
// Path is the path of the project descriptor file
Path string
// Modules lists the project's directories that contains .proto files
Modules []Module `yaml:"modules"`
// Depends lists the dependencies
Depends []Dependency `yaml:"depends"`
// Generators defines the generators to use with protoc
Generators []Generator `yaml:"generators"`
// contains filtered or unexported fields
}
PackageDescriptorV1 implements version 1 of the protox project format. It manages modules, dependencies, protoc version, and code generators.
func (*PackageDescriptorV1) BuildOptions ¶ added in v0.3.0
func (proj *PackageDescriptorV1) BuildOptions(cfg config.Config) (protoc.CompileOptions, error)
BuildOptions implements the new structured options approach
func (*PackageDescriptorV1) Cleanup ¶ added in v0.3.0
func (proj *PackageDescriptorV1) Cleanup(cfg config.Config) error
Cleanup removes all installed dependencies, generators, and protoc for this project.
func (*PackageDescriptorV1) CreateOutputDirectories ¶ added in v0.3.0
func (proj *PackageDescriptorV1) CreateOutputDirectories() error
CreateOutputDirectories creates all output directories specified in generators
func (*PackageDescriptorV1) Prepare ¶ added in v0.3.0
func (proj *PackageDescriptorV1) Prepare(cfg config.Config) error
Prepare ensures all required tools (protoc and generators) are available in PATH for the build process.
func (*PackageDescriptorV1) SetPath ¶ added in v0.3.0
func (proj *PackageDescriptorV1) SetPath(path string)
SetPath sets the project descriptor file path and initializes the tool manager.
type Project ¶
type Project struct {
Version int `yaml:"version"`
Descriptor PackageDescriptor
}
Project represents a protox project configuration with version-specific implementation. It acts as a wrapper that delegates operations to the appropriate version implementation.
func Open ¶
Open reads and parses a protox project configuration file from the current directory. It looks for protox.yaml or protox.yml files and returns a Project instance.
func (Project) Build ¶ added in v0.2.0
Build compiles the project's protocol buffer files using protoc. It prepares dependencies, creates output directories, and executes protoc with the configured generators.
func (Project) Cleanup ¶ added in v0.2.0
Cleanup removes all installed dependencies and tools for the project.
func (*Project) UnmarshalYAML ¶
UnmarshalYAML implements custom YAML unmarshaling for Project. It determines the project version and creates the appropriate implementation.