model

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: GPL-3.0 Imports: 3 Imported by: 5

Documentation

Overview

Package model contains the overall model of representable entities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	// OutDir is the path where build outputs are located, relative to some base directory.
	OutDir string
}

Environment describes the current build environment.

func (Environment) InternalDir

func (e Environment) InternalDir() string

type File

type File struct {
	// RelPath is the relative path to the file.
	RelPath string

	// FromSourceDir marks the file as being from the source directory.
	FromSourceDir bool
}

File wraps a file source.

func (File) Path

func (f File) Path(env *Environment) string

Path returns the actual path to the file, relative to the base directory.

type Filegroup

type Filegroup []File

A Filegroup is just a list of files.

type Filegroups

type Filegroups map[string]Filegroup

Filegroups contains named file groups.

func (Filegroups) Paths

func (fgs Filegroups) Paths(env *Environment) map[string][]string

Paths resolves all the paths in a Filegroups.

type Inputs

type Inputs map[string]OutputRefs

Inputs contains references to rules.

func (Inputs) Filegroups

func (i Inputs) Filegroups() Filegroups

Filegroups returns all input filegroups.

type OutputRef

type OutputRef struct {
	// Target points to the target the output.
	Target *Target

	// FilegroupName refers to he file group.
	FilegroupName string
}

An OutputRef indexes into a target for a file group.

func (OutputRef) Filegroup

func (or OutputRef) Filegroup() Filegroup

Filegroup returns the referenced Filegroup.

type OutputRefs

type OutputRefs []OutputRef

func (OutputRefs) Filegroup

func (ors OutputRefs) Filegroup() Filegroup

Filegroup returns a flattened filegroup of all outputs in OutputRefs.

type Rule

type Rule struct {
	// Description is a friendly name for the rule.
	Description string

	// Volatile rules are always rebuilt, regardless of their inputs changing or not.
	Volatile bool

	// Command returns command lines to run to generate outputs from inputs.
	Command func(inputPaths map[string][]string, outputPaths map[string][]string, annotations map[string]interface{}) (string, error)
}

A Rule describes how to build a target.

type Target

type Target struct {
	// Rule that will map inputs to outputs.
	Rule *Rule

	// Inputs that will be provided to generate outputs.
	Inputs Inputs

	// Outputs that will be generated from inputs.
	Outputs Filegroups

	// Any additional annotations to consider during execution of the rule.
	Annotations map[string]interface{}
}

A Target describes an entity that is mapped from inputs to outputs.

func (*Target) Command

func (t *Target) Command(env *Environment) (string, error)

Command returns the commands to run for a target.

func (*Target) Describe

func (t *Target) Describe(env *Environment) string

Jump to

Keyboard shortcuts

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