Documentation ¶
Overview ¶
Package libjavabuildpack contains types and functions for implementing a Java Buildpack-related buildpack.
Index ¶
- func CopyDirectory(srcDir, destDir string) error
- func CopyFile(source, destFile string) error
- func ExtractTarGz(tarFile, destDir string, stripComponents int) error
- func ExtractZip(zipfile, destDir string, stripComponents int) error
- func FileExists(file string) (bool, error)
- func FromTomlFile(file string, v interface{}) error
- func WriteToFile(source io.Reader, destFile string, mode os.FileMode) error
- type Build
- type Buildpack
- type Cache
- type CacheContributor
- type Dependencies
- type Dependency
- type DependencyCacheLayer
- func (d DependencyCacheLayer) AppendEnv(name string, format string, args ...interface{}) error
- func (d DependencyCacheLayer) AppendPathEnv(name string, format string, args ...interface{}) error
- func (d DependencyCacheLayer) Contribute(contributor CacheContributor) error
- func (d DependencyCacheLayer) OverrideEnv(name string, format string, args ...interface{}) error
- func (d DependencyCacheLayer) String() string
- type DependencyLaunchLayer
- type Detect
- type DownloadCacheLayer
- type Launch
- type LaunchContributor
- type License
- type Licenses
- type Logger
- type Packager
- type Stacks
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDirectory ¶ added in v1.11.0
CopyDirectory copies srcDir to destDir
func CopyFile ¶
CopyFile copies source file to destFile, creating all intermediate directories in destFile
func ExtractTarGz ¶
ExtractTarGz extracts tarfile to destDir
func ExtractZip ¶
ExtractZip extracts zipfile to destDir
func FileExists ¶
FileExists returns true if a file exists, otherwise false.
func FromTomlFile ¶
FromTomlFile decodes a TOML file into a struct.
Types ¶
type Build ¶
type Build struct { libbuildpack.Build // Buildpack represents the metadata associated with a buildpack. Buildpack Buildpack // Cache represents the cache layers contributed by a buildpack. Cache Cache // Launch represents the launch layers contributed by the buildpack. Launch Launch // Logger is used to write debug and info to the console. Logger Logger }
Build is an extension to libbuildpack.Build that allows additional functionality to be added.
func DefaultBuild ¶
DefaultBuild creates a new instance of Build using default values.
type Buildpack ¶
type Buildpack struct { libbuildpack.Buildpack // CacheRoot is the path to the root directory for the buildpack's dependency cache. CacheRoot string }
Buildpack is an extension to libbuildpack.Buildpack that adds additional opinionated behaviors.
func NewBuildpack ¶ added in v1.1.0
func NewBuildpack(buildpack libbuildpack.Buildpack) Buildpack
NewBuildpack creates a new instance of Buildpack from a specified libbuildpack.Buildpack.
func (Buildpack) Dependencies ¶
func (b Buildpack) Dependencies() (Dependencies, error)
Dependencies returns the collection of dependencies extracted from the generic buildpack metadata.
func (Buildpack) IncludeFiles ¶
IncludeFiles returns the include_files buildpack metadata.
func (Buildpack) PrePackage ¶
PrePackage returns the pre_package buildpack metadata.
type Cache ¶
type Cache struct { libbuildpack.Cache // BuildpackCacheRoot is the path to the root directory for the buildpack's dependency cache. BuildpackCacheRoot string // Logger is used to write debug and info to the console. Logger Logger }
Cache is an extension to libbuildpack.Cache that allows additional functionality to be added.
func (Cache) DependencyLayer ¶
func (c Cache) DependencyLayer(dependency Dependency) DependencyCacheLayer
DependencyLayer returns a DependencyCacheLayer unique to a dependency.
func (Cache) DownloadLayer ¶
func (c Cache) DownloadLayer(dependency Dependency) DownloadCacheLayer
DownloadLayer returns a DownloadCacheLayer unique to a dependency.
type CacheContributor ¶
type CacheContributor func(artifact string, layer DependencyCacheLayer) error
CacheContributor defines a callback function that is called when a dependency needs to be contributed.
type Dependencies ¶
type Dependencies []Dependency
Dependencies is a collection of Dependency instances.
func (Dependencies) Best ¶
func (d Dependencies) Best(id string, versionConstraint string, stack string) (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) Len ¶
func (d Dependencies) Len() int
Len makes Dependencies satisfy the sort.Interface interface.
func (Dependencies) Less ¶
func (d Dependencies) Less(i int, j int) bool
Less makes Dependencies satisfy the sort.Interface interface.
func (Dependencies) Swap ¶
func (d Dependencies) Swap(i int, j int)
Swap makes Dependencies satisfy the sort.Interface interface.
type Dependency ¶
type Dependency struct { // ID is the dependency ID. ID string `toml:"id"` // Name is the dependency ID. Name string `toml:"name"` // Version is the dependency version. Version Version `toml:"version"` // URI is the dependency URI. URI string `toml:"uri"` // SHA256 is the hash of the dependency. SHA256 string `toml:"sha256"` // Stacks are the stacks the dependency is compatible with. Stacks Stacks `toml:"stacks"` // Licenses are the stacks the dependency is distributed under. Licenses Licenses `toml:"licenses"` }
Dependency represents a buildpack dependency.
func (Dependency) String ¶
func (d Dependency) String() string
String makes Dependency satisfy the Stringer interface.
type DependencyCacheLayer ¶
type DependencyCacheLayer struct { libbuildpack.CacheLayer // Logger is used to write debug and info to the console. Logger Logger // contains filtered or unexported fields }
DependencyCacheLayer is an extension to CacheLayer that is unique to a dependency contribution.
func (DependencyCacheLayer) AppendEnv ¶ added in v1.9.0
func (d DependencyCacheLayer) AppendEnv(name string, format string, args ...interface{}) error
AppendEnv appends the value of this environment variable to any previous declarations of the value without any delimitation. If delimitation is important during concatenation, callers are required to add it.
func (DependencyCacheLayer) AppendPathEnv ¶ added in v1.9.0
func (d DependencyCacheLayer) AppendPathEnv(name string, format string, args ...interface{}) error
AppendPathEnv appends the value of this environment variable to any previous declarations of the value using the OS path delimiter.
func (DependencyCacheLayer) Contribute ¶
func (d DependencyCacheLayer) Contribute(contributor CacheContributor) error
Contribute contributes an artifact to a cache layer. If the artifact has already been contributed, the cache will be validated and used directly.
func (DependencyCacheLayer) OverrideEnv ¶ added in v1.9.0
func (d DependencyCacheLayer) OverrideEnv(name string, format string, args ...interface{}) error
Override overrides any existing value for an environment variable with this value.
func (DependencyCacheLayer) String ¶
func (d DependencyCacheLayer) String() string
String makes DependencyCacheLayer satisfy the Stringer interface.
type DependencyLaunchLayer ¶
type DependencyLaunchLayer struct { libbuildpack.LaunchLayer // Dependency is the dependency provided by this layer Dependency Dependency // Logger is used to write debug and info to the console. Logger Logger // contains filtered or unexported fields }
DependencyLaunchLayer is an extension to LaunchLayer that is unique to a dependency.
func (DependencyLaunchLayer) ArtifactName ¶
func (d DependencyLaunchLayer) ArtifactName() string
ArtifactName returns the name portion of the download path for the dependency.
func (DependencyLaunchLayer) Contribute ¶
func (d DependencyLaunchLayer) Contribute(contributor LaunchContributor) error
Contribute facilitates custom contribution of an artifact to a launch layer. If the artifact has already been contributed, the contribution is validated and the contributor is not called.
func (DependencyLaunchLayer) String ¶
func (d DependencyLaunchLayer) String() string
String makes DependencyLaunchLayer satisfy the Stringer interface.
func (DependencyLaunchLayer) WriteProfile ¶ added in v1.9.0
func (d DependencyLaunchLayer) WriteProfile(file string, format string, args ...interface{}) error
WriteProfile writes a file to profile.d with this value.
type Detect ¶
type Detect struct { libbuildpack.Detect // Buildpack represents the metadata associated with a buildpack. Buildpack Buildpack // Logger is used to write debug and info to the console. Logger Logger }
Detect is an extension to libbuildpack.Detect that allows additional functionality to be added.
func DefaultDetect ¶
DefaultDetect creates a new instance of Detect using default values.
type DownloadCacheLayer ¶
type DownloadCacheLayer struct { libbuildpack.CacheLayer // Logger is used to write debug and info to the console. Logger Logger // contains filtered or unexported fields }
DownloadCacheLayer is an extension to CacheLayer that is unique to a dependency download.
func (DownloadCacheLayer) Artifact ¶
func (d DownloadCacheLayer) Artifact() (string, error)
Artifact returns the path to an artifact cached in the layer. If the artifact has already been downloaded, the cache will be validated and used directly.
func (DownloadCacheLayer) Metadata ¶
func (d DownloadCacheLayer) Metadata(root string) string
Metadata returns the path to the metadata file for an artifact cached in the later.
func (DownloadCacheLayer) String ¶
func (d DownloadCacheLayer) String() string
String makes DownloadCacheLayer satisfy the Stringer interface.
type Launch ¶
type Launch struct { libbuildpack.Launch // Cache is the Cache to use to acquire dependencies. Cache Cache // Logger logger is used to write debug and info to the console. Logger Logger }
Launch is an extension to libbuildpack.Launch that allows additional functionality to be added.
func (Launch) DependencyLayer ¶
func (l Launch) DependencyLayer(dependency Dependency) DependencyLaunchLayer
DependencyLayer returns a DependencyLaunchLayer unique to a dependency.
func (Launch) WriteMetadata ¶ added in v1.3.0
func (l Launch) WriteMetadata(metadata libbuildpack.LaunchMetadata) error
WriteMetadata writes Launch metadata to the filesystem.
type LaunchContributor ¶
type LaunchContributor func(artifact string, layer DependencyLaunchLayer) error
LaunchContributor defines a callback function that is called when a dependency needs to be contributed.
type License ¶ added in v1.4.0
type License struct { // Type is the type of the license. This is typically the SPDX short identifier. Type string `toml:"type"` // URI is the location where the license can be found. URI string `toml:"uri"` }
License represents a license that a Dependency is distributed under. At least one of Name or URI MUST be specified.
type Logger ¶
type Logger struct {
libbuildpack.Logger
}
Logger is an extension to libbuildpack.Logger to add additional functionality.
func (Logger) PrettyVersion ¶
PrettyVersion formats a standard pretty version of a dependency.
func (Logger) SubsequentLine ¶
SubsequentLine prints log message with the subsequent line indent.
type Packager ¶
Packager is a root element for packaging up a buildpack
func DefaultPackager ¶
DefaultPackager creates a new Packager, using the executable to find the root of the buildpack.
type Version ¶
func (Version) MarshalText ¶
MarshalText makes Version satisfy the encoding.TextMarshaler interface.
func (*Version) UnmarshalText ¶
UnmarshalText makes Version satisfy the encoding.TextUnmarshaler interface.