domain

package
v0.8.17 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Target   Target
	Artifact string
}

Artifact is an earthly artifact identifier.

func ParseArtifact

func ParseArtifact(artifactName string) (Artifact, error)

ParseArtifact parses a string representation of an Artifact.

func (Artifact) Clone

func (a Artifact) Clone() Artifact

Clone returns a copy of the Artifact.

func (Artifact) String

func (ea Artifact) String() string

String returns a string representation of the Artifact.

func (Artifact) StringCanonical

func (ea Artifact) StringCanonical() string

StringCanonical returns a string representation of the Artifact.

type Command

type Command struct {
	// Remote representation.
	GitURL string `json:"gitUrl"` // e.g. "github.com/EarthBuild/earthbuild/examples/go"
	Tag    string `json:"tag"`    // e.g. "main"
	// Local representation. E.g. in "./some/path+something" this is "./some/path".
	LocalPath string `json:"localPath"`
	// Import representation. E.g. in "foo+bar" this is "foo".
	ImportRef string `json:"importRef"`

	// Command name. E.g. in "+SOMETHING" this is "SOMETHING".
	Command string `json:"command"`
}

Command is an earthly command identifier.

func ParseCommand

func ParseCommand(fullCommandName string) (Command, error)

ParseCommand parses a string into a Command.

func (Command) DebugString

func (ec Command) DebugString() string

DebugString returns a string that can be printed out for debugging purposes.

func (Command) GetGitURL

func (ec Command) GetGitURL() string

GetGitURL returns the GitURL portion of the command.

func (Command) GetImportRef

func (ec Command) GetImportRef() string

GetImportRef returns the ImportRef portion of the command.

func (Command) GetLocalPath

func (ec Command) GetLocalPath() string

GetLocalPath returns the Path portion of the command.

func (Command) GetName

func (ec Command) GetName() string

GetName returns the Name portion of the command.

func (Command) GetTag

func (ec Command) GetTag() string

GetTag returns the Tag portion of the command.

func (Command) IsExternal

func (ec Command) IsExternal() bool

IsExternal returns whether the command is external to the current project.

func (Command) IsImportReference

func (ec Command) IsImportReference() bool

IsImportReference returns whether the target is a reference to an import.

func (Command) IsLocalExternal

func (ec Command) IsLocalExternal() bool

IsLocalExternal returns whether the command is a local, but external command.

func (Command) IsLocalInternal

func (ec Command) IsLocalInternal() bool

IsLocalInternal returns whether the command is in the same Earthfile.

func (Command) IsRemote

func (ec Command) IsRemote() bool

IsRemote returns whether the command is remote.

func (Command) IsUnresolvedImportReference

func (ec Command) IsUnresolvedImportReference() bool

IsUnresolvedImportReference returns whether the command is an import reference that has no remote or local information set.

func (Command) ProjectCanonical

func (ec Command) ProjectCanonical() string

ProjectCanonical returns a string representation of the project of the command, in canonical form.

func (Command) String

func (ec Command) String() string

String returns a string representation of the command.

func (Command) StringCanonical

func (ec Command) StringCanonical() string

StringCanonical returns a string representation of the command, in canonical form.

type ImportTracker

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

ImportTracker is a resolver which also takes into account imports.

func NewImportTracker

func NewImportTracker(console conslogging.ConsoleLogger, global map[string]ImportTrackerVal) *ImportTracker

NewImportTracker creates a new import resolver.

func (*ImportTracker) Add

func (ir *ImportTracker) Add(importStr string, as string, global, currentlyPrivileged, allowPrivilegedFlag bool) error

Add adds an import to the resolver.

func (*ImportTracker) Deref

func (ir *ImportTracker) Deref(
	ref Reference,
) (resolvedRef Reference, allowPrivileged, allowPrivilegedSet bool, err error)

Deref resolves the import (if any) and returns a reference with the full path.

func (*ImportTracker) Global

func (ir *ImportTracker) Global() map[string]ImportTrackerVal

Global returns the internal map of global imports.

func (*ImportTracker) SetGlobal

func (ir *ImportTracker) SetGlobal(gi map[string]ImportTrackerVal)

SetGlobal sets the global import map.

type ImportTrackerVal

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

ImportTrackerVal is used to resolve imports.

type Reference

type Reference interface {
	// GetGitURL is the git URL part of the reference. E.g. "github.com/EarthBuild/earthbuild/examples/go"
	GetGitURL() string
	// GetTag is the git tag of the reference. E.g. "main"
	GetTag() string
	// GetLocalPath is the local path representation of the reference.
	// E.g. in "./some/path+something" this is "./some/path".
	GetLocalPath() string
	// GetImportRef is the import identifier. E.g. in "foo+bar" this is "foo".
	GetImportRef() string
	// GetName is the target name or the command name of the reference. E.g. in "+something" this is "something".
	GetName() string

	// IsExternal returns whether the ref is external to the current project.
	IsExternal() bool

	// IsLocalInternal returns whether the ref is a local.
	IsLocalInternal() bool

	// IsLocalExternal returns whether the ref is a local, but external target.
	IsLocalExternal() bool

	// IsRemote returns whether the ref is remote.
	IsRemote() bool

	// IsImportReference returns whether the ref is a reference to an import.
	IsImportReference() bool
	// IsUnresolvedImportReference returns whether the ref is an import reference that has
	// no remote or local information set.
	IsUnresolvedImportReference() bool

	// DebugString returns a string that can be printed out for debugging purposes.
	DebugString() string

	// String returns a string representation of the ref.
	String() string

	// StringCanonical returns a string representation of the ref, in canonical form.
	StringCanonical() string
	// ProjectCanonical returns a string representation of the project of the ref, in canonical form.
	ProjectCanonical() string
}

Reference is a target or a command reference.

func JoinReferences

func JoinReferences(r1 Reference, r2 Reference) (Reference, error)

JoinReferences returns the result of interpreting r2 as relative to r1. The result will always have the same type as r2.

type Target

type Target struct {
	// Remote representation.
	GitURL string `json:"gitUrl"` // e.g. "github.com/EarthBuild/earthbuild/examples/go"
	Tag    string `json:"tag"`    // e.g. "main"
	// Local representation. E.g. in "./some/path+something" this is "./some/path".
	LocalPath string `json:"localPath"`
	// Import representation. E.g. in "foo+bar" this is "foo".
	ImportRef string `json:"importRef"`

	// Target name. E.g. in "+something" this is "something".
	Target string `json:"target"`
}

Target is an earthly target identifier.

func ParseTarget

func ParseTarget(fullTargetName string) (Target, error)

ParseTarget parses a string into a Target.

func (Target) DebugString

func (et Target) DebugString() string

DebugString returns a string that can be printed out for debugging purposes.

func (Target) GetGitURL

func (et Target) GetGitURL() string

GetGitURL returns the GitURL portion of the command.

func (Target) GetImportRef

func (et Target) GetImportRef() string

GetImportRef returns the ImportRef portion of the target.

func (Target) GetLocalPath

func (et Target) GetLocalPath() string

GetLocalPath returns the Path portion of the target.

func (Target) GetName

func (et Target) GetName() string

GetName returns the Name portion of the target.

func (Target) GetTag

func (et Target) GetTag() string

GetTag returns the Tag portion of the target.

func (Target) IsExternal

func (et Target) IsExternal() bool

IsExternal returns whether the target is external to the current project.

func (Target) IsImportReference

func (et Target) IsImportReference() bool

IsImportReference returns whether the target is a reference to an import.

func (Target) IsLocalExternal

func (et Target) IsLocalExternal() bool

IsLocalExternal returns whether the target is a local, but external target.

func (Target) IsLocalInternal

func (et Target) IsLocalInternal() bool

IsLocalInternal returns whether the target is in the same Earthfile.

func (Target) IsRemote

func (et Target) IsRemote() bool

IsRemote returns whether the target is remote.

func (Target) IsUnresolvedImportReference

func (et Target) IsUnresolvedImportReference() bool

IsUnresolvedImportReference returns whether the target is an import reference that has no remote or local information set.

func (Target) ProjectCanonical

func (et Target) ProjectCanonical() string

ProjectCanonical returns a string representation of the project of the target, in canonical form.

func (Target) String

func (et Target) String() string

String returns a string representation of the Target.

func (Target) StringCanonical

func (et Target) StringCanonical() string

StringCanonical returns a string representation of the Target, in canonical form.

Jump to

Keyboard shortcuts

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