net.sf.antcontrib.cpptasks.compiler

Class CommandLineCompiler

public abstract class CommandLineCompiler extends AbstractCompiler

An abstract Compiler implementation which uses an external program to perform the compile.

Author: Adam Murdoch

Constructor Summary
protected CommandLineCompiler(String command, String identifierArg, String[] sourceExtensions, String[] headerExtensions, String outputSuffix, boolean libtool, CommandLineCompiler libtoolCompiler, boolean newEnvironment, Environment env)
Method Summary
protected abstract voidaddImpliedArgs(Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, Boolean rtti, OptimizationEnum optimization)
protected voidaddIncludes(String baseDirPath, File[] includeDirs, Vector args, Vector relativeArgs, StringBuffer includePathId)
Adds command-line arguments for include directories.
protected abstract voidaddWarningSwitch(Vector args, int warnings)
protected voidbuildDefineArguments(CompilerDef[] defs, Vector args)
voidcompile(CCTask task, File outputDir, String[] sourceFiles, String[] args, String[] endArgs, boolean relentless, CommandLineCompilerConfiguration config, ProgressMonitor monitor)
Compiles a source file.
protected CompilerConfigurationcreateConfiguration(CCTask task, LinkType linkType, ProcessorDef[] baseDefs, CompilerDef specificDef, TargetDef targetPlatform, VersionInfo versionInfo)
protected intgetArgumentCountPerInputFile()
protected StringgetCommand()
protected abstract voidgetDefineSwitch(StringBuffer buffer, String define, String value)
protected abstract File[]getEnvironmentIncludePath()
StringgetIdentifier()
protected abstract StringgetIncludeDirSwitch(String source)
protected StringgetInputFileArgument(File outputDir, String filename, int index)
protected booleangetLibtool()
CommandLineCompilergetLibtoolCompiler()
Obtains the same compiler, but with libtool set Default behavior is to ignore libtool
abstract intgetMaximumCommandLength()
protected intgetMaximumInputFilesPerCommand()
protected intgetTotalArgumentLengthForInputFile(File outputDir, String inputFile)
protected abstract voidgetUndefineSwitch(StringBuffer buffer, String define)
protected intrunCommand(CCTask task, File workingDir, String[] cmdline)
This method is exposed so test classes can overload and test the arguments without actually spawning the compiler
protected voidsetCommand(String command)

Constructor Detail

CommandLineCompiler

protected CommandLineCompiler(String command, String identifierArg, String[] sourceExtensions, String[] headerExtensions, String outputSuffix, boolean libtool, CommandLineCompiler libtoolCompiler, boolean newEnvironment, Environment env)

Method Detail

addImpliedArgs

protected abstract void addImpliedArgs(Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, Boolean rtti, OptimizationEnum optimization)

addIncludes

protected void addIncludes(String baseDirPath, File[] includeDirs, Vector args, Vector relativeArgs, 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(Vector args, int warnings)

buildDefineArguments

protected void buildDefineArguments(CompilerDef[] defs, Vector args)

compile

public void compile(CCTask task, File outputDir, String[] sourceFiles, String[] args, String[] endArgs, boolean relentless, CommandLineCompilerConfiguration config, ProgressMonitor monitor)
Compiles a source file.

createConfiguration

protected CompilerConfiguration createConfiguration(CCTask task, LinkType linkType, ProcessorDef[] baseDefs, CompilerDef specificDef, TargetDef targetPlatform, VersionInfo versionInfo)

getArgumentCountPerInputFile

protected int getArgumentCountPerInputFile()

getCommand

protected final String getCommand()

getDefineSwitch

protected abstract void getDefineSwitch(StringBuffer buffer, String define, String value)

getEnvironmentIncludePath

protected abstract File[] getEnvironmentIncludePath()

getIdentifier

public String getIdentifier()

getIncludeDirSwitch

protected abstract String getIncludeDirSwitch(String source)

getInputFileArgument

protected String getInputFileArgument(File outputDir, 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(File outputDir, String inputFile)

getUndefineSwitch

protected abstract void getUndefineSwitch(StringBuffer buffer, String define)

runCommand

protected int runCommand(CCTask task, File workingDir, String[] cmdline)
This method is exposed so test classes can overload and test the arguments without actually spawning the compiler

setCommand

protected final void setCommand(String command)
Copyright ? 2001-2011 Ant-Contrib project. All Rights Reserved.