Documentation ¶
Overview ¶
Package generator includes a set of default generators for cipkg actions:
- CIPDExport
- EmbeddedFiles
- ImportTargets
- FetchURLs
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnknowDependencyType = errors.New("unknown dependency type")
)
Functions ¶
This section is empty.
Types ¶
type CIPDExport ¶
type CIPDExport struct { Name string Metadata *core.Action_Metadata Ensure ensure.File Expander template.Expander ConfigFile string CacheDir string HTTPUserAgentPrefix string MaxThreads int ParallelDownloads int ServiceURL string }
CIPDExport is used for downloading CIPD packages. It behaves similar to `cipd export` for the provided ensure file and use ${out} as the cipd root path. TODO(crbug/1323147): Replace direct call cipd binary with cipd sdk when it's available.
type Dependency ¶
type Dependency struct { Generator Generator Type DependencyType Runtime bool }
Dependency provide function for generating the corresponding action with platform from the dependency type for cross-compilation.
type DependencyType ¶
type DependencyType int
DependencyType includes the different dependency types are used to calculate dependency's cross-compile platform from the dependent's.
const ( DepsUnknown DependencyType = iota DepsBuildBuild DepsBuildHost DepsBuildTarget DepsHostHost DepsHostTarget DepsTargetTarget DepsMaxNum )
func (DependencyType) String ¶
func (t DependencyType) String() string
type EmbeddedFiles ¶
type EmbeddedFiles struct {
// contains filtered or unexported fields
}
func InitEmbeddedFS ¶
func InitEmbeddedFS(name string, e embed.FS) *EmbeddedFiles
InitEmbeddedFS registers the embed.FS to copy executor and returns the corresponding generator. It should only be used in init() or on global variables e.g. //go:embed something var somethingEmbed embed.FS var somethingGen = InitEmbeddedFS("derivationName", somethingEmbed)
func (*EmbeddedFiles) SubDir ¶
func (e *EmbeddedFiles) SubDir(dir string) *EmbeddedFiles
SubDir returns a generator copies files in the sub directory of the source.
func (*EmbeddedFiles) WithModeOverride ¶
func (e *EmbeddedFiles) WithModeOverride(f func(name string) (fs.FileMode, error)) *EmbeddedFiles
WithModeOverride overrides file modes while copying.
type FetchURLs ¶
type FetchURLs struct { Name string Metadata *core.Action_Metadata URLs map[string]FetchURL }
FetchURLs downloads files from servers based on the path-url pairs of URLs.
type FindBinaryFunc ¶
FindBinaryFunc returns a slash separated path for the provided binary name.
type ImportTarget ¶
type ImportTarget struct { Source string Version string Mode fs.FileMode FollowSymlinks bool // Tf true, the import target will be considered different if source path // changed. Otherwise only Version will be take into account. SourcePathDependent bool GenerateBatShim bool // Generate bat shim instead of symlink source file. MinGWSymlink bool // Create MinGW's symlink instead of os symlink. }
type ImportTargets ¶
type ImportTargets struct { Name string Metadata *core.Action_Metadata Targets map[string]ImportTarget }
ImportTargets is used to import file/directory from host environment. The builder itself won't detect the change of the imported file/directory. A version string should be generated to indicate the change if it matters. By default, target will be symlinked. When Mode in target is set to anything other than symlink, a hash version will be generated if there is no version provided.
func FromPathBatch ¶
func FromPathBatch(name string, finder FindBinaryFunc, bins ...string) (*ImportTargets, error)
FromPathBatch is a wrapper for builtins.Import generator. It finds binaries using finder func and caches the result based on the name. if finder is nil, binaries will be searched from the PATH environment.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform defines the environment outside the build system, which can't be identified in the environment variables or commands, but will affect the outputs. Platform must includes operating system and architecture, but also support any attributes that may affect the results (e.g. glibcABI).
func CurrentPlatform ¶
func CurrentPlatform() Platform
CurrentPlatform returns a Platform with os and arch set to runtime.GOOS and runtime.GOARCH.
func NewPlatform ¶
NewPlatform returns a Platform with os and arch set.
func PlatformFromCIPD ¶
PlatformFromCIPD converts cipd platform to Platform.