Documentation
¶
Overview ¶
Package loader provides SpecLoader for loading 3pp specs and converting them into stdenv.Generator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageDef ¶
type PackageDef struct { Spec *spec.Spec Dir string Generator generators.Generator // contains filtered or unexported fields }
Run `protoc -I../recipes --go_out=src ../recipes/recipe_modules/support_3pp/spec.proto` from infra/go to generate code from 3pp spec proto.
func FindPackageDefs ¶
func FindPackageDefs(root string) (defs []*PackageDef, err error)
func LoadPackageDef ¶
func LoadPackageDef(dir, name string) (*PackageDef, error)
LoadPackageDef loads package spec from directory.
func (*PackageDef) CIPDPath ¶
func (p *PackageDef) CIPDPath(prefix, host string) string
CIPDPath returns the path for cipd package.
func (*PackageDef) DerivationName ¶
func (p *PackageDef) DerivationName() string
DerivationName is a valid derivation name for using inside the pkgbuild.
func (*PackageDef) FullName ¶
func (p *PackageDef) FullName() string
FullName is the package's name constructed by <pkg_prefix>/<package_name>. This is used for referring other packages in the specs.
func (*PackageDef) FullNameWithOverride ¶
func (p *PackageDef) FullNameWithOverride() string
FullNameWithOverride is the package's name constructed by <pkg_prefix>/<package_name> with possible override from upload. This is used for uploading or retrieving packages from remote.
type SpecLoader ¶
type SpecLoader struct {
// contains filtered or unexported fields
}
SpecLoader loads 3pp Spec and convert it into a stdenv generator.
func NewSpecLoader ¶
func NewSpecLoader(root string, cfg *SpecLoaderConfig) (*SpecLoader, error)
NewSpecLoader creates SpecLoader, loading specs from root directory.
func (*SpecLoader) FromSpec ¶
func (l *SpecLoader) FromSpec(fullName, buildCipdPlatform, hostCipdPlatform string) (*stdenv.Generator, error)
FromSpec converts the 3pp spec to stdenv generator by its full name, which builds the package for running on the cipd host platform. Ideally we should use the Host Platform in BuildContext during the generation. But it's much easier to construct the Spec.Create before generate and call SpecLoader.FromSpec recursively for dependencies.
func (*SpecLoader) ListAllByFullName ¶
func (l *SpecLoader) ListAllByFullName() (names []string)
ListAllByFullName lists all loaded specs' full names by alphabetical order.
func (*SpecLoader) LoadSourceInfos ¶
func (l *SpecLoader) LoadSourceInfos(ctx context.Context, names, cipdHostPlatforms []string, update, persistent bool) error
LoadSourceInfos load the lock file in the spec directory. If update is true, LoadSourceInfos also checks the latest version. If persistent is true, it will update the lock file in the spec directory.
type SpecLoaderConfig ¶
type SpecLoaderConfig struct { CIPDPackagePrefix string CIPDSourceCachePrefix string CIPDTargetPlatform string SourceResolver source.Resolver }
func DefaultSpecLoaderConfig ¶
func DefaultSpecLoaderConfig(target string) *SpecLoaderConfig
DefaultSpecLoaderConfig is the config for default spec loader with default source.Resolver.