build

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TempDir string

Functions

func Prepare

func Prepare()

Types

type Common

type Common struct {
	CommonBase     `yaml:"base,omitempty,inline,flow"`
	Disabled       bool     `yaml:"disabled,omitempty"`
	KeepWorkdir    bool     `yaml:"keep-workdir,omitempty"`
	UseWorkDir     string   `yaml:"use-workdir,omitempty"`
	For            []string `yaml:"for,omitempty,flow"`
	Os             []string `yaml:"os,omitempty,flow"`
	Arch           []string `yaml:"arch,omitempty,flow"`
	Goroot         string   `yaml:"goroot,omitempty,flow"`
	PreAction      string   `yaml:"pre-action,omitempty"`       // bash script
	PostAction     string   `yaml:"post-action,omitempty"`      // bash script
	PreActionFile  string   `yaml:"pre-action-file,omitempty"`  // bash script
	PostActionFile string   `yaml:"post-action-file,omitempty"` // bash script
}

func NewCommon

func NewCommon() *Common

func (*Common) CloneFrom

func (c *Common) CloneFrom(from *Common)

type CommonBase

type CommonBase struct {
	OS   string `yaml:"-"` // just for string template expansion
	ARCH string `yaml:"-"` // just for string template expansion

	Ldflags    []string `yaml:"ldflags,omitempty,flow"`    // default ldflags is to get the smaller build for releasing
	Asmflags   []string `yaml:"asmflags,omitempty,flow"`   //
	Gcflags    []string `yaml:"gcflags,omitempty,flow"`    //
	Gccgoflags []string `yaml:"gccgoflags,omitempty,flow"` //
	Tags       []string `yaml:"tags,omitempty,flow"`       //
	// Cgo option
	Cgo bool `yaml:",omitempty"` //
	// Race option enables data race detection.
	//		Supported only on linux/amd64, freebsd/amd64, darwin/amd64, windows/amd64,
	//		linux/ppc64le and linux/arm64 (only for 48-bit VMA).
	Race bool `yaml:",omitempty"` //
	// Msan option enables interoperation with memory sanitizer.
	//		Supported only on linux/amd64, linux/arm64
	//		and only with Clang/LLVM as the host C compiler.
	//		On linux/arm64, pie build mode will be used.
	Msan          bool   `yaml:",omitempty"`               //
	Gocmd         string `yaml:",omitempty"`               // -gocmd go
	Gen           bool   `yaml:",omitempty"`               // go generate at first?
	Install       bool   `yaml:",omitempty"`               // install binary to $GOPATH/bin like 'go install' ?
	Debug         bool   `yaml:",omitempty"`               // true to produce a larger build with debug info
	DisableResult bool   `yaml:"disable-result,omitempty"` // no ll (Shell list) building result

	// -X for -ldflags,
	// -X importpath.name=value
	//    Set the value of the string variable in importpath named name to value.
	//    Note that before Go 1.5 this option took two separate arguments.
	//    Now it takes one argument split on the first = sign.
	Extends      []PackageNameValues `yaml:"extends,omitempty"` //
	CmdrSpecials bool                `yaml:"cmdr,omitempty"`
}

func (*CommonBase) CloneFrom

func (c *CommonBase) CloneFrom(from *CommonBase)

type Context

type Context struct {
	WorkDir    string
	TempDir    string
	PackageDir string

	// Output collects the target binary executable path pieces in building
	Output PathPieces

	*Common
	*Info
	*DynBuildInfo
}

func NewContext

func NewContext() *Context

type DynBuildInfo

type DynBuildInfo struct {
	ProjectName         string
	AppName             string
	Version             string // copied from Project.Version
	BgoGroupKey         string // project-group key in .bgo.yml
	BgoGroupLeadingText string // same above,
	HasGoMod            bool   //
	GoModFile           string //
	GOROOT              string // force using a special GOROOT
	Dir                 string
}

type Info

type Info struct {
	GoVersion   string // the result from 'go version'
	GitVersion  string // the result from 'git describe --tags --abbrev=0'
	GitRevision string // revision, git hash code, from 'git rev-parse --short HEAD'
	BuildTime   string //
	GOOS        string // a copy from runtime.GOOS
	GOARCH      string // a copy from runtime.GOARCH
	GOVERSION   string // a copy from runtime.Version()

	RandomString string
	RandomInt    int
	Serial       int
}

func NewBuildInfo

func NewBuildInfo() *Info

type PackageNameValues

type PackageNameValues struct {
	Package string            `yaml:"pkg,omitempty"`
	Values  map[string]string `yaml:"values,omitempty"`
}

type PathPieces

type PathPieces struct {
	Path    string
	Dir     string
	Base    string
	Ext     string
	AbsPath string
}

func (*PathPieces) Set

func (s *PathPieces) Set(file string)

type TargetPlatforms

type TargetPlatforms struct {
	// OsArchMap is a map by key OS and CPUArch
	OsArchMap map[string]map[string]bool `yaml:"os-arch-map"`
	// Sources is a map by key PackageName
	Sources map[string]*DynBuildInfo `yaml:"sources"`
}

func NewTargetPlatforms

func NewTargetPlatforms() *TargetPlatforms

func (*TargetPlatforms) FilterBy

func (ss *TargetPlatforms) FilterBy(scope string, forSlice, osSlice, archSlice []string)

func (*TargetPlatforms) SetOsArch

func (ss *TargetPlatforms) SetOsArch(os, arch string)

Jump to

Keyboard shortcuts

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