terp - the ANT Tasks
v1.3.304

com.codemesh.terp.ant.compiler
Interface CompilerOption<C extends Compiler>

All Known Subinterfaces:
CompuwareOption, CppFileCreating, FileCreating<C>
All Known Implementing Classes:
AbstractCompilerOption, BooleanCompilerOption, BoundsCheckOption, CompileOnlyOption, DebugOption, DefineOption, DirectoryCompilerOption, DynamicSourcesOption, ExceptionsOption, FileNameOption, GenerateVsProject, GenericOption, IncludeOption, LibpathOption, LibraryOption, ManifestOption, MultithreadedOption, ObjectsOption, OptimizeOption, OptionsOption, ProcArchOption, ProfileOption, QuietOption, RelocatableOption, ResourceOption, RttiOption, RunpathOption, RuntimeOption, SourcesOption, TargetOption, UndefineOption, VsProjectOption, WarningsOption

public interface CompilerOption<C extends Compiler>

The interface implemented by all compiler options. We do not implement TerpAware because the option itself cannot decide whether it is enabled, it requires the cooperation of the compiler to retrieve the project and context.

This interface is very similar to the TerpAware interface, but just different enough that we could not reuse it. TerpAware tasks are evaluated in a single, implicit context, the project context. Compiler options on the other hand are evaluated in a compiler context that could change, for example due to a <foreach> iteration over several compilers. This requires an additional argument for the satisfies(com.codemesh.terp.api.TerpContext) method.


Method Summary
 void addCommands(java.util.List<java.lang.String> commandList, C compiler, CompilerPhase phase)
          Adds the compiler switches repreesnted by this option to the list of switches.
 boolean appliesTo(C 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 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 setUnless(java.lang.String condition)
          Sets a condition that must not be satisfied to execute the implementing task.
 

Method Detail

appliesTo

boolean appliesTo(C 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.

Parameters:
compiler - the compiler for which we're asking.
phase - the compiler phase we're executing.
Returns:

addCommands

void addCommands(java.util.List<java.lang.String> commandList,
                 C 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.

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.

setIf

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

Parameters:
condition - a terp expression that must evaluate to a boolean value.

getIf

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

Returns:
the boolean expression.

setUnless

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

Parameters:
condition - a terp expression that must evaluate to a boolean value.

getUnless

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

Returns:
the boolean expression.

satisfies

boolean satisfies(TerpContext ctx)
Returns true if both conditions are met within the given terp context.

Parameters:
ctx - the terp context in which the logical expressions are evaluated.
Returns:
true or false.

terp - the ANT Tasks
v1.3.304

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