file

package
v0.0.0-...-472ff39 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileNoNameSpace string = ""

Functions

func GetImplicitOutputs

func GetImplicitOutputs(m Provider) []string

Commonly used filter to get module implicit outputs

func GetInstallableOutputs

func GetInstallableOutputs(m Provider) []string

Commonly used filter to get module installable files

func GetOutputs

func GetOutputs(m Provider) []string

Commonly used filter to get module output files

func ResolveFilesMutator

func ResolveFilesMutator(ctx blueprint.BottomUpMutatorContext)

TransformSources needs to figure out the output names based on it's inputs. Since this cannot be done at `OutSrcs` time due to lack of module context we use a seperate mutator stage.

Types

type Consumer

type Consumer interface {

	// Returns all sources this module consumes. At this point assumes all providers are ready.
	// Paths will be fully resolved.
	GetFiles(blueprint.BaseModuleContext) Paths

	// Returns a list of targets this consumer directly requires
	GetTargets() []string

	// Returns filepaths for current module only.
	// Context is required for backend information but the accessor should only read current module.
	GetDirectFiles() Paths
}

`Consumer` interface describes a module that is capable of consuming sources for its actions. Example of this include:

  • bob_binary
  • bob{_static_,_shared_,_}library

This interface can retrieve the required source file for this module only via `GetSrcs`, note that each provider needs to be ready by the time these are accessed. This means, `GetSrcs` should be called after `ResolveOutFiles` and `processPaths` for each of the dependant modules.

The exception to this is `ResolveOutFiles` which may depend on other dynamic providers, in this case a bottom up mutator is used to ensure the downstream dependencies of each module are ready.

type DynamicProvider

type DynamicProvider interface {
	Provider
	ResolveOutFiles(blueprint.BaseModuleContext)
}

A dynamic source provider is a module which needs to compute the output file names.

`ResolveOutFiles`, is context aware, and runs bottom up in the dep graph. This means however it cannot run in parallel, fortunately this is __only__ used for `bob_transform_source`.

`ResolveOutFiles` is context aware specifically because it can depend on other dynamic providers.

type Path

type Path struct {
	// contains filtered or unexported fields
}

func FromWithTag

func FromWithTag(from *Path, tag Type) Path

func New

func New(relativePath string, namespace string, tag Type) Path
func NewLink(relativePath string, namespace string, from *Path, tag Type) Path

func NewPath

func NewPath(relativePath string, namespace string, tag Type) Path

func (Path) BuildPath

func (file Path) BuildPath() string
func (file Path) ExpandLink() *Path

func (Path) Ext

func (file Path) Ext() string
func (file Path) FollowLink() *Path

func (Path) IsNotType

func (file Path) IsNotType(ft Type) bool
func (file Path) IsSymLink() bool

func (Path) IsType

func (file Path) IsType(ft Type) bool

func (Path) RelBuildPath

func (file Path) RelBuildPath() string

func (Path) Scope

func (file Path) Scope() string

func (Path) ScopedPath

func (file Path) ScopedPath() string

func (Path) UnScopedPath

func (file Path) UnScopedPath() string

type Paths

type Paths []Path

Array of files as a helper for struct attribute collections TODO: add the possibility to tag a group of files.

func ReferenceGetFilesImpl

func ReferenceGetFilesImpl(ctx blueprint.BaseModuleContext) (srcs Paths)

Basic common implementation, certain targets may wish to customize this.

func (Paths) AppendIfUnique

func (fps Paths) AppendIfUnique(fp Path) Paths

func (Paths) Contains

func (fps Paths) Contains(query Path) bool

func (Paths) Filtered

func (fs Paths) Filtered(predicate func(Path) bool) (ret Paths)

func (Paths) FindSingle

func (fps Paths) FindSingle(predicate func(Path) bool) (*Path, bool)

func (Paths) ForEach

func (fps Paths) ForEach(functor func(Path) bool)

func (Paths) ForEachIf

func (fps Paths) ForEachIf(predicate func(Path) bool, functor func(Path) bool)

func (Paths) Iterate

func (fps Paths) Iterate() <-chan Path

func (Paths) IteratePredicate

func (fps Paths) IteratePredicate(predicate func(Path) bool) <-chan Path

func (Paths) Merge

func (fps Paths) Merge(other Paths) Paths

func (Paths) ToStringSlice

func (fs Paths) ToStringSlice(converter func(Path) string) (ret []string)

func (Paths) ToStringSliceIf

func (fs Paths) ToStringSliceIf(predicate func(Path) bool, converter func(Path) string) (ret []string)

type Provider

type Provider interface {
	// Sources to be forwarded to other modules
	// Expected to be called from a context of another module.
	OutFiles() Paths

	// Targets to be forwarded to other modules
	// Expected to be called from a context of another module.
	OutFileTargets() []string
}

A `Provider` describes a class capable of providing source files, either dynamically generated or by reference to other modules. For example:

  • bob_glob
  • bob_filegroup
  • bob_{generate,transform}_source
  • bob_genrule

A provider interface outputs it's source files for other modules, it can also optionally forward it's source targets as is the case for `bob_filegroup`.

`OutSrcs` is not context aware, this is because it is called from a context aware visitor (`GetSrcs`). This means its output needs to be resolved prior to this call. This is typically done via `processPaths` for static sources, and `ResolveOutFiles` for sources which use a dynamic pathing.

`processPaths` should not require context and only operate on the current module.

type Resolver

type Resolver interface {
	// TODO: This may not be neccessary.
	ResolveFiles(blueprint.BaseModuleContext)
}

`processPaths` needs to run separately to `SourceFileResolver`. This is due to how the defaults are resolved and applied, meaning only defaultable properties will be merged. The current flow is:

  • `processPaths` prepends the module subdirectory to source file.
  • `DefaultApplierMutator` runs, merging source attributes.
  • `ResolveSrcs` runs, setting up filepaths for distribution.

type Type

type Type uint32
const (
	TypeUnset      = 0
	TypeSrc   Type = 1 << iota
	TypeGenerated
	TypeTool
	TypeBinary
	TypeExecutable
	TypeImplicit
	TypeC
	TypeCpp
	TypeAsm
	TypeHeader

	TypeArchive
	TypeShared
	TypeKernelModule
	TypeInstallable
	TypeDep
	TypeRsp
	TypeToc

	TypeLink // Special tag to indicate this file is a symlink

	// Masks:
	TypeCompilable = TypeC | TypeCpp | TypeAsm
)

Jump to

Keyboard shortcuts

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