BuildScript
abstract class BuildScript : Obj
BuildScript is the base class for build scripts - it manages the command line interface, argument parsing, environment, and target execution.
See Build for details.
Log used for error reporting and tracing
The directory containing the this script
The source file of this script
Home directory of development installation
Apply a set of macro substitutions to the given pattern
Return this script's source file path
Get the key/value map of config props which are loaded from "etc/build/config.props"
Dump script environment for debug
Get a config prop which identifies a directory
Run the script with the specified arguments
Get a config property using the following rules
Get the list of published targets for this script
Log an error and return a FatalBuildErr instance
Lookup a target by name
Str applyMacros(Str pattern, Str:Str macros)
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.
Str? config(Str name, Str? def)
Get a config property using the following rules:
- Env.vars with
FAN_BUILD_$name.upper - Env.config for build pod
- fallback to
defparameter
File? configDir(Str name, File? def)
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.
Str:Str configs()
Get the key/value map of config props which are loaded from "etc/build/config.props".
const File : devHomeDir
Home directory of development installation. By default this value is initialized by devHome config prop, otherwise Env.homeDir is used.
virtual Void dumpEnv()
Dump script environment for debug.
FatalBuildErr fatal(Str msg, Err? err)
Log an error and return a FatalBuildErr instance
BuildLog : log
Log used for error reporting and tracing
Int main(Str[] args)
Run the script with the specified arguments. Return 0 on success or -1 on failure.
const File : scriptDir
The directory containing the this script
const File : scriptFile
The source file of this script
TargetMethod? target(Str name, Bool checked)
Lookup a target by name. If not found and checked is false return null, otherwise throw an exception.
virtual TargetMethod[] targets()
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.
virtual Str toStr()
Return this script's source file path.