Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ require (
github.com/Dynatrace/libbuildpack-dynatrace v1.8.0
github.com/cloudfoundry/libbuildpack v0.0.0-20251203175254-7be530ec9fef
github.com/cloudfoundry/switchblade v0.9.4
github.com/golang/mock v1.6.0
github.com/onsi/ginkgo/v2 v2.27.2
github.com/onsi/gomega v1.38.2
github.com/sclevine/spec v1.4.0
go.yaml.in/yaml/v3 v3.0.4
gopkg.in/yaml.v2 v2.4.0
)

Expand Down Expand Up @@ -42,7 +44,6 @@ require (
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sync v0.18.0 // indirect
Expand Down
308 changes: 308 additions & 0 deletions src/internal/mocks/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 33 additions & 4 deletions src/java/common/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,49 @@ import (
"encoding/json"
"fmt"
"github.com/cloudfoundry/libbuildpack"
"io"
"os"
"path/filepath"
"strconv"
"strings"
)

//go:generate mockgen -source=context.go --destination=../../internal/mocks/mocks.go --package=mocks

type Command interface {
Execute(string, io.Writer, io.Writer, string, ...string) error
}

type Stager interface {
LinkDirectoryInDepDir(string, string) error
BuildDir() string
DepDir() string
DepsIdx() string
CacheDir() string
WriteConfigYml(interface{}) error
WriteEnvFile(string, string) error
WriteProfileD(string, string) error
}

type Manifest interface {
AllDependencyVersions(string) []string
DefaultVersion(string) (libbuildpack.Dependency, error)
GetEntry(libbuildpack.Dependency) (*libbuildpack.ManifestEntry, error)
}

type Installer interface {
InstallDependency(libbuildpack.Dependency, string) error
InstallDependencyWithStrip(libbuildpack.Dependency, string, int) error
}

// Context holds shared dependencies for buildpack components
// Used by containers, frameworks, and JREs to access buildpack infrastructure
type Context struct {
Stager *libbuildpack.Stager
Manifest *libbuildpack.Manifest
Installer *libbuildpack.Installer
Stager Stager
Manifest Manifest
Installer Installer
Log *libbuildpack.Logger
Command *libbuildpack.Command
Command Command
}

// DetermineJavaVersion determines the major Java version from a Java installation
Expand Down
Loading