Class Gosuc

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
gosu.tools.ant.GosuMatchingTask
gosu.tools.ant.Gosuc
All Implemented Interfaces:
Cloneable, org.apache.tools.ant.types.selectors.SelectorContainer

public class Gosuc extends GosuMatchingTask
Ant task for compiling Gosu files to disk.

The following parameters are available:

  • "srcdir" : A Path containing one or more source directories
  • "destdir" : A File representing the output destination of the compilation
  • "checkedarithmetic" : Compile with checked arithmetic if true. Defaults to false.
  • "failonerror" : Ignore compile errors and continue if true. Defaults to true.
  • "projectname" : Outputs this value in the compilation complete message. Defaults to the empty string.
  • "additionalscriptextensions" : Comma-separated list of additional file extensions to compile. Normally not required.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
     
    private org.apache.tools.ant.types.Path
     
    private File
     
    private boolean
     
    private boolean
     
    private String
     
    private Set<String>
     
    private org.apache.tools.ant.types.Path
     
    protected List<File>
     
    private final AntLoggingHelper
     

    Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask

    fileset

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private List<File>
    asFiles(File srcDir, String[] files, org.apache.tools.ant.util.FileNameMapper m)
    Converts an array of relative String filenames to a List<File>
    org.apache.tools.ant.types.Path
    Adds a path to the classpath.
    org.apache.tools.ant.types.Path
    Adds a path for source compilation.
    void
    Executes the task.
    Gets the destination directory into which the Gosu source files should be compiled.
    boolean
    Gets the FailOnError flag.
    Gets the list of files to be compiled.
    Gets the optional Project Name.
    This has no impact on the compilation; simply outputs this value in the compilation complete message.
    private Set<String>
     
    org.apache.tools.ant.types.Path
    Gets the source dirs to find the source Gosu files.
    boolean
     
    boolean
    Gets the Force flag.
    ant's directory scanner is timestamp based.
    protected org.apache.tools.ant.types.Path
    Recreate src.
    protected void
    scanDir(File srcDir, File destDir, String[] files)
    Scans the directory looking for source files to be compiled.
    void
     
    void
    setCheckedArithmetic(boolean checkedArithmetic)
     
    void
    setClasspathRef(org.apache.tools.ant.types.Reference ref)
    Adds a reference to a classpath defined elsewhere.
    void
    setDestdir(File destDir)
    Set the destination directory into which the Gosu source files should be compiled.
    void
    setFailOnError(boolean fail)
    Indicates whether the build will continue even if there are compilation errors; defaults to true.
    void
    setForce(boolean force)
     
    void
    setProjectName(String projectName)
     
    void
    setSrcdir(org.apache.tools.ant.types.Path srcDir)
    Set the source directories to find the source Gosu files.

    Methods inherited from class gosu.tools.ant.GosuMatchingTask

    buildError

    Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask

    add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      private final AntLoggingHelper log
    • _src

      private org.apache.tools.ant.types.Path _src
    • _destDir

      private File _destDir
    • _compileClasspath

      private org.apache.tools.ant.types.Path _compileClasspath
    • _failOnError

      private boolean _failOnError
    • _checkedArithmetic

      private boolean _checkedArithmetic
    • _force

      private boolean _force
    • _projectName

      private String _projectName
    • _scriptExtensions

      private Set<String> _scriptExtensions
    • compileList

      protected List<File> compileList
  • Constructor Details

    • Gosuc

      public Gosuc()
  • Method Details

    • createSrc

      public org.apache.tools.ant.types.Path createSrc()
      Adds a path for source compilation.
      Returns:
      a nested src element.
    • recreateSrc

      protected org.apache.tools.ant.types.Path recreateSrc()
      Recreate src.
      Returns:
      a nested src element.
    • setSrcdir

      public void setSrcdir(org.apache.tools.ant.types.Path srcDir)
      Set the source directories to find the source Gosu files.
      Parameters:
      srcDir - the source directories as a path
    • getSrcdir

      public org.apache.tools.ant.types.Path getSrcdir()
      Gets the source dirs to find the source Gosu files.
      Returns:
      the source directories as a path
    • setDestdir

      public void setDestdir(File destDir)
      Set the destination directory into which the Gosu source files should be compiled.
      Parameters:
      destDir - the destination directory
    • getDestdir

      public File getDestdir()
      Gets the destination directory into which the Gosu source files should be compiled.
      Returns:
      the destination directory
    • createClasspath

      public org.apache.tools.ant.types.Path createClasspath()
      Adds a path to the classpath.
      Returns:
      a classpath to be configured
    • setClasspathRef

      public void setClasspathRef(org.apache.tools.ant.types.Reference ref)
      Adds a reference to a classpath defined elsewhere.
      Parameters:
      ref - a reference to a classpath
    • getScriptExtensions

      private Set<String> getScriptExtensions()
    • setAdditionalScriptExtensions

      public void setAdditionalScriptExtensions(String extensions)
      Parameters:
      extensions - Additional extensions to compile; for example "grs, gr"
    • setFailOnError

      public void setFailOnError(boolean fail)
      Indicates whether the build will continue even if there are compilation errors; defaults to true.
      Parameters:
      fail - if true halt the build on failure
    • getFailOnError

      public boolean getFailOnError()
      Gets the FailOnError flag.
      Returns:
      the FailOnError flag
    • isCheckedArithmetic

      public boolean isCheckedArithmetic()
    • setCheckedArithmetic

      public void setCheckedArithmetic(boolean checkedArithmetic)
    • isForce

      public boolean isForce()
      Gets the Force flag.
      ant's directory scanner is timestamp based. Without proper tasks, this could result in successful, but incomplete compilation.
      Therefore we default 'force' to true, which causes compilation of all matching source files, regardless of the timestamp comparison between source and target.
      Returns:
    • setForce

      public void setForce(boolean force)
    • getProjectName

      public String getProjectName()
      Gets the optional Project Name.
      This has no impact on the compilation; simply outputs this value in the compilation complete message. Useful in large, multimodule builds with parallelization.
      Returns:
      ProjectName property; defaults to empty string.
    • setProjectName

      public void setProjectName(String projectName)
    • scanDir

      protected void scanDir(File srcDir, File destDir, String[] files)
      Scans the directory looking for source files to be compiled. The results are returned in the class variable compileList
      Parameters:
      srcDir - The source directory
      destDir - The destination directory
      files - An array of filenames
    • asFiles

      private List<File> asFiles(File srcDir, String[] files, org.apache.tools.ant.util.FileNameMapper m)
      Converts an array of relative String filenames to a List<File>
      Parameters:
      srcDir - The root directory of all files
      files - All files are relative to srcDir
      Returns:
      a List of Files by joining srcDir to each file
    • getFileList

      public List<File> getFileList()
      Gets the list of files to be compiled.
      Returns:
      the list of files
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Executes the task.
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException - if an error occurs