Class VisualStudioNETProjectWriter
java.lang.Object
net.sf.antcontrib.cpptasks.devstudio.VisualStudioNETProjectWriter
- All Implemented Interfaces:
ProjectWriter
Writes a Visual Studio.NET project file.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVisualStudioNETProjectWriter(String versionArg, String trueArg, String falseArg) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddAttribute(AttributesImpl attributes, String attrName, String attrValue) Adds an non-namespace-qualified attribute to attribute list.private StringgetAdditionalDependencies(TargetInfo linkTarget, List projectDependencies, Map targets, String basePath) Get value of AdditionalDependencies property.private StringgetAdditionalIncludeDirectories(String baseDir, CommandLineCompilerConfiguration compilerConfig) Get value of AdditionalIncludeDirectories property.private CommandLineCompilerConfigurationgetBaseCompilerConfiguration(Hashtable targets) Gets the first recognized compiler from the compilation targets.private StringgetBasicRuntimeChecks(CommandLineCompilerConfiguration compilerConfig) Get value of BasicRuntimeChecks property.private StringgetCharacterSet(CommandLineCompilerConfiguration compilerConfig) Get character set for Windows API.private StringgetConfigurationType(CCTask task) Gets the configuration type.private StringgetDebugInformationFormat(CommandLineCompilerConfiguration compilerConfig) Get value of DebugInformationFormat property.private StringgetDetect64BitPortabilityProblems(CommandLineCompilerConfiguration compilerConfig) Get value of Detect64BitPortabilityProblems property.private StringgetLinkIncremental(CommandLineLinkerConfiguration linkerConfig) Get value of LinkIncremental property.private StringgetOptimization(CommandLineCompilerConfiguration compilerConfig) Get value of Optimization property.private StringgetPrecompiledHeaderFile(CommandLineCompilerConfiguration compilerConfig) Get value of PrecompiledHeaderFile property.private StringgetPreprocessorDefinitions(CommandLineCompilerConfiguration compilerConfig, boolean isDebug) Get value of PreprocessorDefinitions property.private StringgetRuntimeLibrary(CommandLineCompilerConfiguration compilerConfig, boolean isDebug) Get value of RuntimeLibrary property.private StringgetSubsystem(CommandLineLinkerConfiguration linkerConfig) Get value of Subsystem property.private StringgetTargetMachine(CommandLineLinkerConfiguration linkerConfig) Get value of TargetMachine property.private StringgetUsePrecompiledHeader(CommandLineCompilerConfiguration compilerConfig) Get value of UsePrecompiledHeader property.private StringgetWarningLevel(CommandLineCompilerConfiguration compilerConfig) Get value of WarningLevel property.private booleanisGroupMember(String filter, File candidate) Returns true if the file has an extension that appears in the group filter.private voidwriteCompilerElement(ContentHandler content, boolean isDebug, String basePath, CommandLineCompilerConfiguration compilerConfig) write the Compiler element.private voidwriteConfigurationStartTag(ContentHandler content, boolean isDebug, CCTask task, CommandLineCompilerConfiguration compilerConfig) Write the start tag of the Configuration element.private voidwriteFilteredSources(String name, String filter, String basePath, File[] sortedSources, ContentHandler content) Writes a cluster of source files to the project.private voidwriteLinkerElement(ContentHandler content, boolean isDebug, List dependencies, String basePath, TargetInfo linkTarget, Map targets) Write Tool element for linker.voidwriteProject(File fileName, CCTask task, ProjectDef projectDef, List sources, Hashtable targets, TargetInfo linkTarget) Writes a project definition file.
-
Field Details
-
version
Version of VisualStudio.NET. -
trueLiteral
Literal to represent a true value. -
falseLiteral
Literal to represent a false value.
-
-
Constructor Details
-
VisualStudioNETProjectWriter
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 Details
-
getConfigurationType
Gets the configuration type.- Parameters:
task- cc task, may not be null.- Returns:
- configuration type
-
getCharacterSet
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(ContentHandler content, boolean isDebug, CCTask task, CommandLineCompilerConfiguration compilerConfig) throws SAXException Write 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:
SAXException- thrown if serialization error.
-
getOptimization
Get value of Optimization property.- Parameters:
compilerConfig- compiler configuration, may not be null.- Returns:
- value of Optimization property.
-
getAdditionalIncludeDirectories
private String getAdditionalIncludeDirectories(String baseDir, CommandLineCompilerConfiguration compilerConfig) Get value of AdditionalIncludeDirectories property.- Parameters:
baseDir- base for relative paths.compilerConfig- compiler configuration.- Returns:
- value of AdditionalIncludeDirectories property.
-
getPreprocessorDefinitions
private 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
Get value of RuntimeLibrary property.- Parameters:
compilerConfig- compiler configuration.isDebug- true if generating debug configuration.- Returns:
- value of RuntimeLibrary property.
-
getUsePrecompiledHeader
Get value of UsePrecompiledHeader property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of UsePrecompiledHeader property.
-
getPrecompiledHeaderFile
Get value of PrecompiledHeaderFile property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of PrecompiledHeaderFile property.
-
getBasicRuntimeChecks
Get value of BasicRuntimeChecks property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of BasicRuntimeChecks property.
-
getWarningLevel
Get value of WarningLevel property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of WarningLevel property.
-
getDetect64BitPortabilityProblems
Get value of Detect64BitPortabilityProblems property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of Detect64BitPortabilityProblems property.
-
getDebugInformationFormat
Get value of DebugInformationFormat property.- Parameters:
compilerConfig- compiler configuration.- Returns:
- value of DebugInformationFormat property.
-
writeCompilerElement
private void writeCompilerElement(ContentHandler content, boolean isDebug, String basePath, CommandLineCompilerConfiguration compilerConfig) throws SAXException write the Compiler element.- Parameters:
content- serialization content handler.isDebug- true if generating debug configuration.basePath- base for relative file paths.compilerConfig- compiler configuration.- Throws:
SAXException- thrown if error during serialization.
-
getLinkIncremental
Get value of LinkIncremental property.- Parameters:
linkerConfig- linker configuration.- Returns:
- value of LinkIncremental property
-
getSubsystem
Get value of Subsystem property.- Parameters:
linkerConfig- linker configuration.- Returns:
- value of Subsystem property
-
getTargetMachine
Get value of TargetMachine property.- Parameters:
linkerConfig- linker configuration.- Returns:
- value of TargetMachine property
-
getAdditionalDependencies
private String getAdditionalDependencies(TargetInfo linkTarget, List projectDependencies, Map targets, 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(ContentHandler content, boolean isDebug, List dependencies, String basePath, TargetInfo linkTarget, Map targets) throws SAXException Write 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:
SAXException- thrown if error during serialization.
-
writeProject
public void writeProject(File fileName, CCTask task, ProjectDef projectDef, List sources, Hashtable targets, TargetInfo linkTarget) throws IOException, SAXException Writes 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:
IOException- if I/O errorSAXException- if XML serialization error
-
writeFilteredSources
private void writeFilteredSources(String name, String filter, String basePath, File[] sortedSources, ContentHandler content) throws SAXException Writes 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:
SAXException- if invalid content
-
isGroupMember
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
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
Gets the first recognized compiler from the compilation targets.- Parameters:
targets- compilation targets- Returns:
- representative (hopefully) compiler configuration
-