terp - the ANT Tasks
v1.3.337

com.codemesh.terp.ant.compiler.cpp
Class SourcesOption

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.types.DataType
          extended by org.apache.tools.ant.types.AbstractFileSet
              extended by org.apache.tools.ant.types.FileSet
                  extended by com.codemesh.terp.ant.compiler.cpp.SourcesOption
All Implemented Interfaces:
CompilerOption<CppCompiler>, CppCompilerOptionsSource, java.lang.Cloneable, org.apache.tools.ant.types.ResourceCollection, org.apache.tools.ant.types.selectors.SelectorContainer

public class SourcesOption
extends org.apache.tools.ant.types.FileSet
implements CompilerOption<CppCompiler>, CppCompilerOptionsSource

An option representing explicit input files for the compiler.


Field Summary
 
Fields inherited from class org.apache.tools.ant.types.DataType
checked, ref
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
  SourcesOption()
           
protected SourcesOption(org.apache.tools.ant.types.FileSet fileset)
           
 
Method Summary
 void addCommands(java.util.List<java.lang.String> commandList, CppCompiler compiler, CompilerPhase phase)
          Adds the compiler switches repreesnted by this option to the list of switches.
 boolean appliesTo(CppCompiler compiler, CompilerPhase phase)
          Returns true if this compiler option applies to the given compiler and compiler phase.
 java.lang.String getIf()
          Returns the condition that must be satidifed to execute the implementing task.
 java.lang.String getOptions()
          Returns an optional identifier of an external compiler options instance.
 CppCompilerOptions getReferenced()
          
 java.lang.String getUnless()
          Returns the condition that must not be satidifed to execute the implementing task.
 boolean satisfies(TerpContext ctx)
          Returns true if both conditions are met within the given terp context.
 void setIf(java.lang.String condition)
          Sets a condition that must be satisfied to execute the implementing task.
 void setOptions(java.lang.String options)
          Sets the optional identifier of an external compiler options instance to be applied to the sources represented by this element.
 void setUnless(java.lang.String condition)
          Sets a condition that must not be satisfied to execute the implementing task.
 
Methods inherited from class org.apache.tools.ant.types.FileSet
clone, isFilesystemOnly, iterator, size
 
Methods inherited from class org.apache.tools.ant.types.AbstractFileSet
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addReadable, addSelector, addSize, addType, addWritable, appendExcludes, appendIncludes, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, dieOnCircularReference, getDefaultexcludes, getDir, getDir, getDirectoryScanner, getDirectoryScanner, getMaxLevelsOfSymlinks, getRef, getSelectors, hasPatterns, hasSelectors, isCaseSensitive, isFollowSymlinks, mergeExcludes, mergeIncludes, mergePatterns, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setDir, setErrorOnMissingDir, setExcludes, setExcludesfile, setFile, setFollowSymlinks, setIncludes, setIncludesfile, setMaxLevelsOfSymlinks, setRefid, setupDirectoryScanner, setupDirectoryScanner, toString
 
Methods inherited from class org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SourcesOption

public SourcesOption()

SourcesOption

protected SourcesOption(org.apache.tools.ant.types.FileSet fileset)
Method Detail

addCommands

public void addCommands(java.util.List<java.lang.String> commandList,
                        CppCompiler compiler,
                        CompilerPhase phase)
Adds the compiler switches repreesnted by this option to the list of switches. Some compiler options may result in more than one switch being added to a compiler invocation. Other compiler options may result in different options being added in different phases (compilation vs. linking) of the build.

This method is called by the compiler repeatedly with different values for the compiler phase to account for these possibilities. Does not perform any action unless an external options identifier is set.

Specified by:
addCommands in interface CompilerOption<CppCompiler>
Parameters:
commandList - the list to which the compiler switches represented by this option (if any) are added.
compiler - the compiler for which we're doing this.
phase - the compiler phase in wihch we're doing this.

getReferenced

public CppCompilerOptions getReferenced()

Specified by:
getReferenced in interface CppCompilerOptionsSource

appliesTo

public boolean appliesTo(CppCompiler compiler,
                         CompilerPhase phase)
Returns true if this compiler option applies to the given compiler and compiler phase. Not every option has switches to contribute for every compiler and every compilation phase. This method allows a quick, inexpensive check to filter out potentially more expensive calls later on.

Specified by:
appliesTo in interface CompilerOption<CppCompiler>
Parameters:
compiler - the compiler for which we're asking.
phase - the compiler phase we're executing.
Returns:

getOptions

public java.lang.String getOptions()
Returns an optional identifier of an external compiler options instance. This option allows the addition of compilation options to a subset of source files.

Returns:
an external options set identifier or null if none is configured.

setOptions

public void setOptions(java.lang.String options)
Sets the optional identifier of an external compiler options instance to be applied to the sources represented by this element.

Parameters:
options - an identifier of a compiler options set.

getIf

public java.lang.String getIf()
Returns the condition that must be satidifed to execute the implementing task.

Specified by:
getIf in interface CompilerOption<CppCompiler>
Returns:
the boolean expression.

setIf

public void setIf(java.lang.String condition)
Sets a condition that must be satisfied to execute the implementing task.

Specified by:
setIf in interface CompilerOption<CppCompiler>
Parameters:
condition - a terp expression that must evaluate to a boolean value.

getUnless

public java.lang.String getUnless()
Returns the condition that must not be satidifed to execute the implementing task.

Specified by:
getUnless in interface CompilerOption<CppCompiler>
Returns:
the boolean expression.

setUnless

public void setUnless(java.lang.String condition)
Sets a condition that must not be satisfied to execute the implementing task.

Specified by:
setUnless in interface CompilerOption<CppCompiler>
Parameters:
condition - a terp expression that must evaluate to a boolean value.

satisfies

public boolean satisfies(TerpContext ctx)
Description copied from interface: CompilerOption
Returns true if both conditions are met within the given terp context.

Specified by:
satisfies in interface CompilerOption<CppCompiler>
Parameters:
ctx - the terp context in which the logical expressions are evaluated.
Returns:
true or false.

terp - the ANT Tasks
v1.3.337

Copyright © 2008-2016 by Codemesh, Inc. All Rights Reserved.