Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildOption ¶
type BuildOption func(*buildOptions)
BuildOption is an option for Build.
func WithExcludeSourceCodeInfo ¶
func WithExcludeSourceCodeInfo() BuildOption
WithExcludeSourceCodeInfo returns a BuildOption that excludes sourceCodeInfo.
func WithExpectedDirectDependencies ¶ added in v1.22.0
func WithExpectedDirectDependencies(expectedDirectDependencies []bufmoduleref.ModuleReference) BuildOption
WithExpectedDirectDependencies sets the module dependencies that are expected, usually because they are in a configuration file (buf.yaml). If the build detects that there are direct dependencies outside of this list, a warning will be printed.
func WithWorkspace ¶ added in v1.22.0
func WithWorkspace(workspace bufmodule.Workspace) BuildOption
WithWorkspace sets the workspace to be read from instead of ModuleReader, and to not warn imports for.
TODO: this can probably be dealt with by finding out if an ImageFile has a commit or not, although that is hacky, that's an implementation detail in practice, but perhaps we could justify it - transitive dependencies without commits don't make sense?
TODO: shouldn't buf.yamls in workspaces have deps properly declared in them anyways? Why not warn?
type Builder ¶
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,
module bufmodule.Module,
options ...BuildOption,
) (bufimage.Image, []bufanalysis.FileAnnotation, error)
}
Builder builds Protobuf files into Images.
func NewBuilder ¶
func NewBuilder(logger *zap.Logger, moduleReader bufmodule.ModuleReader) Builder
NewBuilder returns a new Builder.