Class CBuilderXProjectWriter

  • All Implemented Interfaces:
    ProjectWriter

    public final class CBuilderXProjectWriter
    extends java.lang.Object
    implements ProjectWriter
    Writes a CBuilderX 1.0 project file.
    • Constructor Detail

      • CBuilderXProjectWriter

        public CBuilderXProjectWriter()
        Constructor.
    • Method Detail

      • writeProject

        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
        Writes a project definition file.
        Specified by:
        writeProject in interface ProjectWriter
        Parameters:
        fileName - project name for file, should has .cbx extension
        task - cc task for which to write project
        projectDef - project element
        sources - source files
        targets - compilation targets
        linkTarget - link target
        Throws:
        java.io.IOException - if I/O error
        org.xml.sax.SAXException - if XML serialization error
      • getBuildType

        private java.lang.String getBuildType​(CCTask task)
        Gets build type from link target.
        Parameters:
        task - CCTask current task
        Returns:
        String build type
      • getActivePlatform

        private java.lang.String getActivePlatform​(CCTask task)
        Gets active platform.
        Parameters:
        task - CCTask cc task
        Returns:
        String platform identifier
      • 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.lang.String baseDir,
                                         CBuilderXProjectWriter.PropertyWriter writer,
                                         CommandLineCompilerConfiguration compilerConfig)
                                  throws org.xml.sax.SAXException
        Writes elements corresponding to compilation options.
        Parameters:
        baseDir - String base directory
        writer - PropertyWriter property writer
        compilerConfig - representative configuration
        Throws:
        org.xml.sax.SAXException - if I/O error or illegal content
      • writeLinkOptions

        private void writeLinkOptions​(java.lang.String baseDir,
                                      CBuilderXProjectWriter.PropertyWriter writer,
                                      TargetInfo linkTarget)
                               throws org.xml.sax.SAXException
        Writes elements corresponding to link options.
        Parameters:
        baseDir - String base directory
        writer - PropertyWriter property writer
        linkTarget - TargetInfo link target
        Throws:
        org.xml.sax.SAXException - if I/O error or illegal content
      • writeLdArgs

        private void writeLdArgs​(CBuilderXProjectWriter.PropertyWriter writer,
                                 java.lang.String linkID,
                                 java.lang.String[] preArgs)
                          throws org.xml.sax.SAXException
        Writes ld linker options to project file.
        Parameters:
        writer - PropertyWriter property writer
        linkID - String linker identifier
        preArgs - String[] linker arguments
        Throws:
        org.xml.sax.SAXException - thrown if unable to write option
      • writeIlinkArgs

        private void writeIlinkArgs​(CBuilderXProjectWriter.PropertyWriter writer,
                                    java.lang.String linkID,
                                    java.lang.String[] args)
                             throws org.xml.sax.SAXException
        Writes ilink32 linker options to project file.
        Parameters:
        writer - PropertyWriter property writer
        linkID - String linker identifier
        preArgs - String[] linker arguments
        Throws:
        org.xml.sax.SAXException - thrown if unable to write option