bufbuild

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOption added in v0.14.0

type BuildOption func(*buildOptions)

BuildOption is an option for Build.

func WithExcludeSourceCodeInfo added in v0.14.0

func WithExcludeSourceCodeInfo() BuildOption

WithExcludeSourceCodeInfo returns a BuildOption that excludes sourceCodeInfo.

type Builder added in v0.14.0

type Builder interface {
	// Build runs compilation.
	//
	// The FileRefs are assumed to have been created by a FileRefProvider, that is
	// they are unique relative to the roots.
	//
	// If an error is returned, it is a system error.
	// Only one of Image and FileAnnotations will be returned.
	//
	// FileAnnotations will use external file paths.
	Build(
		ctx context.Context,
		readBucket storage.ReadBucket,
		externalPathResolver bufpath.ExternalPathResolver,
		fileRefs []bufimage.FileRef,
		options ...BuildOption,
	) (bufimage.Image, []bufanalysis.FileAnnotation, error)
}

Builder builds Protobuf files into Images.

func NewBuilder added in v0.14.0

func NewBuilder(logger *zap.Logger, options ...BuilderOption) Builder

NewBuilder returns a new Builder.

type BuilderOption added in v0.14.0

type BuilderOption func(*builder)

BuilderOption is an option for a new Builder.

type ExternalConfig added in v0.17.0

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 FileRefProvider added in v0.14.0

type FileRefProvider interface {
	// GetAllFileRefs gets all the FileRefs for the bucket.
	//
	// Roots are the root directories within a bucket to search for Protobuf files.
	// If roots is empty, the default is ["."].
	//
	// There should be no overlap 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 must be relative.
	// 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 willbe equal to a root.
	// All excludes must be relative.
	// All excludes will be normalized and validated.
	//
	// FileRefs will be unique by root relative file path.
	// FileRefs will be sorted by root relative file path.
	GetAllFileRefs(
		ctx context.Context,
		readBucket storage.ReadBucket,
		externalPathResolver bufpath.ExternalPathResolver,
		roots []string,
		excludes []string,
	) ([]bufimage.FileRef, error)
	// GetFileRefsForExternalFilePaths gets the FileRefs for the specific files within the bucket.
	//
	// The externalFilePaths will be resolved to file paths relative to the bucket via the PathResolver.
	//
	// Roots are the root directories within a bucket to search for Protobuf files.
	// If roots is empty, the default is ["."].
	//
	// There should be no overlap 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 must be relative.
	// All roots will be normalized and validated.
	//
	// FileRefs will be unique by root relative file path.
	// FileRefs will be sorted by root relative file path.
	GetFileRefsForExternalFilePaths(
		ctx context.Context,
		readBucket storage.ReadBucket,
		pathResolver bufpath.PathResolver,
		roots []string,
		externalFilePaths []string,
		options ...GetFileRefsForExternalFilePathsOption,
	) ([]bufimage.FileRef, error)
}

FileRefProvider provides bufimage.FileRefs.

func NewFileRefProvider added in v0.14.0

func NewFileRefProvider(logger *zap.Logger) FileRefProvider

NewFileRefProvider returns a new FileRefProvider.

type GetFileRefsForExternalFilePathsOption added in v0.14.0

type GetFileRefsForExternalFilePathsOption func(*getFileRefsForExternalFilePathsOptions)

GetFileRefsForExternalFilePathsOption is an option for GetFileRefsForExternalFilePaths.

func WithAllowNotExist added in v0.14.0

func WithAllowNotExist() GetFileRefsForExternalFilePathsOption

WithAllowNotExist says that a given external file path may not exist without error.

Jump to

Keyboard shortcuts

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