buildpack

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 9

Documentation

Index

Constants

View Source
const (
	CacheRoot            = "dependency-cache"
	DependenciesMetadata = "dependencies"
	DefaultVersions      = "default-versions"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildImage

type BuildImage = buildpack.BuildImage

type BuildImages

type BuildImages = buildpack.BuildImages

type Buildpack

type Buildpack struct {
	buildpack.Buildpack

	// CacheRoot is the path to the root directory for the buildpack's dependency cache.
	CacheRoot string
	// contains filtered or unexported fields
}

Buildpack is an extension to libbuildpack.Buildpack that adds additional opinionated behaviors.

func NewBuildpack

func NewBuildpack(buildpack buildpack.Buildpack, logger logger.Logger) Buildpack

NewBuildpack creates a new instance of Buildpack from a specified buildpack.Buildpack.

func (Buildpack) DefaultVersion

func (b Buildpack) DefaultVersion(id string) (string, error)

func (Buildpack) Dependencies

func (b Buildpack) Dependencies() (Dependencies, error)

Dependencies returns the collection of dependencies extracted from the generic buildpack metadata.

func (Buildpack) Identity

func (b Buildpack) Identity() (string, string)

Identity make Buildpack satisfy the Identifiable interface.

func (Buildpack) IncludeFiles

func (b Buildpack) IncludeFiles() ([]string, error)

IncludeFiles returns the include_files buildpack metadata.

func (Buildpack) PrePackage

func (b Buildpack) PrePackage() (string, bool)

PrePackage returns the pre_package buildpack metadata.

func (Buildpack) RuntimeDependency

func (b Buildpack) RuntimeDependency(id, version string, stack stack.Stack) (Dependency, error)

type Dependencies

type Dependencies []Dependency

Dependencies is a collection of Dependency instances.

func (Dependencies) Best

func (d Dependencies) Best(id string, versionConstraint string, stack stack.Stack) (Dependency, error)

Best returns the best (latest version) dependency within a collection of Dependencies. The candidate set is first filtered by id, version, and stack, then the remaining candidates are sorted for the best result. If the versionConstraint is not specified (""), then the latest wildcard ("*") is used.

func (Dependencies) Has

func (d Dependencies) Has(id string) bool

Has indicates whether the collection of dependencies has any dependency of a specific id. This is used primarily to determine whether an optional dependency exists, before calling Best() which would throw an error if one did not.

type Dependency

type Dependency struct {
	// ID is the dependency ID.
	ID string `mapstruct:"id" toml:"id"`

	// Name is the dependency ID.
	Name string `mapstruct:"name" toml:"name"`

	// Version is the dependency version.
	Version Version `mapstruct:"version" toml:"version"`

	// URI is the dependency URI.
	URI string `mapstruct:"uri" toml:"uri"`

	// SHA256 is the hash of the dependency.
	SHA256 string `mapstruct:"sha256" toml:"sha256"`

	// Stacks are the stacks the dependency is compatible with.
	Stacks Stacks `mapstruct:"stacks" toml:"stacks"`

	// Licenses are the stacks the dependency is distributed under.
	Licenses Licenses `mapstruct:"licenses" toml:"licenses"`
}

Dependency represents a buildpack dependency.

func NewDependency

func NewDependency(dep map[string]interface{}) (Dependency, error)

NewDependency makes a Dependency from a generic map describing a Dependency

func (Dependency) Identity

func (d Dependency) Identity() (string, string)

Identity make Buildpack satisfy the Identifiable interface.

func (Dependency) Validate

func (d Dependency) Validate() error

Validate ensures that the dependency is valid.

type Info

type Info = buildpack.Info

type License

type License struct {
	// Type is the type of the license.  This is typically the SPDX short identifier.
	Type string `mapstruct:"type" toml:"type"`

	// URI is the location where the license can be found.
	URI string `mapstruct:"uri" toml:"uri"`
}

License represents a license that a Dependency is distributed under. At least one of Name or URI MUST be specified.

func (License) Validate

func (l License) Validate() error

Validate ensures that license has at least one of type or uri

type Licenses

type Licenses []License

Licenses is a collection of licenses

func (Licenses) Validate

func (l Licenses) Validate() error

Validate ensures that there is at least one license and all licenses are valid

type Metadata

type Metadata = buildpack.Metadata

type RunImage

type RunImage = buildpack.RunImage

type RunImages

type RunImages = buildpack.RunImages

type Stack

type Stack = buildpack.Stack

type Stacks

type Stacks []stack.Stack

Stacks is a collection of stack ids.

func (Stacks) Validate

func (s Stacks) Validate() error

Validate ensures that there is at least one stack.

type Version

type Version struct {
	*semver.Version
}

Version is an extension to semver.Version to make it marshalable.

func (Version) MarshalText

func (v Version) MarshalText() ([]byte, error)

MarshalText makes Version satisfy the encoding.TextMarshaler interface.

func (*Version) UnmarshalText

func (v *Version) UnmarshalText(text []byte) error

UnmarshalText makes Version satisfy the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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