buildscript

package
v0.0.0-...-c210e20 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOutdatedAtTime = errs.New("outdated at_time on top")

Functions

func Value

func Value[T string | int | float64 | []string | []float64](inputv T) *value

Value turns a standard type into a buildscript compatible type Intended for use with functions like SetArgument.

Types

type BuildScript

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

BuildScript is what we want consuming code to work with. This specifically makes the raw presentation private as no consuming code should ever be looking at the raw representation. Instead this package should facilitate the use-case of the consuming code through convenience methods that are easy to understand and work with.

func Create

func Create() *BuildScript

func New

func New() *BuildScript

func Unmarshal

func Unmarshal(data []byte) (*BuildScript, error)

Unmarshal returns a structured form of the given AScript (on-disk format).

func (*BuildScript) AddPlatform

func (b *BuildScript) AddPlatform(platformID strfmt.UUID) error

func (*BuildScript) AddRequirement

func (b *BuildScript) AddRequirement(requirement types.Requirement) error

func (*BuildScript) AtTime

func (b *BuildScript) AtTime() *time.Time

func (*BuildScript) Clone

func (b *BuildScript) Clone() (*BuildScript, error)

func (*BuildScript) DependencyRequirements

func (b *BuildScript) DependencyRequirements(targets ...string) ([]types.Requirement, error)

DependencyRequirements is identical to Requirements except that it only considers dependency type requirements, which are the most common. ONLY use this when you know you only need to care about dependencies.

func (*BuildScript) Equals

func (b *BuildScript) Equals(other *BuildScript) (bool, error)

func (*BuildScript) FunctionCalls

func (b *BuildScript) FunctionCalls(name string) []*FuncCall

FunctionCalls will return all function calls that match the given name, regardless of where they occur.

func (*BuildScript) Marshal

func (b *BuildScript) Marshal() ([]byte, error)

Marshal returns this structure in AScript, suitable for writing to disk.

func (*BuildScript) MarshalBuildExpression

func (b *BuildScript) MarshalBuildExpression() ([]byte, error)

MarshalBuildExpression returns this structure as a build expression in JSON format, suitable for sending to the Platform.

func (*BuildScript) Merge

func (b *BuildScript) Merge(other *BuildScript, strategies *mono_models.MergeStrategies) error

Merge merges the requirements from another BuildScript into this one, according to the given merge strategy. BuildScript merges are only possible if the scripts differ ONLY in requirements AND/OR at times.

func (*BuildScript) Platforms

func (b *BuildScript) Platforms(targets ...string) ([]strfmt.UUID, error)

func (*BuildScript) Project

func (b *BuildScript) Project() string

func (*BuildScript) RemovePlatform

func (b *BuildScript) RemovePlatform(platformID strfmt.UUID) error

func (*BuildScript) RemoveRequirement

func (b *BuildScript) RemoveRequirement(requirement types.Requirement) error

RemoveRequirement will remove any matching requirement. Note that it only operates on the Name and Namespace fields. It will not verify if revision or version match.

func (*BuildScript) Requirements

func (b *BuildScript) Requirements(targets ...string) ([]Requirement, error)

Returns the requirements for the given target. If no target is given, uses the default target (i.e. the name assigned to 'main').

func (*BuildScript) SetAtTime

func (b *BuildScript) SetAtTime(t time.Time, override bool)

SetAtTime sets the AtTime value, if the buildscript already has an AtTime value and `override=false` then the value passed here will be discarded. Override should in most cases only be true if we are making changes to the buildscript.

func (*BuildScript) SetProject

func (b *BuildScript) SetProject(url string)

func (*BuildScript) UnmarshalBuildExpression

func (b *BuildScript) UnmarshalBuildExpression(data []byte) error

UnmarshalBuildExpression returns a BuildScript constructed from the given build expression in JSON format. Build scripts and build expressions are almost identical, with the exception of the atTime field. Build expressions ALWAYS set at_time to `$at_time`, which refers to the timestamp on the commit, while buildscripts encode this timestamp as part of their definition. For this reason we have to supply the timestamp as a separate argument.

func (*BuildScript) UpdateRequirement

func (b *BuildScript) UpdateRequirement(operation types.Operation, requirement types.Requirement) error

type DependencyRequirement

type DependencyRequirement struct {
	types.Requirement
}

func (DependencyRequirement) IsRequirement

func (r DependencyRequirement) IsRequirement()

type FuncCall

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

FuncCall is the exportable version of funcCall, because we do not want to expose low level buildscript functionality outside of the buildscript package.

func (*FuncCall) Argument

func (f *FuncCall) Argument(name string) any

Argument returns the value of the given argument, or nil if it does not exist You will still need to cast the value to the correct type.

func (*FuncCall) MarshalJSON

func (f *FuncCall) MarshalJSON() ([]byte, error)

func (*FuncCall) SetArgument

func (f *FuncCall) SetArgument(k string, v *value)

SetArgument will update the given argument, or add it if it does not exist

func (*FuncCall) UnsetArgument

func (f *FuncCall) UnsetArgument(k string)

UnsetArgument will remove the given argument, if it exists

type PlatformNotFoundError

type PlatformNotFoundError struct {
	Id                     strfmt.UUID
	*locale.LocalizedError // for legacy non-user-facing error usages
}

type Requirement

type Requirement interface {
	IsRequirement()
}

type RequirementNotFoundError

type RequirementNotFoundError struct {
	Name                   string
	*locale.LocalizedError // for legacy non-user-facing error usages
}

type RevisionRequirement

type RevisionRequirement struct {
	Name       string      `json:"name"`
	RevisionID strfmt.UUID `json:"revision_id"`
}

func (RevisionRequirement) IsRequirement

func (r RevisionRequirement) IsRequirement()

type UnknownRequirement

type UnknownRequirement struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func (UnknownRequirement) IsRequirement

func (r UnknownRequirement) IsRequirement()

Jump to

Keyboard shortcuts

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