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
- binDirSource
-
File binDir
{devHomeDir}/bin/
- defaultTargetSource
-
abstract Target defaultTarget()
Return the default target to execute when this script is run.
- devHomeDirSource
-
File devHomeDir
Home directory of development installation. By default this value is initialized by Sys.env["fan.build.devHome"], otherwise Sys.homeDir is used.
- exeExtSource
-
Str exeExt
Executable extension: ".exe" on Windows and "" on Unix.
- fatalSource
-
FatalBuildErr fatal(Str msg, Err? err := null)
Log an error and return a FatalBuildErr instance
- globalVersionSource
-
Version globalVersion
This is the global default version to use when building pods. It is initialized by Sys.env["fan.build.globalVersion"], otherwise "0.0.0" is used as a default.
-
private Void initEnv()
Initialize the environment
-
internal Bool isWindows
Are we running on a Window's box
- libDirSource
-
File libDir
{devHomeDir}/lib/
- libFanDirSource
-
File libFanDir
{devHomeDir}/lib/fan
- libJavaDirSource
-
File libJavaDir
{devHomeDir}/lib/java
- libJavaExtDirSource
-
File libJavaExtDir
{devHomeDir}/lib/java/ext
- libJavaExtOsDirSource
-
File libJavaExtOsDir
{devHomeDir}/lib/java/ext/{os} or null if unknown. Currently we map to os:
- Windows => "win"
- MAC OS X => "mac"
- Linux => "linux"
- libNetDirSource
-
File libNetDir
{devHomeDir}/lib/net
- logSource
-
BuildLog log
Log used for error reporting and tracing
- mainSource
-
Int main(Str[] args := Sys.args())
Run the script with the specified arguments. Return 0 on success or -1 on failure.
- makeSource
-
new make()
Construct a new build script.
- makeTargetsSource
-
virtual Target[] makeTargets()
This callback is invoked by the
BuildScript
constructor after the call to setup to initialize the list of the targets this script publishes. The list of targets is built from all the methods annotated with the "target" facet. The "target" facet should have a string value with a description of what the target does. -
private Bool parseArgs(Str[] args)
Parse the arguments passed from the command line. Return true for success or false to end the script.
-
internal File? resolveDir(Uri? uri, Bool nullOk := false)
Convert a Uri to a directory and verify it exists.
-
internal File?[] resolveDirs(Uri?[]? uris, Bool nullOk := false)
Convert a list of Uris to directories and verify they all exist.
-
internal File? resolveFile(Uri? uri, Bool nullOk := false)
Convert a Uri to a file and verify it exists.
-
internal File?[] resolveFiles(Uri?[]? uris, Bool nullOk := false)
Convert a list of Uris to files and verify they all exist.
-
private File?[] resolveUris(Uri?[]? uris, Bool nullOk, Bool expectDir)
- scriptDirSource
-
File scriptDir
The directory containing the this script
- scriptFileSource
-
File scriptFile
The source file of this script
- setupSource
-
virtual Void setup()
The setup callback is invoked before creating or processing of any targets to ensure that the BuildScript is correctly initialized. If the script cannot be setup then report errors via the log and throw FatalBuildErr to terminate the script.
- targetSource
-
Target? target(Str name, Bool checked := true)
Lookup a target by name. If not found and checked is false return null, otherwise throw an exception. This method cannot be called until after the script has completed its constructor.
- targetsSource
-
readonly Target[] targets
Targets available on this script (see makeTargets)
- toRunSource
-
Target[] toRun
Targets specified to run by command line
- 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.
-
virtual internal Void validate()
Internal callback to validate setup
-
internal Bool validateReqField(Str field)
Check that the specified field is non-null, if not then log an error and return false.