Back to

Package bufmod

Latest Go to latest

The latest major version is .

Published: Jul 24, 2020 | License: Apache-2.0 | Module:


type BucketBuilder

type BucketBuilder interface {
	// BuildForBucket builds a module for the given bucket.
	// If paths is empty, all files are built.
	// Paths should be relative to the bucket, not the roots.
		ctx context.Context,
		readBucket storage.ReadBucket,
		config *Config,
		options ...BuildOption,
	) (bufcore.Module, error)

BucketBuilder builds modules for buckets.

func NewBucketBuilder

func NewBucketBuilder(logger *zap.Logger) BucketBuilder

NewBucketBuilder returns a new BucketBuilder.

type BuildOption

type BuildOption func(*buildOptions)

BuildOption is an option for BuildForBucket.

func WithPaths

func WithPaths(paths ...string) BuildOption

WithPaths returns a new BuildOption that specifies specific file paths to build.

These paths must exist. These paths must be relative to the bucket or include directory paths. These paths will be normalized. Multiple calls to this option will override previous calls.

func WithPathsAllowNotExistOnWalk

func WithPathsAllowNotExistOnWalk() BuildOption

WithPathsAllowNotExistOnWalk returns a BuildOption that says that the bucket relative paths specified with WithPaths may not exist on module TargetFileInfos calls.

GetFileInfo and GetFile will still operate as normal.

type Config

type Config struct {
	// RootToExcludes contains a map from root to the excludes for that root.
	// Roots are the root directories within a bucket to search for Protobuf files.
	// There will be no between the roots, ie foo/bar and foo are not allowed.
	// All Protobuf files must be unique relative to the roots, ie if foo and bar
	// are roots, then foo/baz.proto and bar/baz.proto are not allowed.
	// All roots will be normalized and validated.
	// Excludes are the directories within a bucket to exclude.
	// There should be no overlap between the excludes, ie foo/bar and foo are not allowed.
	// All excludes must reside within a root, but none will be equal to a root.
	// All excludes will be normalized and validated.
	// The excludes in this map will be relative to the root they map to!
	// If RootToExcludes is empty, the default is "." with no excludes.
	RootToExcludes map[string][]string

Config is a configuration for build.

func NewConfig

func NewConfig(externalConfig ExternalConfig) (*Config, error)

NewConfig returns a new, validated Config for the ExternalConfig.

func (*Config) Roots

func (c *Config) Roots() []string

Roots returns the Roots.

type ExternalConfig

type ExternalConfig struct {
	Roots    []string `json:"roots,omitempty" yaml:"roots,omitempty"`
	Excludes []string `json:"excludes,omitempty" yaml:"excludes,omitempty"`

ExternalConfig is an external config.

type IncludeBuilder

type IncludeBuilder interface {
	// BuildForIncludes builds a module for the given includes and file paths.
		ctx context.Context,
		includeDirPaths []string,
		options ...BuildOption,
	) (bufcore.Module, error)

IncludeBuilder builds modules for includes.

This is used for protoc.

func NewIncludeBuilder

func NewIncludeBuilder(logger *zap.Logger) IncludeBuilder

NewIncludeBuilder returns a new IncludeBuilder.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier