Skip to content

build ​

原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793422862/FIN+5.3.1+build 中文整理基于 FIN 5.3.1

导读: Fantom 构建工具

以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。


目录(导读) ​

  • classes
  • facets
  • errs
  • Slot Details
    • clean
    • compile
    • dumpEnv
    • full
    • libs
    • output
    • skip
    • srcDirs
    • targetType
    • children
    • childrenScripts
    • runOnChildren
    • spawnOnChildren
    • targets
    • cp
    • jar
    • mainClass
    • packages
    • make
    • compileDotnet
    • compileFan
    • compileJava
    • compileJni
    • compileNodeJs
    • depends
    • dependsDir
    • docApi
    • docSrc
    • dotnetDirs
    • index
    • javaDirs
    • jniDirs
    • jniPlatforms
    • jsDirs
    • jsProps
    • meta
    • nodeJs
    • onCompileFan
    • outDocDir
    • outPodDir
    • podName
    • resDirs
    • summary
    • test
    • version
    • applyMacros
    • config
    • configDir
    • configs
    • devHomeDir
    • fatal
    • log
    • main
    • scriptDir
    • scriptFile
    • target
    • toStr
    • cscExe
    • dotnetHomeDir
    • run
    • src
    • cpAddExtJars
    • cpAddJars
    • outDir
    • params
    • lib
    • out
    • dir
    • filter
    • inDirs
    • outFile
    • pathPrefix
    • file
    • exePath
    • process
    • args
    • doEtcFiles
    • doReflect
    • doReflectPodManifest
    • mainMethod
    • mainMethodArg
    • podNames
    • jarExe
    • javaExe
    • javacExe
    • javadocExe
    • jdkBinDir
    • jdkHomeDir
    • rtJar
    • pods
    • rewrite
    • stripDocs
    • stripJs
    • stripSrc
    • help
    • method
    • name
    • script

API 正文(英文) ​

errs ​

FatalBuildErrFatalBuildErr is thrown to immediately terminate the current build script.

BuildCs ​

abstract class BuildCs : BuildScript

BuildCs is the base class for build scripts used to manage building C# source code into a .NET exe or dll.

Fields

libsList of libraries to link to.
outputRequired output file created by the compiler.
skipShould we skip compiling .NET code? Default only runs C# compiler if running on Windows.
srcDirsRequired list of directories to compile.
targetTypeRequired output type.

Methods

cleanDelete all intermediate and target files
compileCompile C# source into exe or dll
dumpEnv
fullRun clean, compile

Slot Details ​


clean ​

@Target { help=... } Void clean()

Delete all intermediate and target files


compile ​

@Target { help="Compile C# source into exe or dll" } Void compile()

Compile C# source into exe or dll


dumpEnv ​

virtual override Void dumpEnv()


full ​

@Target { help="Run clean, compile" } Void full()

Run clean, compile


libs ​

Uri[] libs := Uri[,]

List of libraries to link to.


output ​

Uri? output

Required output file created by the compiler.


skip ​

Bool skip := "win32"

Should we skip compiling .NET code? Default only runs C# compiler if running on Windows.


srcDirs ​

Uri[]? srcDirs

Required list of directories to compile. All C# source files in each directory will be compiled.


targetType ​

Str? targetType

Required output type. Possible values are exe, winexe, library or module.


BuildGroup ​

abstract class BuildGroup : BuildScript

BuildGroup is the base class for build scripts which compose a set of children build scripts into a single group. The target's of a BuildGroup are the union of the target names available in the children scripts.

Fields

childrenScriptsRequired list of Uris relative to this scriptDir of Fantom build script files to group together.

Methods

childrenCompiled children scripts
dumpEnv
runOnChildrenRun the specified target name on each of the children scripts that support the specified name.
spawnOnChildrenRun the specified target name on each of the children scripts that support the specified name.
targetsBuildGroup publishes the union by name of it's children script targets plus any of its own targets.

Slot Details ​


children ​

BuildScript[] children()

Compiled children scripts


childrenScripts ​

Uri[] childrenScripts := Uri[,]

Required list of Uris relative to this scriptDir of Fantom build script files to group together.


dumpEnv ​

virtual override Void dumpEnv()


runOnChildren ​

virtual Void runOnChildren(Str targetName)

Run the specified target name on each of the children scripts that support the specified name.


spawnOnChildren ​

virtual Void spawnOnChildren(Str targetName)

Run the specified target name on each of the children scripts that support the specified name. Unlike runOnChildren this method actually spawns a new process to run the child script.


targets ​

virtual override TargetMethod[] targets()

BuildGroup publishes the union by name of it's children script targets plus any of its own targets.


BuildJava ​

abstract class BuildJava : BuildScript

BuildJava is the base class for build scripts used to manage building Java source code into a Java jar file.

Fields

cpList of files to include in compiler classpath.
jarRequired target jar file to build
mainClassMain class name to add to manifest if not null.
packagesRequired list of dotted package names to compile.

Methods

cleanDelete all intermediate and target files
compileCompile Java source into jar
dumpEnv
fullRun clean, compile

Slot Details ​


clean ​

@Target { help=... } Void clean()

Delete all intermediate and target files


compile ​

@Target { help="Compile Java source into jar" } Void compile()

Compile Java source into jar


cp ​

Uri[]? cp

List of files to include in compiler classpath. The core Java rt.jar is always implied and should not be specified. These URIs are relative to the script dir.


dumpEnv ​

virtual override Void dumpEnv()


full ​

@Target { help="Run clean, compile" } Void full()

Run clean, compile


jar ​

Uri? jar

Required target jar file to build


mainClass ​

Str? mainClass

Main class name to add to manifest if not null.


packages ​

Str[]? packages

Required list of dotted package names to compile. Each of these packages must have a corresponding source directory relative to the script directory.


BuildLog ​

class BuildLog : CompilerLog

BuildLog is used for logging build scripts

Constructors

make

Slot Details ​


make ​

new make(OutStream out := Env.cur().out())


BuildPod ​

abstract class BuildPod : BuildScript

BuildPod is the base class for build scripts used to manage building a Fantom source code and resources into a Fantom pod.

See Build for details.

Fields

dependsList of dependencies for pod formatted as Depend.
dependsDirThe directory to look in for the dependency pod file (and potentially their recursive dependencies).
docApiIndicates if if fandoc API should be included in the documentation.
docSrcIndicates if if source code should be included in the pod/documentation.
dotnetDirsList of Uris relative to build script of directories containing the C# source files to compile for .NET native methods.
indexPod index name/value pairs to compile into pod.
javaDirsList of Uris relative to build script of directories containing the Java source files to compile for Java native methods.
jniDirsList of Uris relative to build script of directories containing the JNI C source files to compile.
jniPlatformsIf non-null, whitelist of platforms JNI should be enabled for.
jsDirsList of Uris relative to build script of directories containing the JavaScript source files to compile for JavaScript native methods.
jsPropsList of Uris relative to build script that should be searched for .props files to compile to JavaScript.
metaPod meta-data name/value pairs to compile into pod.
outDocDirDirectory to output documentation (docs always get placed in sub-directory named by pod).
outPodDirDirectory to output pod file.
podNameRequired name of the pod.
resDirsList of optional Uris relative to build script of directories of resources files to package into pod zip file.
srcDirsList of Uris relative to build script of directories containing the Fan source files to compile.
summaryRequired summary description of pod.
versionVersion of the pod - default is set to BuildScript.config prop buildVersion.

Methods

cleanDelete all intermediate and target files
compileCompile the source into a pod file and all associated natives.
compileDotnetCompile native .NET assembly dotnetDirs configured
compileFanCompile Fan code into pod file
compileJavaCompile Java class files if javaDirs is configured
compileJniCompile JNI bindings if jniDirs configured.
compileNodeJsCompile to javascript node module
fullRun clean, compile, and test
nodeJsCompile to all classes to run in Node.js
onCompileFanCallback to tune the Fantom compiler input
testRun the unit tests using fant for this pod

Slot Details ​


clean ​

@Target { help=... } virtual Void clean()

Delete all intermediate and target files


compile ​

@Target { help=... } virtual Void compile()

Compile the source into a pod file and all associated natives. See compileFan, compileJava, and compileDotnet.


compileDotnet ​

virtual Void compileDotnet()

Compile native .NET assembly dotnetDirs configured


compileFan ​

virtual Void compileFan()

Compile Fan code into pod file


compileJava ​

virtual Void compileJava()

Compile Java class files if javaDirs is configured


compileJni ​

virtual Void compileJni()

Compile JNI bindings if jniDirs configured.


compileNodeJs ​

virtual Void compileNodeJs()

Compile to javascript node module


depends ​

Str[] depends := Str[,]

List of dependencies for pod formatted as Depend. Strings are automatically run through BuildScript.applyMacros.


dependsDir ​

Uri? dependsDir := null

The directory to look in for the dependency pod file (and potentially their recursive dependencies). If null then we use the compiler's own pod definitions via reflection (which is more efficient). As a general rule you shouldn't mess with this field - it is used by the build and compiler build scripts for bootstrap build.


docApi ​

Bool docApi := true

Indicates if if fandoc API should be included in the documentation. By default API is included.


docSrc ​

Bool docSrc := false

Indicates if if source code should be included in the pod/documentation. By default source code it not included.


dotnetDirs ​

Uri[]? dotnetDirs

List of Uris relative to build script of directories containing the C# source files to compile for .NET native methods.


full ​

@Target { help="Run clean, compile, and test" } virtual Void full()

Run clean, compile, and test


index ​

Str:Obj index := [Str:Obj][:]

Pod index name/value pairs to compile into pod. See Env.index. The index values can be a single Str or a Str[] if there are multiple values mapped to one key.


javaDirs ​

Uri[]? javaDirs

List of Uris relative to build script of directories containing the Java source files to compile for Java native methods.


jniDirs ​

Uri[]? jniDirs

List of Uris relative to build script of directories containing the JNI C source files to compile.


jniPlatforms ​

Str[]? jniPlatforms

If non-null, whitelist of platforms JNI should be enabled for. Platform string may be full platform name ("macosx-x86_64") or OS only ("macosx").


jsDirs ​

Uri[]? jsDirs

List of Uris relative to build script of directories containing the JavaScript source files to compile for JavaScript native methods.


jsProps ​

Uri[]? jsProps

List of Uris relative to build script that should be searched for .props files to compile to JavaScript. You may also give relative paths to files with a .props ext. If this field is null, it defaults to resDirs.


meta ​

Str:Str meta := ...

Pod meta-data name/value pairs to compile into pod. See Pod.meta.


nodeJs ​

@Target { help="Compile all types to run in Node.js" } virtual Void nodeJs()

Compile to all classes to run in Node.js


onCompileFan ​

virtual Void onCompileFan(CompilerInput ci)

Callback to tune the Fantom compiler input


outDocDir ​

Uri outDocDir := Env.cur().workDir().plus(`doc/`).uri

Directory to output documentation (docs always get placed in sub-directory named by pod). By default it goes into "{Env.cur.workDir}/doc/"


outPodDir ​

Uri outPodDir := Env.cur().workDir().plus(`lib/fan/`).uri

Directory to output pod file. By default it goes into "{Env.cur.workDir}/lib/fan/"


podName ​

Str? podName := null

Required name of the pod.


resDirs ​

Uri[]? resDirs

List of optional Uris relative to build script of directories of resources files to package into pod zip file. If a file has a "jar" extension then its contents are unzipped into the target pod.


srcDirs ​

Uri[]? srcDirs

List of Uris relative to build script of directories containing the Fan source files to compile.


summary ​

Str? summary := null

Required summary description of pod.


test ​

@Target { help="Run the pod unit tests via fant" } virtual Void test()

Run the unit tests using fant for this pod


version ​

Version version := ...

Version of the pod - default is set to BuildScript.config prop buildVersion.


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.

Fields

devHomeDirHome directory of development installation.
logLog used for error reporting and tracing
scriptDirThe directory containing the this script
scriptFileThe source file of this script

Methods

applyMacrosApply a set of macro substitutions to the given pattern.
configGet a config property using the following rules
configDirGet a config prop which identifies a directory.
configsGet the key/value map of config props which are loaded from "etc/build/config.props".
dumpEnvDump script environment for debug.
fatalLog an error and return a FatalBuildErr instance
mainRun the script with the specified arguments.
targetLookup a target by name.
targetsGet the list of published targets for this script.
toStrReturn this script's source file path.

Slot Details ​


applyMacros ​

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

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)

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)

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()

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


devHomeDir ​

const File devHomeDir := ...

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


dumpEnv ​

virtual Void dumpEnv()

Dump script environment for debug.


fatal ​

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

Log an error and return a FatalBuildErr instance


log ​

BuildLog log := BuildLog.<ctor>()

Log used for error reporting and tracing


main ​

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

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


scriptDir ​

const File scriptDir := this.scriptFile.parent

The directory containing the this script


scriptFile ​

const File scriptFile := ...

The source file of this script


target ​

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.


targets ​

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.


toStr ​

virtual override Str toStr()

Return this script's source file path.


CompileCs ​

class CompileCs : Task

Run the C# compiler to produce an exe or dll.

Constructors

makeInitialize the .NET environment fields for csc.exe.

Fields

cscExeC# compiler executable: {dotnetHomeDir}/csc.exe
dotnetHomeDirHome directory for .NET installation configured via config prop
libsList of dll libraries to link in
outputOutput file created by the compiler.
srcList of source files or directories to compile
targetTypeOutput target type

Methods

runRun the csc task

Slot Details ​


cscExe ​

File cscExe

C# compiler executable: {dotnetHomeDir}/csc.exe


dotnetHomeDir ​

File? dotnetHomeDir

Home directory for .NET installation configured via config prop


libs ​

File[]? libs

List of dll libraries to link in


make ​

new make(BuildScript script)

Initialize the .NET environment fields for csc.exe.


output ​

File? output

Output file created by the compiler.


run ​

virtual override Void run()

Run the csc task


src ​

File[] src := File[,]

List of source files or directories to compile


targetType ​

Str? targetType

Output target type


CompileJava ​

class CompileJava : JdkTask

Run the Java compiler to produce a directory of Java classfiles.

Constructors

makeConstruct uninitialized javac task

Fields

cpClass path - list of jars to compile against, rt.jar is automatically included
outDirOutput directory
paramsExtra parameters to pass to javac.
srcList of source files or directories to compile.

Methods

cpAddExtJarsAdd all the jars found in lib/java/ext and lib/java/ext/os to the class path.
cpAddJarsAdd all the jar files found in the specified directory to the classpath.
runRun the javac task

Slot Details ​


cp ​

File[] cp := File[,]

Class path - list of jars to compile against, rt.jar is automatically included


cpAddExtJars ​

Void cpAddExtJars()

Add all the jars found in lib/java/ext and lib/java/ext/os to the class path.


cpAddJars ​

Void cpAddJars(File dir)

Add all the jar files found in the specified directory to the classpath.


make ​

new make(BuildScript script)

Construct uninitialized javac task


outDir ​

File? outDir

Output directory


params ​

Str[] params

Extra parameters to pass to javac. Default is to target 1.5 classfiles.


run ​

virtual override Void run()

Run the javac task


src ​

File[] src := File[,]

List of source files or directories to compile. If a directory is specified, then it is recursively searched for all ".java" files.


CompileJni ​

class CompileJni : Task

Compile JNI C source code.

Constructors

makeConstructor.

Fields

libLibrary for compiler output.
outOutput directory for compiler.
srcList of source files or directories to compile

Methods

runRun JNI task

Slot Details ​


lib ​

Str? lib

Library for compiler output.


make ​

new make(BuildScript script)

Constructor.


out ​

File? out

Output directory for compiler.


run ​

virtual override Void run()

Run JNI task


src ​

File[] src := File[,]

List of source files or directories to compile


CreateDir ​

class CreateDir : Task

CreateDir is used to create a directory

Constructors

make

Fields

dir

Methods

run

Slot Details ​


dir ​

File dir


make ​

new make(BuildScript script, File dir)


run ​

virtual override Void run()


CreateZip ​

class CreateZip : Task

CreateZip is used to create a zip file from a directory on the file system.

Constructors

make

Fields

filterThis function is called on each file under inDir; if true returned it is included in the zip, if false then it is excluded.
inDirsRequired directories to zip up.
outFileRequired output zip file to create
pathPrefixSpecifies the top level directory inside the zip file prefixed to all the files.

Methods

run

Slot Details ​


filter ​

|File,Str->Bool| filter

This function is called on each file under inDir; if true returned it is included in the zip, if false then it is excluded. Returning false for a directory will skip recursing the entire directory.


inDirs ​

File[]? inDirs

Required directories to zip up. The contents of these dirs are recursively zipped up with zip paths relative to this root directory.


make ​

new make(BuildScript script)


outFile ​

File? outFile

Required output zip file to create


pathPrefix ​

Uri? pathPrefix := null

Specifies the top level directory inside the zip file prefixed to all the files. For example use acme/ to put everything inside the zip file inside a "acme" directory. The URI used must end with a slash. If null, then no path prefix is used.


run ​

virtual override Void run()


Delete ​

class Delete : Task

Delete is used to delete a file or directory.

Constructors

make

Fields

file

Methods

run

Slot Details ​


file ​

File file


make ​

new make(BuildScript script, File file)


run ​

virtual override Void run()


Exec ​

class Exec : Task

Exec is used to run an external OS process

Constructors

make

Fields

process

Methods

exePathGiven a executable file turn it into a path to use for Exec
run

Slot Details ​


exePath ​

static Str exePath(File exe)

Given a executable file turn it into a path to use for Exec:

  • if running on Window's add the .exe extension
  • return File.osPath

make ​

new make(BuildScript script, Str[] cmd, File? dir := null)


process ​

Process process


run ​

virtual override Void run()


FanScript ​

class FanScript : Task

FanScript is used to compile a Fantom script into memory and run it via reflection.

Constructors

makeMake with script name, arguments are Fantom arguments passed to main method (**not** command line string arguments)

Fields

args
file

Methods

compile
run

Slot Details ​


args ​

Obj[] args


compile ​

Pod compile()


file ​

File file


make ​

new make(BuildScript script, File file, Obj[]? args := null)

Make with script name, arguments are Fantom arguments passed to main method (**not** command line string arguments)


run ​

virtual override Void run()


FatalBuildErr ​

const class FatalBuildErr : Err

FatalBuildErr is thrown to immediately terminate the current build script.

Constructors

make

Slot Details ​


make ​

new make(Str msg := "", Err? cause := null)


JarDist ​

class JarDist : JdkTask

JarDist compiles a set of Fantom pods into a single Java JAR file.

Constructors

makeConstruct uninitialized task

Fields

mainMethodQualified name of main method to run for JAR.
mainMethodArgDoes the main method accept a Str[] arg
outFileRequired output jar file to create
podNamesList of pods to compile into JAR; sys is always implied

Methods

doEtcFiles
doReflect
doReflectPodManifest
runRun the javac task

Slot Details ​


doEtcFiles ​

static Void doEtcFiles(File homeDir, |Uri,File| onFile)


doReflect ​

static Void doReflect(Str podName, File podFile, |Uri,File->Bool| onFile)


doReflectPodManifest ​

static Void doReflectPodManifest(Str[] podNames, |Uri,File| onFile)


mainMethod ​

Str? mainMethod

Qualified name of main method to run for JAR. This must be a static void method with no arguments.


mainMethodArg ​

Bool mainMethodArg

Does the main method accept a Str[] arg


make ​

new make(BuildScript script)

Construct uninitialized task


outFile ​

File? outFile

Required output jar file to create


podNames ​

Str[] podNames := Str[,]

List of pods to compile into JAR; sys is always implied


run ​

virtual override Void run()

Run the javac task


JdkTask ​

class JdkTask : Task

Java Developer Kit task provides a common set of environment variables for the Java environment.

Constructors

makeInitialize the JDK environment fields.

Fields

jarExeJar (Java Archive) executable: {jdkBinDir}/jar
javaExeJava runtime executable: {jdkBinDir}/java
javacExeJavac compiler executable: {jdkBinDir}/javac
javadocExeJavadoc executable: {jdkBinDir}/javadoc
jdkBinDirJDK bin for executables: {jdkHomeDir}/bin/
jdkHomeDirHome directory for jdk installation configured via config prop jdkHome
rtJarStandard runtime library jar file: {jdkHomeDir}/jre/lib/rt.jar

Methods

runRun not implemented

Slot Details ​


jarExe ​

Str jarExe

Jar (Java Archive) executable: {jdkBinDir}/jar


javaExe ​

Str javaExe

Java runtime executable: {jdkBinDir}/java


javacExe ​

Str javacExe

Javac compiler executable: {jdkBinDir}/javac


javadocExe ​

Str javadocExe

Javadoc executable: {jdkBinDir}/javadoc


jdkBinDir ​

File jdkBinDir

JDK bin for executables: {jdkHomeDir}/bin/


jdkHomeDir ​

File jdkHomeDir

Home directory for jdk installation configured via config prop jdkHome


make ​

new make(BuildScript script)

Initialize the JDK environment fields.


rtJar ​

File rtJar

Standard runtime library jar file: {jdkHomeDir}/jre/lib/rt.jar


run ​

virtual override Void run()

Run not implemented


PodRewrite ​

class PodRewrite : Task

PodRewrite is used to update the contents of one or more pod files. It can be used to strip javascript, source code, and docs. However it cannot strip test code - that requires a recompile from source with the stripTest flag.

Constructors

makeConstruct uninitialized task

Fields

outDirRequired output directory to place rewritten pods
podsList of pod files or pod names to rewrite
stripDocsRemove pod's documentation: pod.fandoc and all api docs
stripJsRemove pod's JavaScript files: "pod.js" and "pod.js.map"
stripSrcRemove pod's source code if bundled into the pod zip

Methods

rewriteRewrite the given pod file with the configured options
runRun the task

Slot Details ​


make ​

new make(BuildScript script)

Construct uninitialized task


outDir ​

File? outDir

Required output directory to place rewritten pods


pods ​

Obj[] pods := Obj[,]

List of pod files or pod names to rewrite


rewrite ​

Void rewrite(File podFile, OutStream out)

Rewrite the given pod file with the configured options


run ​

virtual override Void run()

Run the task


stripDocs ​

Bool stripDocs

Remove pod's documentation: pod.fandoc and all api docs


stripJs ​

Bool stripJs

Remove pod's JavaScript files: "pod.js" and "pod.js.map"


stripSrc ​

Bool stripSrc

Remove pod's source code if bundled into the pod zip


Target ​

@Serializable facet class Target : Obj, Facet

Target facet is applied to a BuildScript method to indicate it is a build target or goal.

Fields

helpString for usage help, should be a single short line summary of target

Slot Details ​


help ​

const Str help := ""

String for usage help, should be a single short line summary of target


TargetMethod ​

class TargetMethod : Obj

TargetMethod wraps a build target method which may be executed independently within a build script. Targets are the top level unit for organizing build scripts - each script publishes its available targets via BuildScript.targets.

Constructors

makeConstruct a target to run under the specified build script.

Fields

methodMethod to invoke when this target is executed.
scriptReturn the parent build script associated with this task.

Methods

helpSummary description for usage help, derived from Target facet on method.
nameMethod of the target.
runRun this target by invoking the target's method.
toStrReturn name.

Slot Details ​


help ​

virtual Str help()

Summary description for usage help, derived from Target facet on method.


make ​

new make(BuildScript script, Method method)

Construct a target to run under the specified build script. The name is the key used to invoke this target from the command line. Description is used for usage summary. Func is invoked when this target is executed.


method ​

Method method { private set }

Method to invoke when this target is executed.


name ​

virtual Str name()

Method of the target.


run ​

virtual Void run()

Run this target by invoking the target's method. If the target fails to run then it should report errors via the log and throw FatalBuildErr.


script ​

BuildScript script { private set }

Return the parent build script associated with this task.


toStr ​

virtual override Str toStr()

Return name.


Task ​

abstract class Task : Obj

Task is the base class for commands to run in build scripts. The library of Task subclasses represent the reusable units of work which are composed together to implement build script Targets.

Constructors

makeConstruct with parent script.

Fields

scriptReturn the parent build script associated with this task.

Methods

fatalLog an error and return a FatalBuildErr instance
logConvenience for script.log
runRun this task.

Slot Details ​


fatal ​

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

Log an error and return a FatalBuildErr instance


log ​

BuildLog log()

Convenience for script.log


make ​

new make(BuildScript script)

Construct with parent script.


run ​

abstract Void run()

Run this task. If there is an error, the report them via the script's log and throw FatalBuildErr if the script should be terminated.


script ​

BuildScript script { private set }

Return the parent build script associated with this task.