Class CommandLineCompiler
java.lang.Object
net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
net.sf.antcontrib.cpptasks.compiler.AbstractCompiler
net.sf.antcontrib.cpptasks.compiler.CommandLineCompiler
- Direct Known Subclasses:
BorlandResourceCompiler,CommandLineCCompiler,CommandLineFortranCompiler,DevStudioMIDLCompiler,DevStudioResourceCompiler,MetaObjectCompiler,OpenWatcomCompiler,PrecompilingCommandLineCompiler,UserInterfaceCompiler,WindresResourceCompiler,XpidlCompiler
An abstract Compiler implementation which uses an external program to
perform the compile.
- Author:
- Adam Murdoch
-
Field Summary
Fields inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
DEFAULT_DISCARD_BID, DEFAULT_PROCESS_BID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommandLineCompiler(String command, String identifierArg, String[] sourceExtensions, String[] headerExtensions, String outputSuffix, boolean libtool, CommandLineCompiler libtoolCompiler, boolean newEnvironment, org.apache.tools.ant.types.Environment env) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 intprotected final Stringprotected abstract voidgetDefineSwitch(StringBuffer buffer, String define, String value) protected abstract File[]Retrieve an identifier that identifies the specific version of the compiler.protected abstract StringgetIncludeDirSwitch(String source) protected StringgetInputFileArgument(File outputDir, String filename, int index) protected final booleanfinal CommandLineCompilerObtains the same compiler, but with libtool set Default behavior is to ignore libtoolabstract intprotected intprotected 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 compilerprotected final voidsetCommand(String command) Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractCompiler
canParse, createConfiguration, createParser, getBaseOutputName, getOutputFileNames, parseIncludes, resolveIncludeMethods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
bid, changeEnvironment, clone, getHeaderExtensions, getIdentifier, getOSArch, getOSName, getSourceExtensions, isDarwin, toStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.antcontrib.cpptasks.compiler.Processor
bid, changeEnvironment, getLinker
-
Constructor Details
-
CommandLineCompiler
-
-
Method Details
-
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 pathsargs- Vector of command line arguments used to execute the taskrelativeArgs- Vector of command line arguments used to build the configuration identifier
-
addWarningSwitch
-
buildDefineArguments
-
compile
public void compile(CCTask task, File outputDir, String[] sourceFiles, String[] args, String[] endArgs, boolean relentless, CommandLineCompilerConfiguration config, ProgressMonitor monitor) throws org.apache.tools.ant.BuildException Compiles a source file.- Throws:
org.apache.tools.ant.BuildException
-
createConfiguration
protected CompilerConfiguration createConfiguration(CCTask task, LinkType linkType, ProcessorDef[] baseDefs, CompilerDef specificDef, TargetDef targetPlatform, VersionInfo versionInfo) - Specified by:
createConfigurationin classAbstractCompiler
-
getArgumentCountPerInputFile
protected int getArgumentCountPerInputFile() -
getCommand
-
getDefineSwitch
-
getEnvironmentIncludePath
-
getIdentifier
Description copied from interface:ProcessorRetrieve 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:
getIdentifierin interfaceProcessor- Specified by:
getIdentifierin classAbstractProcessor
-
getIncludeDirSwitch
-
getInputFileArgument
-
getLibtool
protected final boolean getLibtool() -
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
-
getUndefineSwitch
-
runCommand
protected int runCommand(CCTask task, File workingDir, 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
-