Class Gosuc

  • All Implemented Interfaces:
    java.lang.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 _checkedArithmetic  
      private org.apache.tools.ant.types.Path _compileClasspath  
      private java.io.File _destDir  
      private boolean _failOnError  
      private boolean _force  
      private java.lang.String _projectName  
      private java.util.Set<java.lang.String> _scriptExtensions  
      private org.apache.tools.ant.types.Path _src  
      protected java.util.List<java.io.File> compileList  
      private AntLoggingHelper log  
      • 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
      Gosuc()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.List<java.io.File> asFiles​(java.io.File srcDir, java.lang.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 createClasspath()
      Adds a path to the classpath.
      org.apache.tools.ant.types.Path createSrc()
      Adds a path for source compilation.
      void execute()
      Executes the task.
      java.io.File getDestdir()
      Gets the destination directory into which the Gosu source files should be compiled.
      boolean getFailOnError()
      Gets the FailOnError flag.
      java.util.List<java.io.File> getFileList()
      Gets the list of files to be compiled.
      java.lang.String getProjectName()
      Gets the optional Project Name.
      This has no impact on the compilation; simply outputs this value in the compilation complete message.
      private java.util.Set<java.lang.String> getScriptExtensions()  
      org.apache.tools.ant.types.Path getSrcdir()
      Gets the source dirs to find the source Gosu files.
      boolean isCheckedArithmetic()  
      boolean isForce()
      Gets the Force flag.
      ant's directory scanner is timestamp based.
      protected org.apache.tools.ant.types.Path recreateSrc()
      Recreate src.
      protected void scanDir​(java.io.File srcDir, java.io.File destDir, java.lang.String[] files)
      Scans the directory looking for source files to be compiled.
      void setAdditionalScriptExtensions​(java.lang.String extensions)  
      void setCheckedArithmetic​(boolean checkedArithmetic)  
      void setClasspathRef​(org.apache.tools.ant.types.Reference ref)
      Adds a reference to a classpath defined elsewhere.
      void setDestdir​(java.io.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​(java.lang.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 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 Detail

      • _src

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

        private java.io.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 java.lang.String _projectName
      • _scriptExtensions

        private java.util.Set<java.lang.String> _scriptExtensions
      • compileList

        protected java.util.List<java.io.File> compileList
    • Constructor Detail

      • Gosuc

        public Gosuc()
    • Method Detail

      • 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​(java.io.File destDir)
        Set the destination directory into which the Gosu source files should be compiled.
        Parameters:
        destDir - the destination directory
      • getDestdir

        public java.io.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 java.util.Set<java.lang.String> getScriptExtensions()
      • setAdditionalScriptExtensions

        public void setAdditionalScriptExtensions​(java.lang.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 java.lang.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​(java.lang.String projectName)
      • scanDir

        protected void scanDir​(java.io.File srcDir,
                               java.io.File destDir,
                               java.lang.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 java.util.List<java.io.File> asFiles​(java.io.File srcDir,
                                                     java.lang.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 java.util.List<java.io.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