Class CommandLineCompiler

    • Field Detail

      • command

        private java.lang.String command
      • env

        private final org.apache.tools.ant.types.Environment env
      • identifier

        private java.lang.String identifier
      • identifierArg

        private java.lang.String identifierArg
      • libtool

        private boolean libtool
      • newEnvironment

        private final boolean newEnvironment
    • Constructor Detail

      • CommandLineCompiler

        protected CommandLineCompiler​(java.lang.String command,
                                      java.lang.String identifierArg,
                                      java.lang.String[] sourceExtensions,
                                      java.lang.String[] headerExtensions,
                                      java.lang.String outputSuffix,
                                      boolean libtool,
                                      CommandLineCompiler libtoolCompiler,
                                      boolean newEnvironment,
                                      org.apache.tools.ant.types.Environment env)
    • Method Detail

      • addImpliedArgs

        protected abstract void addImpliedArgs​(java.util.Vector args,
                                               boolean debug,
                                               boolean multithreaded,
                                               boolean exceptions,
                                               LinkType linkType,
                                               java.lang.Boolean rtti,
                                               OptimizationEnum optimization)
      • addIncludes

        protected void addIncludes​(java.lang.String baseDirPath,
                                   java.io.File[] includeDirs,
                                   java.util.Vector args,
                                   java.util.Vector relativeArgs,
                                   java.lang.StringBuffer includePathId)
        Adds command-line arguments for include directories. If relativeArgs is not null will add corresponding relative paths include switches to that vector (for use in building a configuration identifier that is consistent between machines).
        Parameters:
        baseDirPath - Base directory path.
        includeDirs - Array of include directory paths
        args - Vector of command line arguments used to execute the task
        relativeArgs - Vector of command line arguments used to build the configuration identifier
      • addWarningSwitch

        protected abstract void addWarningSwitch​(java.util.Vector args,
                                                 int warnings)
      • buildDefineArguments

        protected void buildDefineArguments​(CompilerDef[] defs,
                                            java.util.Vector args)
      • compile

        public void compile​(CCTask task,
                            java.io.File outputDir,
                            java.lang.String[] sourceFiles,
                            java.lang.String[] args,
                            java.lang.String[] endArgs,
                            boolean relentless,
                            CommandLineCompilerConfiguration config,
                            ProgressMonitor monitor)
                     throws org.apache.tools.ant.BuildException
        Compiles a source file.
        Throws:
        org.apache.tools.ant.BuildException
      • getArgumentCountPerInputFile

        protected int getArgumentCountPerInputFile()
      • getCommand

        protected final java.lang.String getCommand()
      • getDefineSwitch

        protected abstract void getDefineSwitch​(java.lang.StringBuffer buffer,
                                                java.lang.String define,
                                                java.lang.String value)
      • getEnvironmentIncludePath

        protected abstract java.io.File[] getEnvironmentIncludePath()
      • getIdentifier

        public java.lang.String getIdentifier()
        Description copied from interface: Processor
        Retrieve an identifier that identifies the specific version of the compiler. Compilers with the same identifier should produce the same output files for the same input files and command line switches.
        Specified by:
        getIdentifier in interface Processor
        Specified by:
        getIdentifier in class AbstractProcessor
      • getIncludeDirSwitch

        protected abstract java.lang.String getIncludeDirSwitch​(java.lang.String source)
      • getInputFileArgument

        protected java.lang.String getInputFileArgument​(java.io.File outputDir,
                                                        java.lang.String filename,
                                                        int index)
      • getLibtool

        protected final boolean getLibtool()
      • getLibtoolCompiler

        public final CommandLineCompiler getLibtoolCompiler()
        Obtains the same compiler, but with libtool set Default behavior is to ignore libtool
      • getMaximumCommandLength

        public abstract int getMaximumCommandLength()
      • getMaximumInputFilesPerCommand

        protected int getMaximumInputFilesPerCommand()
      • getTotalArgumentLengthForInputFile

        protected int getTotalArgumentLengthForInputFile​(java.io.File outputDir,
                                                         java.lang.String inputFile)
      • getUndefineSwitch

        protected abstract void getUndefineSwitch​(java.lang.StringBuffer buffer,
                                                  java.lang.String define)
      • runCommand

        protected int runCommand​(CCTask task,
                                 java.io.File workingDir,
                                 java.lang.String[] cmdline)
                          throws org.apache.tools.ant.BuildException
        This method is exposed so test classes can overload and test the arguments without actually spawning the compiler
        Throws:
        org.apache.tools.ant.BuildException
      • setCommand

        protected final void setCommand​(java.lang.String command)