libjvm

package module
v2.0.0-...-f3de4f5 Latest Latest
Warning

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

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

README

github.com/paketo-buildpacks/libjvm

libjvm is a Go library and helper applications that form the basis for building the different Paketo-style JVM-providing buildpacks.

Usage

go get github.com/paketo-buildpacks/libjvm

License

This library is released under version 2.0 of the Apache License.

Documentation

Index

Constants

View Source
const (
	PlanEntryNativeImageBuilder = "native-image-builder"
	PlanEntryJRE                = "jre"
	PlanEntryJDK                = "jdk"
)
View Source
const DefaultCertFile = "/etc/ssl/certs/ca-certificates.crt"

Variables

View Source
var Java18, _ = semver.NewVersion("18")
View Source
var Java9, _ = semver.NewVersion("9")
View Source
var NormalizedDateTime = time.Date(1980, time.January, 1, 0, 0, 1, 0, time.UTC)

Functions

func ConfigureJRE

func ConfigureJRE(configCtx ConfigJREContext) error

func IsBeforeJava18

func IsBeforeJava18(candidate string) bool

func IsBeforeJava9

func IsBeforeJava9(candidate string) bool

func IsBuildContribution

func IsBuildContribution(metadata map[string]interface{}) bool

func IsLaunchContribution

func IsLaunchContribution(metadata map[string]interface{}) bool

func NewManifest

func NewManifest(applicationPath string) (*properties.Properties, error)

NewManifest reads the <APP>/META-INF/MANIFEST.MF file if it exists, normalizing it into the standard properties form.

func NewManifestFromJAR

func NewManifestFromJAR(jarFilePath string) (*properties.Properties, error)

NewManifestFromJAR reads the META-INF/MANIFEST.MF from a JAR file if it exists, normalizing it into the standard properties form.

Types

type Build

type Build struct {
	Logger          log.Logger
	CertLoader      CertificateLoader
	DependencyCache libpak.DependencyCache
	Native          NativeImage
	CustomHelpers   []string
	Contributable   []libpak.Contributable
}

func NewBuild

func NewBuild(logger log.Logger, buildOpts ...BuildOption) Build

func (Build) Build

func (b Build) Build(context libcnb.BuildContext, result *libcnb.BuildResult) ([]libpak.Contributable, error)

type BuildOption

type BuildOption func(build Build) Build

func WithCustomHelpers

func WithCustomHelpers(customHelpers []string) BuildOption

func WithNativeImage

func WithNativeImage(nativeImage NativeImage) BuildOption

type CertificateLoader

type CertificateLoader struct {
	CertFile string
	CertDirs []string
	Logger   log.Logger
}

func NewCertificateLoader

func NewCertificateLoader(logger log.Logger) CertificateLoader

func (*CertificateLoader) Load

func (c *CertificateLoader) Load(path string, password string) error

func (*CertificateLoader) Metadata

func (c *CertificateLoader) Metadata() (map[string]interface{}, error)

type ConfigJREContext

type ConfigJREContext struct {
	Layer             *libcnb.Layer
	Logger            log.Logger
	JavaHome          string
	JavaVersion       string
	ApplicationPath   string
	IsBuild           bool
	IsLaunch          bool
	SkipCerts         bool
	CertificateLoader CertificateLoader
	DistType          DistributionType
}

type Detect

type Detect struct{}

func (Detect) Detect

func (d Detect) Detect(context libcnb.DetectContext) (libcnb.DetectResult, error)

type DistributionType

type DistributionType uint8
const (
	JDKType DistributionType = iota
	JREType
)

func (DistributionType) String

func (d DistributionType) String() string

type ExtendConfig

type ExtendConfig struct {
	Build ExtendImageConfig `toml:"build"`
}

type ExtendImageConfig

type ExtendImageConfig struct {
	Args []ExtendImageConfigArg `toml:"args"`
}

type ExtendImageConfigArg

type ExtendImageConfigArg struct {
	Name  string `toml:"name"`
	Value string `toml:"value"`
}

type Generate

type Generate struct {
	Logger                 log.Logger
	GenerateContentBuilder GenerateContentBuilder
}

func NewGenerate

func NewGenerate(logger log.Logger, contentBuilder GenerateContentBuilder) Generate

func (Generate) Generate

func (b Generate) Generate(context libcnb.GenerateContext) (libcnb.GenerateResult, error)

type GenerateContentBuilder

type GenerateContentBuilder func(GenerateContentContext) (GenerateContentResult, error)

type GenerateContentContext

type GenerateContentContext struct {
	ConfigurationResolver libpak.ConfigurationResolver
	DependencyResolver    libpak.DependencyResolver
	DependencyCache       libpak.DependencyCache
	Context               libcnb.GenerateContext
	PlanEntryResolver     libpak.PlanEntryResolver
	Logger                log.Logger
	Result                libcnb.GenerateResult
}

type GenerateContentResult

type GenerateContentResult struct {
	ExtendConfig    ExtendConfig
	BuildDockerfile io.Reader
	RunDockerfile   io.Reader
	GenerateResult  libcnb.GenerateResult
}

type JDK

type JDK struct {
	CertificateLoader CertificateLoader
	LayerContributor  libpak.DependencyLayerContributor
}

func NewJDK

func NewJDK(dependency libpak.BuildModuleDependency, cache libpak.DependencyCache, certificateLoader CertificateLoader) (JDK, error)

func (JDK) Contribute

func (j JDK) Contribute(layer *libcnb.Layer) error

func (JDK) Name

func (j JDK) Name() string

type JKSKeystore

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

func NewJKSKeystore

func NewJKSKeystore(location, password string) (*JKSKeystore, error)

func (*JKSKeystore) Add

func (k *JKSKeystore) Add(name string, b *pem.Block) error

func (*JKSKeystore) Len

func (k *JKSKeystore) Len() int

func (*JKSKeystore) Write

func (k *JKSKeystore) Write() error
type JLink struct {
	LayerContributor  libpak.LayerContributor
	Logger            log.Logger
	ApplicationPath   string
	Executor          effect.Executor
	CertificateLoader CertificateLoader
	Metadata          map[string]interface{}
	JavaVersion       string
	Args              []string
	UserConfigured    bool
}
func NewJLink(applicationPath string, exec effect.Executor, args []string, certificateLoader CertificateLoader, metadata map[string]interface{}, userConfigured bool, logger log.Logger) (JLink, error)

func (JLink) Contribute

func (j JLink) Contribute(layer *libcnb.Layer) error

func (JLink) Name

func (j JLink) Name() string

type JRE

type JRE struct {
	ApplicationPath   string
	CertificateLoader CertificateLoader
	DistributionType  DistributionType
	LayerContributor  libpak.DependencyLayerContributor
	Logger            log.Logger
	Metadata          map[string]interface{}
}

func NewJRE

func NewJRE(applicationPath string, dependency libpak.BuildModuleDependency, cache libpak.DependencyCache, distributionType DistributionType, certificateLoader CertificateLoader, metadata map[string]interface{}) (JRE, error)

func (JRE) Contribute

func (j JRE) Contribute(layer *libcnb.Layer) error

func (JRE) Name

func (j JRE) Name() string

type JVMVersion

type JVMVersion struct {
	Logger log.Logger
}

func NewJVMVersion

func NewJVMVersion(logger log.Logger) JVMVersion

func (JVMVersion) GetJVMVersion

func (j JVMVersion) GetJVMVersion(appPath string, cr libpak.ConfigurationResolver) (string, error)

type JavaSecurityProperties

type JavaSecurityProperties struct {
	LayerContributor libpak.LayerContributor
}

func NewJavaSecurityProperties

func NewJavaSecurityProperties(info libcnb.BuildpackInfo, logger log.Logger) JavaSecurityProperties

func (JavaSecurityProperties) Contribute

func (j JavaSecurityProperties) Contribute(layer *libcnb.Layer) error

func (JavaSecurityProperties) Name

func (j JavaSecurityProperties) Name() string

type Keystore

type Keystore interface {
	Add(string, *pem.Block) error
	Write() error
}

func DetectKeystore

func DetectKeystore(location string) (Keystore, error)

type MavenJAR

type MavenJAR struct {

	// Name is the name of the JAR, without the version or extension.
	Name string `toml:"name"`

	// Version is the version of the JAR, without the name or extension.
	Version string `toml:"version"`

	// SHA256 is the SHA256 hash of the JAR.
	SHA256 string `toml:"sha256"`
}

MavenJAR is metadata about a JRE entry that follows Maven naming conventions.

func NewMavenJARListing

func NewMavenJARListing(roots ...string) ([]MavenJAR, error)

NewMavenJARListing generates a listing of all JAR that follow Maven naming convention under the roots.

type NIK

type NIK struct {
	CertificateLoader CertificateLoader
	DependencyCache   libpak.DependencyCache
	Executor          effect.Executor
	JDKDependency     libpak.BuildModuleDependency
	LayerContributor  libpak.LayerContributor
	Logger            log.Logger
	NativeDependency  *libpak.BuildModuleDependency
	CustomCommand     string
	CustomArgs        []string
}

func NewNIK

func NewNIK(jdkDependency libpak.BuildModuleDependency, nativeDependency *libpak.BuildModuleDependency, cache libpak.DependencyCache, certificateLoader CertificateLoader, customCommand string, customArgs []string) (NIK, error)

func (NIK) Contribute

func (n NIK) Contribute(layer *libcnb.Layer) error

func (NIK) Name

func (NIK) Name() string

type NativeImage

type NativeImage struct {
	BundledWithJDK bool
	CustomCommand  string
	CustomArgs     []string
}

type PasswordLessPKCS12Keystore

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

func NewPasswordLessPKCS12Keystore

func NewPasswordLessPKCS12Keystore(location string) *PasswordLessPKCS12Keystore

func (*PasswordLessPKCS12Keystore) Add

func (k *PasswordLessPKCS12Keystore) Add(name string, b *pem.Block) error

func (*PasswordLessPKCS12Keystore) Len

func (*PasswordLessPKCS12Keystore) Write

func (k *PasswordLessPKCS12Keystore) Write() error

type SDKInfo

type SDKInfo struct {
	Type    string
	Version string
	Vendor  string
}

SDKInfo represents the information from each line in the `.sdkmanrc` file

func ReadSDKMANRC

func ReadSDKMANRC(path string) ([]SDKInfo, error)

ReadSDKMANRC reads the `.sdkmanrc` format file from path and retuns the list of SDKS in it

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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