Fantom

 

abstract class

build::BuildScript

sys::Obj
  build::BuildScript

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

const File binDir := this.devHomeDir + `bin/`

{devHomeDir}/bin/

configSource

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

Get a config property using the following rules:

  1. sys::Env.vars with FAN_BUILD_$name.upper
  2. sys::Env.config for build pod
  3. 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.

defaultTargetSource

virtual Target defaultTarget()

Return the default target to execute when this script is run. If this method is not overridden, then the default is to return the first target declared in the script itself.

devHomeDirSource

const File devHomeDir := ...

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

dumpEnvSource

@target = "Dump env details to help build debugging"
virtual Void dumpEnv()

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

libDirSource

const File libDir := this.devHomeDir + `lib/`

{devHomeDir}/lib/

libDotnetDirSource

const File libDotnetDir := this.devHomeDir + `lib/dotnet/`

{devHomeDir}/lib/dotnet

libFanDirSource

const File libFanDir := this.devHomeDir + `lib/fan/`

{devHomeDir}/lib/fan

libJavaDirSource

const File libJavaDir := this.devHomeDir + `lib/java/`

{devHomeDir}/lib/java

libJavaExtDirSource

const File libJavaExtDir := this.devHomeDir + `lib/java/ext/`

{devHomeDir}/lib/java/ext

libJavaExtPlatformDirSource

File libJavaExtPlatformDir := ...

{devHomeDir}/lib/java/ext/{Env.cur.platform}

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.

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.

scriptDirSource

const File scriptDir := this.scriptFile.parent

The directory containing the this script

scriptFileSource

const 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 := Target#.emptyList

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.