Class DevStudioProjectWriter
- java.lang.Object
-
- net.sf.antcontrib.cpptasks.devstudio.DevStudioProjectWriter
-
- All Implemented Interfaces:
ProjectWriter
public final class DevStudioProjectWriter extends java.lang.Object implements ProjectWriter
Writes a Microsoft Visual Studio 97 or Visual Studio 6 project file. Status: Collects file list but does not pick up libraries and settings from project.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
version
Visual Studio version.
-
Constructor Summary
Constructors Constructor Description DevStudioProjectWriter(java.lang.String versionArg)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private CommandLineCompilerConfiguration
getBaseCompilerConfiguration(java.util.Hashtable targets)
Gets the first recognized compiler from the compilation targets.private java.io.File[]
getSources(java.util.List sourceList)
Get alphabetized array of source files.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 static java.lang.String
toProjectName(java.lang.String name)
private static void
writeComments(java.io.Writer writer, java.util.List comments)
private void
writeCompileOptions(java.io.Writer writer, boolean isDebug, java.lang.String baseDir, CommandLineCompilerConfiguration compilerConfig)
Writes compiler options.private void
writeConfig(java.io.Writer writer, boolean isDebug, java.util.List dependencies, java.lang.String basePath, CommandLineCompilerConfiguration compilerConfig, TargetInfo linkTarget, java.util.Hashtable targets)
private void
writeLinkOptions(java.io.Writer writer, boolean isDebug, java.util.List dependencies, java.lang.String basePath, TargetInfo linkTarget, java.util.Hashtable targets)
Writes link options.private void
writeMessage(java.io.Writer writer, java.lang.String projectName, java.lang.String targtype)
Writes "This is not a makefile" warning.void
writeProject(java.io.File fileName, CCTask task, ProjectDef projectDef, java.util.List files, java.util.Hashtable targets, TargetInfo linkTarget)
Writes a project definition file.private void
writeSource(java.io.Writer writer, java.lang.String basePath, java.io.File groupMember)
Writes the entry for one source file in the project.private void
writeWorkspace(java.io.Writer writer, ProjectDef project, java.lang.String projectName, java.io.File dspFile)
private static void
writeWorkspaceProject(java.io.Writer writer, java.lang.String projectName, java.lang.String projectFile, java.util.List dependsOn)
-
-
-
Method Detail
-
toProjectName
private static java.lang.String toProjectName(java.lang.String name)
-
writeProject
public void writeProject(java.io.File fileName, CCTask task, ProjectDef projectDef, java.util.List files, java.util.Hashtable targets, TargetInfo linkTarget) throws java.io.IOException
Writes a project definition file.- Specified by:
writeProject
in interfaceProjectWriter
- Parameters:
fileName
- File name base, writer may append appropriate extensiontask
- cc task for which to write projectprojectDef
- project elementfiles
- source filestargets
- compilation targetslinkTarget
- link target- Throws:
java.io.IOException
- if error writing project file
-
writeConfig
private void writeConfig(java.io.Writer writer, boolean isDebug, java.util.List dependencies, java.lang.String basePath, CommandLineCompilerConfiguration compilerConfig, TargetInfo linkTarget, java.util.Hashtable targets) throws java.io.IOException
- Throws:
java.io.IOException
-
writeWorkspaceProject
private static void writeWorkspaceProject(java.io.Writer writer, java.lang.String projectName, java.lang.String projectFile, java.util.List dependsOn) throws java.io.IOException
- Throws:
java.io.IOException
-
writeWorkspace
private void writeWorkspace(java.io.Writer writer, ProjectDef project, java.lang.String projectName, java.io.File dspFile) throws java.io.IOException
- Throws:
java.io.IOException
-
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
-
writeSource
private void writeSource(java.io.Writer writer, java.lang.String basePath, java.io.File groupMember) throws java.io.IOException
Writes the entry for one source file in the project.- Parameters:
writer
- Writer writerbasePath
- String base path for projectgroupMember
- File project source file- Throws:
java.io.IOException
- if error writing project file
-
getSources
private java.io.File[] getSources(java.util.List sourceList)
Get alphabetized array of source files.- Parameters:
sourceList
- list of source files- Returns:
- File[] source files
-
writeMessage
private void writeMessage(java.io.Writer writer, java.lang.String projectName, java.lang.String targtype) throws java.io.IOException
Writes "This is not a makefile" warning.- Parameters:
writer
- Writer writerprojectName
- String project nametargtype
- String target type- Throws:
java.io.IOException
- if error writing project
-
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
-
writeCompileOptions
private void writeCompileOptions(java.io.Writer writer, boolean isDebug, java.lang.String baseDir, CommandLineCompilerConfiguration compilerConfig) throws java.io.IOException
Writes compiler options.- Parameters:
writer
- Writer writerisDebug
- true if debug.baseDir
- String base directorycompilerConfig
- compiler configuration- Throws:
java.io.IOException
- if error on writing project
-
writeLinkOptions
private void writeLinkOptions(java.io.Writer writer, boolean isDebug, java.util.List dependencies, java.lang.String basePath, TargetInfo linkTarget, java.util.Hashtable targets) throws java.io.IOException
Writes link options.- Parameters:
writer
- Writer writerbasePath
- String base pathdependencies
- project dependencies, used to suppress explicit linking.linkTarget
- TargetInfo link targettargets
- Hashtable all targets- Throws:
java.io.IOException
- if unable to write to project file
-
writeComments
private static void writeComments(java.io.Writer writer, java.util.List comments) throws java.io.IOException
- Throws:
java.io.IOException
-
-