terp - the ANT Tasks
v1.3.337

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

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.Echo
              extended by com.codemesh.terp.ant.TerpEcho
                  extended by com.codemesh.terp.ant.compiler.cpp.ResourceOption
All Implemented Interfaces:
CompilerOption<CppCompiler>, CppFileCreating, FileCreating<CppCompiler>, TerpAware, TerpContextHolder, java.lang.Cloneable

public class ResourceOption
extends TerpEcho
implements CppFileCreating

An option that allows the programmatic specification of commonly used resource data. This option will cause the invocation of a resource compiler with the following definitions:

You can use these constants in your rc file to compose conditional string values that indicate the VisualStudio version, processor architecture, and debug nature of your binary.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.Echo
org.apache.tools.ant.taskdefs.Echo.EchoLevel
 
Nested classes/interfaces inherited from interface com.codemesh.terp.ant.TerpAware
TerpAware.Delegate
 
Field Summary
protected  java.lang.String charSetId
           
protected  java.lang.String comments
           
protected  java.lang.String companyName
           
protected  java.lang.String fileDescription
           
protected  Version fileVersion
           
protected  java.io.File iconFile
           
protected  java.lang.String internalName
           
protected  java.lang.String languageId
           
protected  java.lang.String legalCopyright
           
protected  java.lang.String legalTradeMarks
           
protected  java.lang.String originalFileName
           
protected  java.lang.String productName
           
protected  Version productVersion
           
protected  java.lang.String specialBuild
           
protected  TargetType targetType
           
protected  java.lang.String theMessage
           
 
Fields inherited from class org.apache.tools.ant.taskdefs.Echo
append, file, logLevel, message
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
ResourceOption()
           
 
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.
 void addText(java.lang.String msg)
           
 boolean appliesTo(CppCompiler compiler, CompilerPhase phase)
          Returns true if this compiler option applies to the given compiler and compiler phase.
 java.io.File calculateRcFile(CppCompiler compiler)
           
 java.util.List<java.lang.String> creates(CppCompiler compiler, CompilerPhase phase)
          Returns a list of filenames representing the files that are created due to the presence of this compiler option.
 void execute()
           
 java.lang.String getCharSetId()
           
 java.lang.String getComments()
           
 java.lang.String getCompanyName()
           
 java.lang.String getFileDescription()
           
 Version getFileVersion()
           
 java.io.File getIcon()
           
 java.io.File getIconFile()
           
 java.lang.String getInternalName()
           
 java.lang.String getLanguageId()
           
 java.lang.String getLegalCopyright()
           
 java.lang.String getLegalTradeMarks()
           
 java.lang.String getOriginalFileName()
           
 java.lang.String getProductName()
           
 Version getProductVersion()
           
 java.lang.String getSpecialBuild()
           
 boolean satisfies(TerpContext ctx)
          Returns true if both conditions are met within the given terp context.
 void setCharSetId(java.lang.String charSetId)
           
 void setComments(java.lang.String comments)
           
 void setCompanyName(java.lang.String companyName)
           
 void setFileDescription(java.lang.String fileDescription)
           
 void setFileVersion(java.lang.String fileVersion)
           
 void setIcon(java.io.File icon)
           
 void setIconFile(java.io.File iconFile)
           
 void setInternalName(java.lang.String internalName)
           
 void setLanguageId(java.lang.String languageId)
           
 void setLegalCopyright(java.lang.String legalCopyright)
           
 void setLegalTradeMarks(java.lang.String legalTradeMarks)
           
 void setOriginalFileName(java.lang.String originalFileName)
           
 void setProductName(java.lang.String productName)
           
 void setProductVersion(java.lang.String productVersion)
           
 void setSpecialBuild(java.lang.String specialBuild)
           
 void setTargetType(java.lang.String type)
           
 
Methods inherited from class com.codemesh.terp.ant.TerpEcho
getContext, getFile, getIf, getTemplate, getUnless, satisfiesConditions, setContext, setIf, setProject, setTemplate, setUnless
 
Methods inherited from class org.apache.tools.ant.taskdefs.Echo
setAppend, setEncoding, setFile, setLevel, setMessage, setOutput
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.codemesh.terp.ant.compiler.CompilerOption
getIf, getUnless, setIf, setUnless
 

Field Detail

iconFile

protected java.io.File iconFile

comments

protected java.lang.String comments

companyName

protected java.lang.String companyName

fileDescription

protected java.lang.String fileDescription

fileVersion

protected Version fileVersion

internalName

protected java.lang.String internalName

legalCopyright

protected java.lang.String legalCopyright

legalTradeMarks

protected java.lang.String legalTradeMarks

originalFileName

protected java.lang.String originalFileName

productName

protected java.lang.String productName

productVersion

protected Version productVersion

specialBuild

protected java.lang.String specialBuild

targetType

protected TargetType targetType

charSetId

protected java.lang.String charSetId

languageId

protected java.lang.String languageId

theMessage

protected java.lang.String theMessage
Constructor Detail

ResourceOption

public ResourceOption()
Method Detail

setIcon

public void setIcon(java.io.File icon)

getIcon

public java.io.File getIcon()

setComments

public void setComments(java.lang.String comments)

getComments

public java.lang.String getComments()

getCompanyName

public java.lang.String getCompanyName()

setCompanyName

public void setCompanyName(java.lang.String companyName)

getFileDescription

public java.lang.String getFileDescription()

setFileDescription

public void setFileDescription(java.lang.String fileDescription)

getFileVersion

public Version getFileVersion()

setFileVersion

public void setFileVersion(java.lang.String fileVersion)

getIconFile

public java.io.File getIconFile()

setIconFile

public void setIconFile(java.io.File iconFile)

getInternalName

public java.lang.String getInternalName()

setInternalName

public void setInternalName(java.lang.String internalName)

getLanguageId

public java.lang.String getLanguageId()

setLanguageId

public void setLanguageId(java.lang.String languageId)

getLegalCopyright

public java.lang.String getLegalCopyright()

setLegalCopyright

public void setLegalCopyright(java.lang.String legalCopyright)

getLegalTradeMarks

public java.lang.String getLegalTradeMarks()

setLegalTradeMarks

public void setLegalTradeMarks(java.lang.String legalTradeMarks)

getOriginalFileName

public java.lang.String getOriginalFileName()

setOriginalFileName

public void setOriginalFileName(java.lang.String originalFileName)

getProductName

public java.lang.String getProductName()

setProductName

public void setProductName(java.lang.String productName)

getProductVersion

public Version getProductVersion()

setProductVersion

public void setProductVersion(java.lang.String productVersion)

getSpecialBuild

public java.lang.String getSpecialBuild()

setSpecialBuild

public void setSpecialBuild(java.lang.String specialBuild)

setTargetType

public void setTargetType(java.lang.String type)

getCharSetId

public java.lang.String getCharSetId()

setCharSetId

public void setCharSetId(java.lang.String charSetId)

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. This method does not add any commands to the commandline. Its functionality is outside the scope of the C++ compiler.

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.

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. This option is limited to Microsoft and INTEL compilers on Windows. The file is generated in the Link phase.

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

calculateRcFile

public java.io.File calculateRcFile(CppCompiler compiler)

creates

public java.util.List<java.lang.String> creates(CppCompiler compiler,
                                                CompilerPhase phase)
Returns a list of filenames representing the files that are created due to the presence of this compiler option.

Specified by:
creates in interface FileCreating<CppCompiler>
Parameters:
compiler - the compiler.
phase - the compilation phase.
Returns:
a list of files, possibly empty.

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.

addText

public void addText(java.lang.String msg)
Overrides:
addText in class org.apache.tools.ant.taskdefs.Echo

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Overrides:
execute in class TerpEcho
Throws:
org.apache.tools.ant.BuildException

terp - the ANT Tasks
v1.3.337

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