logo

abstract class

build::Task

sys::Obj
  build::Task
  1  //
  2  // Copyright (c) 2006, Brian Frank and Andy Frank
  3  // Licensed under the Academic Free License version 3.0
  4  //
  5  // History:
  6  //   4 Nov 06  Brian Frank  Creation
  7  //
  8  
  9  **
 10  ** Task is the base class for commands to run in build scripts.
 11  ** The library of Task subclasses represent the reusable units of
 12  ** work which are composed together to implement build script
 13  ** Targets.
 14  **
 15  abstract class Task
 16  {
 17  
 18  //////////////////////////////////////////////////////////////////////////
 19  // Construction
 20  //////////////////////////////////////////////////////////////////////////
 21  
 22    **
 23    ** Construct with parent script.
 24    **
 25    new make(BuildScript script)
 26    {
 27      this.script = script
 28    }
 29  
 30  //////////////////////////////////////////////////////////////////////////
 31  // Run
 32  //////////////////////////////////////////////////////////////////////////
 33  
 34    **
 35    ** Run this task.  If there is an error, the report them via
 36    ** the script's log and throw FatalBuildErr if the script should
 37    ** be terminated.
 38    **
 39    abstract Void run()
 40  
 41  //////////////////////////////////////////////////////////////////////////
 42  // Env
 43  //////////////////////////////////////////////////////////////////////////
 44  
 45    **
 46    ** Return the parent build script associated with this task.
 47    **
 48    readonly BuildScript script
 49  
 50    **
 51    ** Convenience for script.log
 52    **
 53    BuildLog log() { return script.log }
 54  
 55    **
 56    ** Log an error and return a FatalBuildErr instance
 57    **
 58    FatalBuildErr fatal(Str msg, Err err := null)
 59    {
 60      log.error(msg, err)
 61      return FatalBuildErr.make
 62    }
 63  
 64  }

More Info