public final class VisualStudioNETProjectWriter extends java.lang.Object implements ProjectWriter
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
falseLiteral
Literal to represent a false value.
|
private java.lang.String |
trueLiteral
Literal to represent a true value.
|
private java.lang.String |
version
Version of VisualStudio.NET.
|
Constructor and Description |
---|
VisualStudioNETProjectWriter(java.lang.String versionArg,
java.lang.String trueArg,
java.lang.String falseArg)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
private java.lang.String |
getAdditionalDependencies(TargetInfo linkTarget,
java.util.List projectDependencies,
java.util.Map targets,
java.lang.String basePath)
Get value of AdditionalDependencies property.
|
private java.lang.String |
getAdditionalIncludeDirectories(java.lang.String baseDir,
CommandLineCompilerConfiguration compilerConfig)
Get value of AdditionalIncludeDirectories property.
|
private CommandLineCompilerConfiguration |
getBaseCompilerConfiguration(java.util.Hashtable targets)
Gets the first recognized compiler from the
compilation targets.
|
private java.lang.String |
getBasicRuntimeChecks(CommandLineCompilerConfiguration compilerConfig)
Get value of BasicRuntimeChecks property.
|
private java.lang.String |
getCharacterSet(CommandLineCompilerConfiguration compilerConfig)
Get character set for Windows API.
|
private java.lang.String |
getConfigurationType(CCTask task)
Gets the configuration type.
|
private java.lang.String |
getDebugInformationFormat(CommandLineCompilerConfiguration compilerConfig)
Get value of DebugInformationFormat property.
|
private java.lang.String |
getDetect64BitPortabilityProblems(CommandLineCompilerConfiguration compilerConfig)
Get value of Detect64BitPortabilityProblems property.
|
private java.lang.String |
getLinkIncremental(CommandLineLinkerConfiguration linkerConfig)
Get value of LinkIncremental property.
|
private java.lang.String |
getOptimization(CommandLineCompilerConfiguration compilerConfig)
Get value of Optimization property.
|
private java.lang.String |
getPrecompiledHeaderFile(CommandLineCompilerConfiguration compilerConfig)
Get value of PrecompiledHeaderFile property.
|
private java.lang.String |
getPreprocessorDefinitions(CommandLineCompilerConfiguration compilerConfig,
boolean isDebug)
Get value of PreprocessorDefinitions property.
|
private java.lang.String |
getRuntimeLibrary(CommandLineCompilerConfiguration compilerConfig,
boolean isDebug)
Get value of RuntimeLibrary property.
|
private java.lang.String |
getSubsystem(CommandLineLinkerConfiguration linkerConfig)
Get value of Subsystem property.
|
private java.lang.String |
getTargetMachine(CommandLineLinkerConfiguration linkerConfig)
Get value of TargetMachine property.
|
private java.lang.String |
getUsePrecompiledHeader(CommandLineCompilerConfiguration compilerConfig)
Get value of UsePrecompiledHeader property.
|
private java.lang.String |
getWarningLevel(CommandLineCompilerConfiguration compilerConfig)
Get value of WarningLevel property.
|
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.
|
private void |
writeCompilerElement(org.xml.sax.ContentHandler content,
boolean isDebug,
java.lang.String basePath,
CommandLineCompilerConfiguration compilerConfig)
write the Compiler element.
|
private void |
writeConfigurationStartTag(org.xml.sax.ContentHandler content,
boolean isDebug,
CCTask task,
CommandLineCompilerConfiguration compilerConfig)
Write the start tag of the Configuration element.
|
private void |
writeFilteredSources(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 void |
writeLinkerElement(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.
|
void |
writeProject(java.io.File fileName,
CCTask task,
ProjectDef projectDef,
java.util.List sources,
java.util.Hashtable targets,
TargetInfo linkTarget)
Writes a project definition file.
|
private final java.lang.String version
private final java.lang.String trueLiteral
private final java.lang.String falseLiteral
public VisualStudioNETProjectWriter(java.lang.String versionArg, java.lang.String trueArg, java.lang.String falseArg)
versionArg
- String VisualStudio.NET versiontrueArg
- literal to represent true, "true" in VC 2005.falseArg
- literal to represent false, "false" in VC 2005.private java.lang.String getConfigurationType(CCTask task)
task
- cc task, may not be null.private java.lang.String getCharacterSet(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration, may not be null.private void writeConfigurationStartTag(org.xml.sax.ContentHandler content, boolean isDebug, CCTask task, CommandLineCompilerConfiguration compilerConfig) throws org.xml.sax.SAXException
content
- serialization content handler.isDebug
- if true, write a debug configuration.task
- cc task.compilerConfig
- compiler configuration.org.xml.sax.SAXException
- thrown if serialization error.private java.lang.String getOptimization(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration, may not be null.private java.lang.String getAdditionalIncludeDirectories(java.lang.String baseDir, CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration.baseDir
- base for relative paths.private java.lang.String getPreprocessorDefinitions(CommandLineCompilerConfiguration compilerConfig, boolean isDebug)
compilerConfig
- compiler configuration.isDebug
- true if generating debug configuration.private java.lang.String getRuntimeLibrary(CommandLineCompilerConfiguration compilerConfig, boolean isDebug)
compilerConfig
- compiler configuration.isDebug
- true if generating debug configuration.private java.lang.String getUsePrecompiledHeader(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration.private java.lang.String getPrecompiledHeaderFile(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration.private java.lang.String getBasicRuntimeChecks(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration.private java.lang.String getWarningLevel(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration.private java.lang.String getDetect64BitPortabilityProblems(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration.private java.lang.String getDebugInformationFormat(CommandLineCompilerConfiguration compilerConfig)
compilerConfig
- compiler configuration.private void writeCompilerElement(org.xml.sax.ContentHandler content, boolean isDebug, java.lang.String basePath, CommandLineCompilerConfiguration compilerConfig) throws org.xml.sax.SAXException
content
- serialization content handler.isDebug
- true if generating debug configuration.basePath
- base for relative file paths.compilerConfig
- compiler configuration.org.xml.sax.SAXException
- thrown if error during serialization.private java.lang.String getLinkIncremental(CommandLineLinkerConfiguration linkerConfig)
linkerConfig
- linker configuration.private java.lang.String getSubsystem(CommandLineLinkerConfiguration linkerConfig)
linkerConfig
- linker configuration.private java.lang.String getTargetMachine(CommandLineLinkerConfiguration linkerConfig)
linkerConfig
- linker configuration.private java.lang.String getAdditionalDependencies(TargetInfo linkTarget, java.util.List projectDependencies, java.util.Map targets, java.lang.String basePath)
linkTarget
- link target.projectDependencies
- dependencies declared in project.targets
- all targets.basePath
- path to directory containing project file.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.SAXException
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.org.xml.sax.SAXException
- thrown if error during serialization.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.SAXException
writeProject
in interface ProjectWriter
fileName
- project name for file, should has .cbx extensiontask
- cc task for which to write projectprojectDef
- project elementsources
- source filestargets
- compilation targetslinkTarget
- link targetjava.io.IOException
- if I/O errororg.xml.sax.SAXException
- if XML serialization errorprivate 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.SAXException
name
- name of filterfilter
- file extensionsbasePath
- base path for filessortedSources
- array of source filescontent
- generated projectorg.xml.sax.SAXException
- if invalid contentprivate boolean isGroupMember(java.lang.String filter, java.io.File candidate)
filter
- String group filtercandidate
- File fileprivate static void addAttribute(org.xml.sax.helpers.AttributesImpl attributes, java.lang.String attrName, java.lang.String attrValue)
attributes
- list of attributes.attrName
- attribute name, may not be null.attrValue
- attribute value, if null attribute is not added.private CommandLineCompilerConfiguration getBaseCompilerConfiguration(java.util.Hashtable targets)
targets
- compilation targets