BuildScript is the base class for build scripts - it manages the command line interface, argument parsing, environment, and target execution.
See docTools::Build for details.
Slots
- configSource
-
Str? config(Str name, Str? def := null)
Get a config property using the following rules:
sys::Env.vars
withFAN_BUILD_$name.upper
sys::Env.config
for build pod- fallback to
def
parameter
- configDirSource
-
File? configDir(Str name, File? def := null)
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.
- devHomeDirSource
-
const File devHomeDir := ...
Home directory of development installation. By default this value is initialized by
devHome
config prop, otherwisesys::Env.homeDir
is used. - dumpEnvSource
-
virtual Void dumpEnv()
Dump script environment for debug.
- fatalSource
-
FatalBuildErr fatal(Str msg, Err? err := null)
Log an error and return a FatalBuildErr instance
- logSource
-
BuildLog log := BuildLog()
Log used for error reporting and tracing
- mainSource
-
Int main(Str[] args := Env.cur().args())
Run the script with the specified arguments. Return 0 on success or -1 on failure.
-
private TargetMethod[]? parseArgs(Str[] args)
Parse the arguments passed from the command line. Return true for success or false to end the script.
-
internal File[] resolveDirs(Uri[] uris)
Resolve a set of URIs to directories relative to scriptDir.
-
internal File[] resolveFiles(Uri[] uris)
Resolve a set of URIs to files relative to scriptDir.
-
internal File[] resolveFilesOrDirs(Uri[] uris)
Resolve a set of URIs to files/dirs relative to scriptDir.
- scriptDirSource
-
const File scriptDir := this.scriptFile.parent
The directory containing the this script
- scriptFileSource
-
const File scriptFile := ...
The source file of this script
- targetSource
-
TargetMethod? target(Str name, Bool checked := true)
Lookup a target by name. If not found and checked is false return null, otherwise throw an exception.
- targetsSource
-
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. - toStrSource
-
override Str toStr()
Overrides sys::Obj.toStr
Return this script's source file path.
-
private Void usage()
Dump usage including all this script's published targets.