Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

The default target, i.e. the target executed when no target is specified on the command line is specified by defining the target 'default'. So for example:

Code Block
target ( 'default' , 'The default target.' ) { aTarget ( ) }

This assumes aTarget exists!

Rather than requiring that the above mechanism is used, Gant provides a shortcut:

Code Block
setDefaultTarget ( aTarget )

What this actually does is:

Code Block
target ( 'default' : 'aTarget' ) { aTarget ( ) }

The convention of using the target name as the description is for creating the string at the end of the project help output (-p, --projecthelp, -T, --targets options to Gant).

The parameter to the setDefaultTarget call can be either the name of a target or a string that evaluates to the name of a target.  So for the above example we could have:

Code Block
setDefaultTarget ( 'aTarget' )

This allows great flexibility, possibly needless (smile) , in coding up defaults. For example:

Code Block
defaultTargetName = 'aTarget'
setDefaultTarget ( defaultTargetName )