burrow

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package burrow contains utilities used for the burrow build system.

Index

Constants

View Source
const (
	// Burrow encountered no error, all actions were successful.
	EXIT_SUCCESS int = iota

	// Burrow encountered an error while reading the burrow.yaml.
	EXIT_CONFIG

	// Burrow encountered an error while running the specified action.
	EXIT_ACTION
)

The EXIT_... constants describe the exit codes of burrow.

Variables

This section is empty.

Functions

func Deprecation added in v0.5.0

func Deprecation(target string, args ...[]string)

Deprecation marks a target for deprecation and provide underlying commands as args to the deprecation log.

func Exec

func Exec(target string, comm string, args ...string) error

Exec runs a given command (comm) with arguments (args) and redirects all output of stderr and stdout to a logger with the given target as logging target (tag/name). When the target is "" (empty string) stdout and stderr of the command will be directly mapped to the stdout and stderr of the application.

func ExecDir added in v0.3.0

func ExecDir(target string, dir string, comm string, args ...string) error

ExecDir runs a given command (comm) with arguments (args) inside a given directory (dir) and redirects all output of stderr and stdout to a logger with the given target as logging target (tag/name). When the target is "" (empty string) stdout and stderr of the command will be directly mapped to the stdout and stderr of the application.

func GetCodefiles

func GetCodefiles() []string

GetCodefiles returns a string array containing all paths of files that contain code inside the current burrow project.

func GetCodefilesWithMtime

func GetCodefilesWithMtime(outputs []string) map[string]int64

GetCodefilesWithMtime returns a map containing all paths of files that contain code inside the current burrow project. The paths get mapped to Unix modification times. The outputs parameter should contain additional non-code files that should also be contained in the map.

func GetSecondLevelArgs

func GetSecondLevelArgs() cli.Args

GetSecondLevelArgs returns the command line arguments that are located after a double dash (--).

func IsTargetUpToDate

func IsTargetUpToDate(target string, outputs []string) bool

IsTargetUpToDate checks whether a given build target is up-to-date. This means that all build artifacts of the target were created from data with the same timestamp as the currently available sources.

The outputs parameter specifies which files are created (artifacts) by the target. If these files are not available all cache data is invalid.

func LoadConfig

func LoadConfig()

LoadConfig loads the content of the burrow.yaml into the global Config variable and sets the isConfigLoaded flag on success.

func Log

func Log(level LogLevel, target string, format string, args ...interface{})

Log writes a log message to stderr which will be colored by the given log level and prefixed with the given target. The format parameter is a fmt.Printf parameter following the args for formatting.

func LogDeprecationMessage added in v0.5.0

func LogDeprecationMessage()

LogDeprecationMessage logs all accumulated deprecation messages to the console.

func SaveConfig added in v0.2.0

func SaveConfig()

SaveConfig save the current project configuration to the burrow.yaml.

func UpdateTarget

func UpdateTarget(target string, outputs []string)

UpdateTarget updates the cache of a target to match the timestamps of all currently available sources. The outputs parameter specifies which files are created (artifacts) by the target. Timestamps of the artifacts will also be stored.

func WrapAction added in v0.0.12

func WrapAction(action func(*cli.Context, bool) error) func(*cli.Context) error

WrapAction sets the useSecondLevelArgs of an action to true by default.

Types

type Configuration

type Configuration struct {
	Name        string
	Version     string
	Description string
	Authors     []string
	License     string
	Package     struct {
		Include []string
	}
	Args struct {
		Run string
		Go  struct {
			Test  string
			Build string
			Doc   string
			Vet   string
			Fmt   string
			Get   string
		}
		Git struct {
			Tag   string
			Clone string
		}
	}
}

The Configuration struct describes the layout of the burrow.yaml.

var Config Configuration = Configuration{}

Config is the global instance of the Configuration struct and contains the parsed data of the burrow.yaml.

type LogLevel

type LogLevel int

The LogLevel type describes the log level of a log message.

const (
	LOG_INFO LogLevel = iota
	LOG_WARN
	LOG_ERR
)

The LOG_... constants describe log level of a log message.

type Logger

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

The Logger struct holds a logger instance for output redirection.

func NewLogger

func NewLogger(target string, level LogLevel) Logger

NewLogger creates a new logger instance that can be used to redirect streams and produce log message.

func (Logger) Write

func (log Logger) Write(payload []byte) (int, error)

Jump to

Keyboard shortcuts

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