build

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuildSelectionEnvVar = "EMPIRICA_BUILD"
	DebugBuildEnvVar     = "EMPIRICA_DEBUG_BUILD"
	DownloadRootEnvVar   = "EMPIRICA_DOWNLOAD_ROOT"
	BinaryDirName        = "bin"
)
View Source
const (
	EmpiricaPackageName       = "@empirica/core"
	EmpiricaLatestReleasePath = "https://api.github.com/repos/empiricaly/empirica/releases/latest"
)

Variables

View Source
var (
	ErrBuildMissing        = errors.New("build info missing")
	ErrBuildEmpty          = errors.New("build info empty")
	ErrEmpiricaDirNotFound = errors.New("empirica dir not found")
)
View Source
var Branch string

Branch holds the git branch of the build.

View Source
var BuildNum string

BuildNum holds the build build (123).

View Source
var DevBuild string

DevBuild is "true" if this is a development build.

View Source
var ErrEmptyBuild = errors.New("empty build")
View Source
var ErrNoInstalledVersions = errors.New("no installed versions")

errNoInstalledVersions is returned when no versions are installed, which would imply we are running empirica without the proxy.

SHA holds the build Git commit SHA1.

Tag holds the git tag of the build.

View Source
var Time string

Time holds the build time.

Functions

func BinaryCacheDir added in v1.4.3

func BinaryCacheDir() string

The binary directory is where we store the downloaded binaries.

func BinaryPath added in v1.4.3

func BinaryPath(build *Build) (string, error)

func BinaryURL

func BinaryURL(build *Build) (*url.URL, error)

func BinaryVersionExists added in v1.4.3

func BinaryVersionExists(build *Build) (binpath string, exist bool, err error)

func CurrentLatestRelease added in v1.4.3

func CurrentLatestRelease() (string, error)

CurrentLatestRelease returns the latest version of empirica

func DownloadBinary

func DownloadBinary(build *Build) (string, error)

func DownloadRoot

func DownloadRoot() string

func FindEmpiricaDir added in v1.3.3

func FindEmpiricaDir() (empiricaPath, basePath string, err error)

func FindReleaseFilePath added in v1.3.3

func FindReleaseFilePath() (releaseFilePath, basePath string, err error)

func LookupBinary

func LookupBinary() (string, error)

func ReleaseFilePath

func ReleaseFilePath() string

func SaveReleaseFile

func SaveReleaseFile(dir string) error

func SaveReleaseFileVersion

func SaveReleaseFileVersion(dir string, build *Build) error

func Version

func Version() string

Version return the build version (vX.Y.Z) at build time. Returns "" if this build was not a tagged version.

func VersionJSON added in v1.6.1

func VersionJSON() ([]byte, error)

func VersionPath added in v1.4.3

func VersionPath(version string) string

func VersionString

func VersionString() string

func VersionsBasePath added in v1.4.3

func VersionsBasePath() string

Types

type Build

type Build struct {
	DevBuild string `json:"dev,omitempty" yaml:"dev,omitempty"`
	Version  string `json:"version,omitempty" yaml:"version,omitempty"`
	SHA      string `json:"sha,omitempty" yaml:"sha,omitempty"`
	BuildNum string `json:"build,omitempty" yaml:"build,omitempty"`
	Tag      string `json:"tag,omitempty" yaml:"tag,omitempty"`
	Branch   string `json:"branch,omitempty" yaml:"branch,omitempty"`
	Time     string `json:"time,omitempty" yaml:"time,omitempty"`
	// contains filtered or unexported fields
}

func Current

func Current() *Build

func FindCurrentBinaryVersion added in v1.4.3

func FindCurrentBinaryVersion() (*Build, error)

FindCurrentBinaryVersion returns which binary version should be used. It will try to in order to: - use environement variable override EMPIRICA_BUILD - look for the version lock in the .empirica/release file - use the latest installed version.

func GetBinaryBuild

func GetBinaryBuild(binpath string) (*Build, error)

func GetInstalledVersions added in v1.4.3

func GetInstalledVersions() ([]*Build, error)

func GetLatestInstalledVersion added in v1.4.3

func GetLatestInstalledVersion() (*Build, error)

func GetProjectRelease added in v1.3.3

func GetProjectRelease() (*Build, string, error)

Return project build and root path, or and error if we're not in a project or we could not parse the release file.

func NewDevBuild

func NewDevBuild() *Build

func NewProdBuild

func NewProdBuild() *Build

func NewVersionBuild added in v1.4.3

func NewVersionBuild(vers string) *Build

func Parse added in v1.4.3

func Parse(vstr string) (*Build, error)

func (*Build) Empty

func (b *Build) Empty() bool

func (*Build) PathComponents

func (b *Build) PathComponents(generic bool) (components []string, err error)

PathComponents returns all paths components (x/y/z) for this version: E.g. "version/v1.2.3", "sha/abcdefg", "build/123", "tag/v1.2.3", "branch/master".

func (*Build) PreferedPathComponent

func (b *Build) PreferedPathComponent() (components string, err error)

PreferedPathComponent returns the path component (x/y/z) that best identify this version, with the following precedence: - version - sha - build - tag - branch E.g. If version == "v1.2.3", then the path components are "version/v1.2.3".

func (*Build) Semver added in v1.4.3

func (b *Build) Semver() *semver.Version

func (*Build) String

func (b *Build) String() string

type Builds added in v1.4.3

type Builds []*Build

func (Builds) Len added in v1.4.3

func (b Builds) Len() int

func (Builds) Less added in v1.4.3

func (b Builds) Less(i, j int) bool

func (Builds) Swap added in v1.4.3

func (b Builds) Swap(i, j int)

type VersionComponent

type VersionComponent struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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