abstract class build::BuildScript

sys::Obj
  build::BuildScript

Source

BuildScript is the base class for build scripts - it manages the command line interface, argument parsing, environment, and target execution.

See Build for details.

applyMacros

Str applyMacros(Str pattern, Str:Str macros := this.configs())

Source

Apply a set of macro substitutions to the given pattern. Substitution keys are indicated in the pattern using "@{key}" and replaced by definition in macros map. If a substitution key is undefined then raise an exception. The configs method is used for default macro key/value map.

config

Str? config(Str name, Str? def := null)

Source

Get a config property using the following rules:

  1. Env.vars with FAN_BUILD_$name.upper
  2. Env.config for build pod
  3. fallback to def parameter
configDir

File? configDir(Str name, File? def := null)

Source

Get a config prop which identifies a directory. If the prop isn't configured or doesn't map to a valid directory, then return def.

configs

Str:Str configs()

Source

Get the key/value map of config props which are loaded from "etc/build/config.props".

devHomeDir

const File devHomeDir := ...

Source

Home directory of development installation. By default this value is initialized by devHome config prop, otherwise Env.homeDir is used.

dumpEnv

virtual Void dumpEnv()

Source

Dump script environment for debug.

fatal

FatalBuildErr fatal(Str msg, Err? err := null)

Source

Log an error and return a FatalBuildErr instance

log

BuildLog log := BuildLog.<ctor>()

Source

Log used for error reporting and tracing

main

Int main(Str[] args := Env.cur().args())

Source

Run the script with the specified arguments. Return 0 on success or -1 on failure.

scriptDir

const File scriptDir := this.scriptFile.parent

Source

The directory containing the this script

scriptFile

const File scriptFile := ...

Source

The source file of this script

target

TargetMethod? target(Str name, Bool checked := true)

Source

Lookup a target by name. If not found and checked is false return null, otherwise throw an exception.

targets

virtual TargetMethod[] targets()

Source

Get the list of published targets for this script. The first target should be the default. The list of targets is defined by all the methods with the Target facet.

toStr

virtual override Str toStr()

Source

Return this script's source file path.