public class CCTask
extends org.apache.tools.ant.Task
This task can compile various source languages and produce executables, shared libraries (aka DLL's) and static libraries. Compiler adaptors are currently available for several C/C++ compilers, FORTRAN, MIDL and Windows Resource files.
Copyright (c) 2001-2008, The Ant-Contrib project.
Licensed under the Apache Software License 2.0, http://www.apache.org/licenses/LICENSE-2.0.
For use with Apache Ant 1.5 or later. This software is not a product of the of the Apache Software Foundation and no endorsement is implied.
THIS SOFTWARE IS PROVIDED 'AS-IS', See http://www.apache.org/licenses/LICENSE-2.0 for additional disclaimers.
To use:Modifier and Type | Field and Description |
---|---|
protected boolean |
failOnError
If true, stop build on compile failure.
|
Constructor and Description |
---|
CCTask() |
Modifier and Type | Method and Description |
---|---|
void |
addConfiguredCompiler(CompilerDef compiler)
Adds a compiler definition or reference.
|
void |
addConfiguredCompilerArg(CompilerArgument arg)
Adds a compiler command-line arg.
|
void |
addConfiguredDefineset(DefineSet defs)
Adds a defineset.
|
void |
addConfiguredDistributer(DistributerDef distributer)
Adds a distributer definition or reference (Non-functional prototype).
|
void |
addConfiguredLinker(LinkerDef linker)
Adds a linker definition.
|
void |
addConfiguredLinkerArg(LinkerArgument arg)
Adds a linker command-line arg.
|
void |
addConfiguredTarget(TargetDef target)
Adds a target definition or reference (Non-functional prototype).
|
void |
addConfiguredVersioninfo(VersionInfo newVersionInfo)
Adds desriptive version information to be included in the
generated file.
|
void |
addEnv(org.apache.tools.ant.types.Environment.Variable var)
Add an environment variable to the launched process.
|
void |
addFileset(ConditionalFileSet srcSet)
Adds a source file set.
|
void |
addLibset(LibrarySet libset)
Adds a library set.
|
void |
addProject(ProjectDef projectDef)
Specifies the generation of IDE project file.
|
void |
addSyslibset(SystemLibrarySet libset)
Adds a system library set.
|
protected int |
checkForChangedIncludeFiles(Map targets)
Checks all targets that are not forced to be rebuilt or are missing
object files to be checked for modified include files
|
protected LinkerConfiguration |
collectExplicitObjectFiles(Vector objectFiles,
Vector sysObjectFiles,
VersionInfo versionInfo) |
IncludePath |
createIncludePath()
Adds an include path.
|
PrecompileDef |
createPrecompile()
Specifies precompilation prototype file and exclusions.
|
SystemIncludePath |
createSysIncludePath()
Adds a system include path.
|
void |
execute()
Executes the task.
|
int |
getCommandLogLevel()
Get the commandLogLevel
|
String |
getDataset()
Gets the dataset.
|
boolean |
getDebug()
Gets debug state.
|
boolean |
getFailonerror()
Gets the failonerror flag.
|
protected TargetHistoryTable |
getLinkHistory(TargetHistoryTable objHistory) |
protected TargetInfo |
getLinkTarget(LinkerConfiguration linkerConfig,
Vector objectFiles,
Vector sysObjectFiles,
Map compileTargets,
VersionInfo versionInfo) |
int |
getMaxCores() |
File |
getObjdir() |
File |
getOutfile() |
String |
getOuttype()
Gets output type.
|
String |
getSubsystem()
Gets subsystem name.
|
TargetDef |
getTargetPlatform() |
static Map |
getTargetsToBuildByConfiguration(Map targets)
Builds a Hashtable to targets needing to be rebuilt keyed by compiler
configuration
|
boolean |
isDecorateLinkerOptions() |
void |
setClassname(String classname)
Sets the default compiler adapter.
|
void |
setCommandLogLevel(int commandLogLevel)
Set commandLogLevel
( CUtil.runCommand() will honor this...
|
void |
setDataset(String dataset)
Sets the dataset for OS/390 builds.
|
void |
setDebug(boolean debug)
Enables or disables generation of debug info.
|
void |
setDecorateLinkerOptions(boolean decorateLinkerOptions) |
void |
setDependencyDepth(int depth)
Deprecated.
|
void |
setExceptions(boolean exceptions)
Enables generation of exception handling code
|
void |
setFailonerror(boolean fail)
Indicates whether the build will continue
even if there are compilation errors; defaults to true.
|
void |
setIncremental(boolean incremental)
Enables or disables incremental linking.
|
void |
setLibtool(boolean libtool)
Set use of libtool.
|
void |
setLink(OutputTypeEnum outputType)
Deprecated.
|
void |
setLinkCPP(boolean linkCPP) |
void |
setLinkFortran(boolean linkFortran) |
void |
setLinkFortranMain(boolean linkFortranMain) |
void |
setMaxCores(int maxCores) |
void |
setMultithreaded(boolean multi)
Enables or disables generation of multithreaded code
|
void |
setName(CompilerEnum name)
Sets type of the default compiler and linker.
|
void |
setNewenvironment(boolean newenv)
Do not propagate old environment when new environment variables are
specified.
|
void |
setObjdir(File dir)
Sets the destination directory for object files.
|
void |
setOptimize(OptimizationEnum optimization)
Sets optimization.
|
void |
setOutfile(File outfile)
Sets the output file name.
|
void |
setOutputFileProperty(String outputFileProperty)
Specifies the name of a property to set with the physical filename that
is produced by the linker
|
void |
setOuttype(OutputTypeEnum outputType)
Sets the output file type.
|
void |
setProject(org.apache.tools.ant.Project project)
Sets the project.
|
void |
setProjectsOnly(boolean value) |
void |
setRebuild(boolean rebuildAll)
If set to true, all files will be rebuilt.
|
void |
setRelentless(boolean relentless)
If set to true, compilation errors will not stop the task until all
files have been attempted.
|
void |
setRtti(boolean rtti)
Enables run-time type information.
|
void |
setRuntime(RuntimeType rtlType)
Sets the type of runtime library, possible values "dynamic", "static".
|
void |
setSubsystem(SubsystemEnum subsystem)
Sets the nature of the subsystem under which that the program will
execute.
|
void |
setWarnings(WarningLevelEnum level)
Enumerated attribute with the values "none", "severe", "default",
"production", "diagnostic", and "aserror".
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
public static Map getTargetsToBuildByConfiguration(Map targets)
public boolean isDecorateLinkerOptions()
public void setDecorateLinkerOptions(boolean decorateLinkerOptions)
public void addConfiguredCompiler(CompilerDef compiler)
compiler
- compilerNullPointerException
- if compiler is nullpublic void addConfiguredCompilerArg(CompilerArgument arg)
public void addConfiguredDefineset(DefineSet defs)
defs
- Define setpublic void addConfiguredLinker(LinkerDef linker)
linker
- linkerNullPointerException
- if linker is nullpublic void addConfiguredLinkerArg(LinkerArgument arg)
public void addEnv(org.apache.tools.ant.types.Environment.Variable var)
public void addFileset(ConditionalFileSet srcSet)
public void addLibset(LibrarySet libset)
libset
- library setNullPointerException
- if libset is null.public void addSyslibset(SystemLibrarySet libset)
libset
- library setNullPointerException
- if libset is null.public void addProject(ProjectDef projectDef)
projectDef
- project file generation specificationpublic void setProjectsOnly(boolean value)
protected int checkForChangedIncludeFiles(Map targets)
protected LinkerConfiguration collectExplicitObjectFiles(Vector objectFiles, Vector sysObjectFiles, VersionInfo versionInfo)
public IncludePath createIncludePath()
public PrecompileDef createPrecompile() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
public SystemIncludePath createSysIncludePath()
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- if someting goes wrong with the buildpublic String getDataset()
protected TargetHistoryTable getLinkHistory(TargetHistoryTable objHistory)
protected TargetInfo getLinkTarget(LinkerConfiguration linkerConfig, Vector objectFiles, Vector sysObjectFiles, Map compileTargets, VersionInfo versionInfo)
public File getObjdir()
public File getOutfile()
public TargetDef getTargetPlatform()
public void setClassname(String classname)
classname
- fully qualified classname which implements CompilerAdapterpublic void setDataset(String dataset)
dataset
- The dataset to setpublic void setDebug(boolean debug)
public boolean getDebug()
public void setDependencyDepth(int depth)
public void setExceptions(boolean exceptions)
public void setRtti(boolean rtti)
public void setIncremental(boolean incremental)
incremental
- new statepublic void setLibtool(boolean libtool)
libtool
- If true, use libtool.public void setLink(OutputTypeEnum outputType)
public void setLinkCPP(boolean linkCPP)
public void setLinkFortran(boolean linkFortran)
public void setLinkFortranMain(boolean linkFortranMain)
public void setMultithreaded(boolean multi)
multi
- If true, generated code may be multithreaded.public void setName(CompilerEnum name)
gcc (default) | GCC C++ compiler |
g++ | GCC C++ compiler |
c++ | GCC C++ compiler |
g77 | GNU FORTRAN compiler |
msvc | Microsoft Visual C++ |
bcc | Borland C++ Compiler |
msrc | Microsoft Resource Compiler |
brc | Borland Resource Compiler |
df | Compaq Visual Fortran Compiler |
midl | Microsoft MIDL Compiler |
icl | Intel C++ compiler for Windows (IA-32) |
ecl | Intel C++ compiler for Windows (IA-64) |
icc | Intel C++ compiler for Linux (IA-32) |
ecc | Intel C++ compiler for Linux (IA-64) |
CC | Sun ONE C++ compiler |
aCC | HP aC++ C++ Compiler |
os390 | OS390 C Compiler |
os400 | Icc Compiler |
sunc89 | Sun C89 C Compiler |
xlC | VisualAge C Compiler |
uic | Qt user interface compiler (creates .h, .cpp and moc_*.cpp files). |
moc | Qt meta-object compiler |
xpidl | Mozilla xpidl compiler (creates .h and .xpt files). |
wcl | OpenWatcom C/C++ compiler |
wfl | OpenWatcom FORTRAN compiler |
public void setNewenvironment(boolean newenv)
public void setObjdir(File dir)
dir
- object directorypublic void setOutfile(File outfile)
outfile
- output file namepublic void setOutputFileProperty(String outputFileProperty)
public void setOuttype(OutputTypeEnum outputType)
public String getOuttype()
public void setProject(org.apache.tools.ant.Project project)
setProject
in class org.apache.tools.ant.ProjectComponent
public void setRebuild(boolean rebuildAll)
rebuildAll
- If true, all files will be rebuilt. If false, up to
date files will not be rebuilt.public void setRelentless(boolean relentless)
relentless
- If true, don't stop on the first compilation errorpublic void setRuntime(RuntimeType rtlType)
public void setSubsystem(SubsystemEnum subsystem)
gui | Graphical User Interface |
console | Command Line Console |
other | Other |
subsystem
- subsystemNullPointerException
- if subsystem is nullpublic String getSubsystem()
public void setWarnings(WarningLevelEnum level)
public void setMaxCores(int maxCores)
public int getMaxCores()
public void setFailonerror(boolean fail)
fail
- if true halt the build on failurepublic boolean getFailonerror()
public void addConfiguredTarget(TargetDef target)
target
- targetNullPointerException
- if compiler is nullpublic void addConfiguredDistributer(DistributerDef distributer)
distributer
- distributerNullPointerException
- if compiler is nullpublic void setOptimize(OptimizationEnum optimization)
optimization
- public void addConfiguredVersioninfo(VersionInfo newVersionInfo)
public void setCommandLogLevel(int commandLogLevel)
public int getCommandLogLevel()
Copyright © 2002–2014 The Apache Software Foundation. All rights reserved.