dependency

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package dependency manages schema generation for Crossplane project dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPackages

func CleanPackages(root string, fs afero.Fs) error

CleanPackages removes the per-user xpkg cache directory at root.

func DefaultCacheDir

func DefaultCacheDir() string

DefaultCacheDir returns the default per-user xpkg cache directory.

func GetSourceDescription

func GetSourceDescription(dep v1alpha1.Dependency) string

GetSourceDescription returns a human-readable description of a dependency.

Types

type Manager

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

Manager manages dependencies for a Crossplane project, including fetching packages, extracting CRDs, and generating schemas.

func NewManager

func NewManager(proj *v1alpha1.Project, projFS afero.Fs, opts ...ManagerOption) *Manager

NewManager returns an initialized dependency manager.

func (*Manager) AddAll

func (m *Manager) AddAll(ctx context.Context, ch async.EventChannel) error

AddAll adds all dependencies configured in the project. If ch is non-nil, events will be sent for each dependency as it is processed.

func (*Manager) AddDependency

func (m *Manager) AddDependency(ctx context.Context, dep *v1alpha1.Dependency) error

AddDependency adds a dependency, generates schemas for it, and persists the dependency to the project file.

func (*Manager) AddPackage

func (m *Manager) AddPackage(ctx context.Context, ref string, refresh bool) (*schema.GroupVersionKind, error)

AddPackage adds a package to the dependency manager. If refresh is set, the package's ref will be re-resolved regardless of whether it is cached.

func (*Manager) Clean

func (m *Manager) Clean() error

Clean removes all generated schemas.

func (*Manager) RefreshAll

func (m *Manager) RefreshAll(ctx context.Context, ch async.EventChannel) error

RefreshAll re-resolves every dependency's version constraint against the registry. Used by `dependency update-cache`.

func (*Manager) ResolveRef

func (m *Manager) ResolveRef(ref string) (name.Reference, error)

ResolveRef resolves a version constraint in an OCI ref to a concrete tag. If the ref has no tag, has an exact semver version, or is not a valid constraint, it is returned unchanged.

type ManagerOption

type ManagerOption func(*managerOptions)

ManagerOption configures the dependency manager.

func WithGitAuthProvider

func WithGitAuthProvider(p git.AuthProvider) ManagerOption

WithGitAuthProvider sets the auth provider for git operations.

func WithProjectFile

func WithProjectFile(path string) ManagerOption

WithProjectFile sets the path to the project file.

func WithResolver

func WithResolver(r *clixpkg.Resolver) ManagerOption

WithResolver sets the package reference resolver used to translate semver constraints into concrete tags before calling Client.Get.

func WithSchemaFS

func WithSchemaFS(fs afero.Fs) ManagerOption

WithSchemaFS sets the filesystem to use for schemas.

func WithSchemaGenerators

func WithSchemaGenerators(gs []generator.Interface) ManagerOption

WithSchemaGenerators sets the schema generators to call.

func WithSchemaRunner

func WithSchemaRunner(r runner.SchemaRunner) ManagerOption

WithSchemaRunner sets the runner to use when generating schemas.

func WithXpkgClient

func WithXpkgClient(c runtimexpkg.Client) ManagerOption

WithXpkgClient sets the runtime xpkg.Client used to fetch and parse xpkg dependencies.

Jump to

Keyboard shortcuts

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