libjvm

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

README

github.com/showpune-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/showpune-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 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          bard.Logger
	Result          libcnb.BuildResult
	CertLoader      CertificateLoader
	DependencyCache libpak.DependencyCache
	Native          NativeImage
	CustomHelpers   []string
}

func NewBuild

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

func (Build) Build

func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, 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   io.Writer
}

func NewCertificateLoader

func NewCertificateLoader() 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 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 JDK

type JDK struct {
	CertificateLoader CertificateLoader
	LayerContributor  libpak.DependencyLayerContributor
	Logger            bard.Logger
}

func NewJDK

func NewJDK(dependency libpak.BuildpackDependency, cache libpak.DependencyCache, certificateLoader CertificateLoader) (JDK, libcnb.BOMEntry, error)

func (JDK) Contribute

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

func (JDK) Name

func (j JDK) Name() string
type JLink struct {
	LayerContributor  libpak.LayerContributor
	Logger            bard.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) (JLink, error)

func (JLink) Contribute

func (j JLink) Contribute(layer libcnb.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            bard.Logger
	Metadata          map[string]interface{}
}

func NewJRE

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

func (JRE) Contribute

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

func (JRE) Name

func (j JRE) Name() string

type JVMVersion

type JVMVersion struct {
	Logger bard.Logger
}

func NewJVMVersion

func NewJVMVersion(logger bard.Logger) JVMVersion

func (JVMVersion) GetJVMVersion

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

type JavaSecurityProperties

type JavaSecurityProperties struct {
	LayerContributor libpak.LayerContributor
	Logger           bard.Logger
}

func NewJavaSecurityProperties

func NewJavaSecurityProperties(info libcnb.BuildpackInfo) JavaSecurityProperties

func (JavaSecurityProperties) Contribute

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

func (JavaSecurityProperties) Name

func (j JavaSecurityProperties) Name() string

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.BuildpackDependency
	LayerContributor  libpak.LayerContributor
	Logger            bard.Logger
	NativeDependency  *libpak.BuildpackDependency
	CustomCommand     string
	CustomArgs        []string
}

func NewNIK

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

func (NIK) Contribute

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

func (NIK) Name

func (NIK) Name() string

type NativeImage

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

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