build

package module
v0.0.0-...-538c218 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: BSD-3-Clause Imports: 17 Imported by: 0

README

go-build

Helper methods to help you build helpfull programs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Code        CodeInfo
	Git         GitInfo
	Executables []ExecutableInfo

	Targets       Targets
	DefaultTarget string

	Console *Console

	GO         string
	GO_VERSION *semver.Version
	GO_GOOS    string
	GO_GOARCH  string

	GIT string
}

func NewBuilder

func NewBuilder(cfg *BuilderConfig) (*Builder, error)

func (*Builder) GetOutputExecutableName

func (b *Builder) GetOutputExecutableName(exec ExecutableInfo, arch string) (string, error)

func (*Builder) GetOutputZipName

func (b *Builder) GetOutputZipName(exec ExecutableInfo, arch string) (string, error)

func (*Builder) ListArchs

func (b *Builder) ListArchs(desired ...string) ([]string, error)

func (*Builder) RunBuild

func (b *Builder) RunBuild(exec ExecutableInfo, arch string) error

func (*Builder) RunCleanZip

func (b *Builder) RunCleanZip() error

func (*Builder) RunLicenseCheck

func (b *Builder) RunLicenseCheck() error

func (*Builder) RunTarget

func (b *Builder) RunTarget(name string) error

func (*Builder) RunZip

func (b *Builder) RunZip(exec ExecutableInfo, arch string) error

type BuilderConfig

type BuilderConfig struct {
	BaseDir string

	MainFileNames []string

	// nil means all
	Archs []string

	GCO             bool
	PreserveSymbols bool
	BuildArgs       []string
	LDFlagsVars     map[string]string

	License      string
	LicenseCheck struct {
		Allowed     []string
		Denied      []string
		IgnoredDeps []string
	}
}

func NewBuilderConfig

func NewBuilderConfig() *BuilderConfig

type CodeInfo

type CodeInfo struct {
	BaseDir   string
	Package   string
	Version   *semver.Version
	BuildDate time.Time
	License   string

	MinGoVersion *semver.Version
}

type Console

type Console struct {
	Dir string
}

func CreateConsole

func CreateConsole(dir string) (*Console, error)

func (*Console) FindExecutable

func (r *Console) FindExecutable(cmd string) (string, error)

func (*Console) RunAndReturnOutput

func (r *Console) RunAndReturnOutput(args ...interface{}) (string, error)

func (*Console) RunInline

func (r *Console) RunInline(args ...interface{}) error

type ExecutableInfo

type ExecutableInfo struct {
	Name    string
	Path    string
	Package string

	Archs       []string
	GCO         bool
	BuildArgs   []string
	LDFlags     []string
	LDFlagsVars map[string]string

	Publish bool
}

type GitInfo

type GitInfo struct {
	Tag        *semver.Version
	Commit     string
	CommitDate *time.Time
}

type Target

type Target struct {
	Name         string
	Dependencies []string
	// contains filtered or unexported fields
}

func (*Target) AddDependency

func (t *Target) AddDependency(dep *Target)

type TargetRunFunc

type TargetRunFunc func() error

type Targets

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

func (*Targets) Add

func (l *Targets) Add(name string, dependencies []string, code TargetRunFunc) *Target

func (*Targets) ComputeTargetRunOrder

func (l *Targets) ComputeTargetRunOrder(name string) ([]string, error)

func (*Targets) Get

func (l *Targets) Get(name string) *Target

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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