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 void
addAttribute
(AttributesImpl attributes, String attrName, String attrValue) Adds an non-namespace-qualified attribute to attribute list.private String
getAdditionalDependencies
(TargetInfo linkTarget, List projectDependencies, Map targets, String basePath) Get value of AdditionalDependencies property.private String
getAdditionalIncludeDirectories
(String baseDir, CommandLineCompilerConfiguration compilerConfig) Get value of AdditionalIncludeDirectories property.private CommandLineCompilerConfiguration
getBaseCompilerConfiguration
(Hashtable targets) Gets the first recognized compiler from the compilation targets.private String
getBasicRuntimeChecks
(CommandLineCompilerConfiguration compilerConfig) Get value of BasicRuntimeChecks property.private String
getCharacterSet
(CommandLineCompilerConfiguration compilerConfig) Get character set for Windows API.private String
getConfigurationType
(CCTask task) Gets the configuration type.private String
getDebugInformationFormat
(CommandLineCompilerConfiguration compilerConfig) Get value of DebugInformationFormat property.private String
getDetect64BitPortabilityProblems
(CommandLineCompilerConfiguration compilerConfig) Get value of Detect64BitPortabilityProblems property.private String
getLinkIncremental
(CommandLineLinkerConfiguration linkerConfig) Get value of LinkIncremental property.private String
getOptimization
(CommandLineCompilerConfiguration compilerConfig) Get value of Optimization property.private String
getPrecompiledHeaderFile
(CommandLineCompilerConfiguration compilerConfig) Get value of PrecompiledHeaderFile property.private String
getPreprocessorDefinitions
(CommandLineCompilerConfiguration compilerConfig, boolean isDebug) Get value of PreprocessorDefinitions property.private String
getRuntimeLibrary
(CommandLineCompilerConfiguration compilerConfig, boolean isDebug) Get value of RuntimeLibrary property.private String
getSubsystem
(CommandLineLinkerConfiguration linkerConfig) Get value of Subsystem property.private String
getTargetMachine
(CommandLineLinkerConfiguration linkerConfig) Get value of TargetMachine property.private String
getUsePrecompiledHeader
(CommandLineCompilerConfiguration compilerConfig) Get value of UsePrecompiledHeader property.private String
getWarningLevel
(CommandLineCompilerConfiguration compilerConfig) Get value of WarningLevel property.private boolean
isGroupMember
(String filter, File candidate) Returns true if the file has an extension that appears in the group filter.private void
writeCompilerElement
(ContentHandler content, boolean isDebug, String basePath, CommandLineCompilerConfiguration compilerConfig) write the Compiler element.private void
writeConfigurationStartTag
(ContentHandler content, boolean isDebug, CCTask task, CommandLineCompilerConfiguration compilerConfig) Write the start tag of the Configuration element.private void
writeFilteredSources
(String name, String filter, String basePath, File[] sortedSources, ContentHandler content) Writes a cluster of source files to the project.private void
writeLinkerElement
(ContentHandler content, boolean isDebug, List dependencies, String basePath, TargetInfo linkTarget, Map targets) Write Tool element for linker.void
writeProject
(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:
writeProject
in 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
-