Class 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • version

        private java.lang.String version
        Visual Studio version.
    • Constructor Detail

      • DevStudioProjectWriter

        public DevStudioProjectWriter​(java.lang.String versionArg)
        Constructor.
        Parameters:
        versionArg - String Visual Studio version.
    • 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 interface ProjectWriter
        Parameters:
        fileName - File name base, writer may append appropriate extension
        task - cc task for which to write project
        projectDef - project element
        files - source files
        targets - compilation targets
        linkTarget - 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 filter
        candidate - 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 writer
        basePath - String base path for project
        groupMember - 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 writer
        projectName - String project name
        targtype - 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 writer
        isDebug - true if debug.
        baseDir - String base directory
        compilerConfig - 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 writer
        basePath - String base path
        dependencies - project dependencies, used to suppress explicit linking.
        linkTarget - TargetInfo link target
        targets - 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