bufmodulebuild

package
v0.0.0-...-26f4575 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildModuleFileSetOption

type BuildModuleFileSetOption func(*buildModuleFileSetOptions)

BuildModuleFileSetOption is an option for Build.

func WithWorkspace

func WithWorkspace(workspace bufmodule.Workspace) BuildModuleFileSetOption

WithWorkspace returns a new BuildModuleFileSetOption that specifies a workspace.

type BuildOption

type BuildOption func(*buildOptions)

BuildOption is an option for BuildForBucket.

func WithExcludePaths

func WithExcludePaths(excludePaths []string) BuildOption

WithExcludePaths returns a new BuildOption that specifies files to be excluded from the build.

func WithExcludePathsAllowNotExist

func WithExcludePathsAllowNotExist(excludePaths []string) BuildOption

WithExcludePathsAllowNotExist returns a new BuildOption that specifies files to be excluded from the build, but allows the specified paths to not exist.

func WithModuleIdentity

func WithModuleIdentity(moduleIdentity bufmoduleref.ModuleIdentity) BuildOption

WithModuleIdentity returns a new BuildOption that is used to construct a Module with a ModuleIdentity.

TODO: this is never called TODO: we also have ModuleWithModuleIdentityAndCommit in bufmodule We need to disambiguate module building between bufmodule and bufmodulebuild bufimage and bufimagebuild work, but bufmodule and bufmodulebuild are a mess

func WithPaths

func WithPaths(paths []string) BuildOption

WithPaths returns a new BuildOption that specifies specific file or directory 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 and WithPathsAllowNotExist will override previous calls.

This results in ModuleWithTargetPaths being used on the resulting build module. This is done within bufmodulebuild so we can resolve the paths relative to their roots.

func WithPathsAllowNotExist

func WithPathsAllowNotExist(paths []string) BuildOption

WithPathsAllowNotExist returns a new BuildOption that specifies specific file or directory paths to build, but allows the specified paths to not exist.

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 and WithPaths will override previous calls.

This results in ModuleWithPathsAllowNotExist being used on the resulting build module. This is done within bufmodulebuild so we can resolve the paths relative to their roots.

type BuiltModule

type BuiltModule struct {
	bufmodule.Module
	Bucket storage.ReadBucket
}

BuiltModule ties a bufmodule.Module with the configuration and a bucket containing just the files required to build it.

func BuildForBucket

func BuildForBucket(
	ctx context.Context,
	readBucket storage.ReadBucket,
	config *bufmoduleconfig.Config,
	options ...BuildOption,
) (*BuiltModule, error)

BuildForBucket is an alternative constructor of NewModuleBucketBuilder followed by calling the BuildForBucket method.

type ModuleBucketBuilder

type ModuleBucketBuilder = *moduleBucketBuilder

ModuleBucketBuilder builds modules for buckets.

func NewModuleBucketBuilder

func NewModuleBucketBuilder(
	options ...BuildOption,
) ModuleBucketBuilder

NewModuleBucketBuilder returns a new BucketBuilder.

type ModuleFileSetBuilder

type ModuleFileSetBuilder interface {
	Build(
		ctx context.Context,
		module bufmodule.Module,
		options ...BuildModuleFileSetOption,
	) (bufmodule.ModuleFileSet, error)
}

ModuleFileSetBuilder builds ModuleFileSets from Modules.

func NewModuleFileSetBuilder

func NewModuleFileSetBuilder(
	logger *zap.Logger,
	moduleReader bufmodule.ModuleReader,
) ModuleFileSetBuilder

NewModuleFileSetBuilder returns a new ModuleSetProvider.

type ModuleIncludeBuilder

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

ModuleIncludeBuilder builds modules for includes.

This is used for protoc.

func NewModuleIncludeBuilder

func NewModuleIncludeBuilder(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
) ModuleIncludeBuilder

NewModuleIncludeBuilder returns a new ModuleIncludeBuilder.

TODO: we should parse includeDirPaths for modules as well in theory would be nice to be able to do buf alpha protoc -I path/to/dir -I buf.build/foo/bar/v1

Jump to

Keyboard shortcuts

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