build

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ScnLayout = "20060102150405"

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(printer func(format string, args ...interface{})) func(b *Build)

WithLogger create logger build option

Types

type Build

type Build struct {
	Name     string
	Source   Source
	LocalDep []*Source
	Spec     Spec
	Mode     string
	Go       GoBuild
	// contains filtered or unexported fields
}

Build represents build spec

func New

func New(URL string, runtime Runtime, opts ...Option) *Build

New creates build options

func (*Build) Init

func (b *Build) Init()

Init checks if build is valid

func (*Build) Logf

func (b *Build) Logf(format string, args ...interface{})

Logf logs

func (*Build) Validate

func (b *Build) Validate() error

Validate check if build is valid

type GoBuild

type GoBuild struct {
	Runtime
	LdFlags string
	Env     map[string]string
	Path    string
	Root    string
}

GoBuild represents go build spec

func (*GoBuild) Init

func (b *GoBuild) Init()

Init initialises build

func (*GoBuild) Validate

func (b *GoBuild) Validate() error

Validate validates if go build is valid

type Info

type Info struct {
	Name        string
	Scn         SequenceChangeNumber //sequence change number, time based format YYYYMMDDHHMMSS at utc
	Compression string
	Runtime     Runtime
}

Info represent plugin info

func (*Info) DecodeURL

func (p *Info) DecodeURL(URL string)

DecodeURL decode info from URL

type Module added in v0.5.0

type Module struct {
	Data []byte
	Mode string
	Info
}

Module represents plugin

func (*Module) Store added in v0.5.0

func (p *Module) Store(ctx context.Context, fs afs.Service, location string) error

Store stores plugin in supplied dest

type Option

type Option func(b *Build)

Option represents build option

type Runtime

type Runtime struct {
	Arch         string
	Os           string
	Version      string
	UseContainer bool
}

Runtime represents a go runtime

func NewRuntime

func NewRuntime() Runtime

NewRuntime creates a runtime

func (*Runtime) DetectVersion

func (r *Runtime) DetectVersion()

DetectVersion detect runtime version or fallback to build go version in case of error

func (*Runtime) InfoName added in v0.7.0

func (r *Runtime) InfoName(name string) string

PluginName returns runtime specific plugin name

func (*Runtime) Init

func (r *Runtime) Init()

Init initialises plugin

func (*Runtime) PluginName

func (r *Runtime) PluginName(name string) string

PluginName returns runtime specific plugin name

func (*Runtime) Validate

func (r *Runtime) Validate(runtime *Runtime) error

Validate checks if runtime is compatible

func (*Runtime) ValidateOsAndArch

func (r *Runtime) ValidateOsAndArch(runtime *Runtime) error

ValidateOsAndArch checks if runtime os and arch is compatible

type SequenceChangeNumber added in v0.9.0

type SequenceChangeNumber int

func NewSequenceChangeNumber added in v0.9.0

func NewSequenceChangeNumber(ts time.Time) SequenceChangeNumber

NewSequenceChangeNumber creates a time based sequence change number

func (SequenceChangeNumber) AsTime added in v0.9.0

func (s SequenceChangeNumber) AsTime() (time.Time, error)

AsTime converts

type Source

type Source struct {
	Data []byte
	URL  string
}

Source represent plugin module code source

func (*Source) Pack

func (s *Source) Pack(ctx context.Context, fs afs.Service) error

Pack packs URL to data

func (*Source) Unpack

func (s *Source) Unpack(ctx context.Context, fs afs.Service, destURL string, modHandler func(mod *modfile.File), modifier option.Modifier) error

Unpack unpacks data into dest URL

type Spec

type Spec struct {
	ModPath   string
	MainPath  string
	BuildArgs []string
}

Spec represents plygin spec

Jump to

Keyboard shortcuts

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