Class VisualStudioNETProjectWriter
- java.lang.Object
-
- net.sf.antcontrib.cpptasks.devstudio.VisualStudioNETProjectWriter
-
- All Implemented Interfaces:
ProjectWriter
public final class VisualStudioNETProjectWriter extends java.lang.Object implements ProjectWriter
Writes a Visual Studio.NET project file.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringfalseLiteralLiteral to represent a false value.private java.lang.StringtrueLiteralLiteral to represent a true value.private java.lang.StringversionVersion of VisualStudio.NET.
-
Constructor Summary
Constructors Constructor Description VisualStudioNETProjectWriter(java.lang.String versionArg, java.lang.String trueArg, java.lang.String falseArg)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidaddAttribute(org.xml.sax.helpers.AttributesImpl attributes, java.lang.String attrName, java.lang.String attrValue)Adds an non-namespace-qualified attribute to attribute list.private java.lang.StringgetAdditionalDependencies(TargetInfo linkTarget, java.util.List projectDependencies, java.util.Map targets, java.lang.String basePath)Get value of AdditionalDependencies property.private java.lang.StringgetAdditionalIncludeDirectories(java.lang.String baseDir, CommandLineCompilerConfiguration compilerConfig)Get value of AdditionalIncludeDirectories property.private CommandLineCompilerConfigurationgetBaseCompilerConfiguration(java.util.Hashtable targets)Gets the first recognized compiler from the compilation targets.private java.lang.StringgetBasicRuntimeChecks(CommandLineCompilerConfiguration compilerConfig)Get value of BasicRuntimeChecks property.private java.lang.StringgetCharacterSet(CommandLineCompilerConfiguration compilerConfig)Get character set for Windows API.private java.lang.StringgetConfigurationType(CCTask task)Gets the configuration type.private java.lang.StringgetDebugInformationFormat(CommandLineCompilerConfiguration compilerConfig)Get value of DebugInformationFormat property.private java.lang.StringgetDetect64BitPortabilityProblems(CommandLineCompilerConfiguration compilerConfig)Get value of Detect64BitPortabilityProblems property.private java.lang.StringgetLinkIncremental(CommandLineLinkerConfiguration linkerConfig)Get value of LinkIncremental property.private java.lang.StringgetOptimization(CommandLineCompilerConfiguration compilerConfig)Get value of Optimization property.private java.lang.StringgetPrecompiledHeaderFile(CommandLineCompilerConfiguration compilerConfig)Get value of PrecompiledHeaderFile property.private java.lang.StringgetPreprocessorDefinitions(CommandLineCompilerConfiguration compilerConfig, boolean isDebug)Get value of PreprocessorDefinitions property.private java.lang.StringgetRuntimeLibrary(CommandLineCompilerConfiguration compilerConfig, boolean isDebug)Get value of RuntimeLibrary property.private java.lang.StringgetSubsystem(CommandLineLinkerConfiguration linkerConfig)Get value of Subsystem property.private java.lang.StringgetTargetMachine(CommandLineLinkerConfiguration linkerConfig)Get value of TargetMachine property.private java.lang.StringgetUsePrecompiledHeader(CommandLineCompilerConfiguration compilerConfig)Get value of UsePrecompiledHeader property.private java.lang.StringgetWarningLevel(CommandLineCompilerConfiguration compilerConfig)Get value of WarningLevel property.private booleanisGroupMember(java.lang.String filter, java.io.File candidate)Returns true if the file has an extension that appears in the group filter.private voidwriteCompilerElement(org.xml.sax.ContentHandler content, boolean isDebug, java.lang.String basePath, CommandLineCompilerConfiguration compilerConfig)write the Compiler element.private voidwriteConfigurationStartTag(org.xml.sax.ContentHandler content, boolean isDebug, CCTask task, CommandLineCompilerConfiguration compilerConfig)Write the start tag of the Configuration element.private voidwriteFilteredSources(java.lang.String name, java.lang.String filter, java.lang.String basePath, java.io.File[] sortedSources, org.xml.sax.ContentHandler content)Writes a cluster of source files to the project.private voidwriteLinkerElement(org.xml.sax.ContentHandler content, boolean isDebug, java.util.List dependencies, java.lang.String basePath, TargetInfo linkTarget, java.util.Map targets)Write Tool element for linker.voidwriteProject(java.io.File fileName, CCTask task, ProjectDef projectDef, java.util.List sources, java.util.Hashtable targets, TargetInfo linkTarget)Writes a project definition file.
-
-
-
Constructor Detail
-
VisualStudioNETProjectWriter
public VisualStudioNETProjectWriter(java.lang.String versionArg, java.lang.String trueArg, java.lang.String falseArg)Constructor.- Parameters:
versionArg- String VisualStudio.NET versiontrueArg- literal to represent true, "true" in VC 2005.falseArg- literal to represent false, "false" in VC 2005.
-
-
Method Detail
-
getConfigurationType
private java.lang.String getConfigurationType(CCTask task)
Gets the configuration type.- Parameters:
task- cc task, may not be null.- Returns:
- configuration type
-
getCharacterSet
private java.lang.String getCharacterSet(CommandLineCompilerConfiguration compilerConfig)
Get character set for Windows API.- Parameters:
compilerConfig- compiler configuration, may not be null.- Returns:
- "1" is TCHAR is unicode, "0" if TCHAR is multi-byte.
-
writeConfigurationStartTag
private void writeConfigurationStartTag(org.xml.sax.ContentHandler content, boolean isDebug, CCTask task, CommandLineCompilerConfiguration compilerConfig) throws org.xml.sax.SAXExceptionWrite the start tag of the Configuration element.- Parameters:
content- serialization content handler.isDebug- if true, write a debug configuration.task- cc task.compilerConfig- compiler configuration.- Throws:
org.xml.sax.SAXException- thrown if serialization error.
-
getOptimization
private java.lang.String getOptimization(CommandLineCompilerConfiguration compilerConfig)
Get value of Optimization property.- Parameters:
compilerConfig- compiler configuration, may not be null.- Returns:
- value of Optimization property.
-
getAdditionalIncludeDirectories
private java.lang.String getAdditionalIncludeDirectories(java.lang.String baseDir, CommandLineCompilerConfiguration compilerConfig)Get value of AdditionalIncludeDirectories property.- Parameters:
compilerConfig- compiler configuration.baseDir- base for relative paths.- Returns:
- value of AdditionalIncludeDirectories property.
-
getPreprocessorDefinitions
private java.lang.String getPreprocessorDefinitions(CommandLineCompilerConfiguration compilerConfig, boolean isDebug)
Get value of PreprocessorDefinitions property.- Parameters:
compilerConfig- compiler configuration.isDebug- true if generating debug configuration.- Returns:
- value of PreprocessorDefinitions property.
-
getRuntimeLibrary
private java.lang.String getRuntimeLibrary(CommandLineCompilerConfiguration compilerConfig, boolean isDebug)
Get value of RuntimeLibrary property.- Parameters:
compilerConfig- compiler configuration.isDebug- true if generating debug configuration.- Returns:
- value of RuntimeLibrary property.
-
getUsePrecompiledHeader
private java.lang.String getUsePrecompiledHeader(CommandLineCompilerConfiguration compilerConfig)
Get value of UsePrecompiledHeader property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of UsePrecompiledHeader property.
-
getPrecompiledHeaderFile
private java.lang.String getPrecompiledHeaderFile(CommandLineCompilerConfiguration compilerConfig)
Get value of PrecompiledHeaderFile property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of PrecompiledHeaderFile property.
-
getBasicRuntimeChecks
private java.lang.String getBasicRuntimeChecks(CommandLineCompilerConfiguration compilerConfig)
Get value of BasicRuntimeChecks property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of BasicRuntimeChecks property.
-
getWarningLevel
private java.lang.String getWarningLevel(CommandLineCompilerConfiguration compilerConfig)
Get value of WarningLevel property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of WarningLevel property.
-
getDetect64BitPortabilityProblems
private java.lang.String getDetect64BitPortabilityProblems(CommandLineCompilerConfiguration compilerConfig)
Get value of Detect64BitPortabilityProblems property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of Detect64BitPortabilityProblems property.
-
getDebugInformationFormat
private java.lang.String getDebugInformationFormat(CommandLineCompilerConfiguration compilerConfig)
Get value of DebugInformationFormat property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of DebugInformationFormat property.
-
writeCompilerElement
private void writeCompilerElement(org.xml.sax.ContentHandler content, boolean isDebug, java.lang.String basePath, CommandLineCompilerConfiguration compilerConfig) throws org.xml.sax.SAXExceptionwrite the Compiler element.- Parameters:
content- serialization content handler.isDebug- true if generating debug configuration.basePath- base for relative file paths.compilerConfig- compiler configuration.- Throws:
org.xml.sax.SAXException- thrown if error during serialization.
-
getLinkIncremental
private java.lang.String getLinkIncremental(CommandLineLinkerConfiguration linkerConfig)
Get value of LinkIncremental property.- Parameters:
linkerConfig- linker configuration.- Returns:
- value of LinkIncremental property
-
getSubsystem
private java.lang.String getSubsystem(CommandLineLinkerConfiguration linkerConfig)
Get value of Subsystem property.- Parameters:
linkerConfig- linker configuration.- Returns:
- value of Subsystem property
-
getTargetMachine
private java.lang.String getTargetMachine(CommandLineLinkerConfiguration linkerConfig)
Get value of TargetMachine property.- Parameters:
linkerConfig- linker configuration.- Returns:
- value of TargetMachine property
-
getAdditionalDependencies
private java.lang.String getAdditionalDependencies(TargetInfo linkTarget, java.util.List projectDependencies, java.util.Map targets, java.lang.String basePath)
Get value of AdditionalDependencies property.- Parameters:
linkTarget- link target.projectDependencies- dependencies declared in project.targets- all targets.basePath- path to directory containing project file.- Returns:
- value of AdditionalDependencies property.
-
writeLinkerElement
private void writeLinkerElement(org.xml.sax.ContentHandler content, boolean isDebug, java.util.List dependencies, java.lang.String basePath, TargetInfo linkTarget, java.util.Map targets) throws org.xml.sax.SAXExceptionWrite Tool element for linker.- Parameters:
content- serialization content handler.isDebug- true if generating debug configuration.dependencies- project dependencies.basePath- path to directory containing project file.linkTarget- link target.targets- all targets.- Throws:
org.xml.sax.SAXException- thrown if error during serialization.
-
writeProject
public void writeProject(java.io.File fileName, CCTask task, ProjectDef projectDef, java.util.List sources, java.util.Hashtable targets, TargetInfo linkTarget) throws java.io.IOException, org.xml.sax.SAXExceptionWrites a project definition file.- Specified by:
writeProjectin interfaceProjectWriter- Parameters:
fileName- project name for file, should has .cbx extensiontask- cc task for which to write projectprojectDef- project elementsources- source filestargets- compilation targetslinkTarget- link target- Throws:
java.io.IOException- if I/O errororg.xml.sax.SAXException- if XML serialization error
-
writeFilteredSources
private void writeFilteredSources(java.lang.String name, java.lang.String filter, java.lang.String basePath, java.io.File[] sortedSources, org.xml.sax.ContentHandler content) throws org.xml.sax.SAXExceptionWrites a cluster of source files to the project.- Parameters:
name- name of filterfilter- file extensionsbasePath- base path for filessortedSources- array of source filescontent- generated project- Throws:
org.xml.sax.SAXException- if invalid content
-
isGroupMember
private boolean isGroupMember(java.lang.String filter, java.io.File candidate)Returns true if the file has an extension that appears in the group filter.- Parameters:
filter- String group filtercandidate- File file- Returns:
- boolean true if member of group
-
addAttribute
private static void addAttribute(org.xml.sax.helpers.AttributesImpl attributes, java.lang.String attrName, java.lang.String attrValue)Adds an non-namespace-qualified attribute to attribute list.- Parameters:
attributes- list of attributes.attrName- attribute name, may not be null.attrValue- attribute value, if null attribute is not added.
-
getBaseCompilerConfiguration
private CommandLineCompilerConfiguration getBaseCompilerConfiguration(java.util.Hashtable targets)
Gets the first recognized compiler from the compilation targets.- Parameters:
targets- compilation targets- Returns:
- representative (hopefully) compiler configuration
-
-