Class ProjectDef

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
net.sf.antcontrib.cpptasks.ide.ProjectDef
All Implemented Interfaces:
Cloneable

public final class ProjectDef extends org.apache.tools.ant.types.DataType
Requests the creation of an IDE project file. Experimental. Implementation status: msdev5, msdev6 and cbuilderx generate reasonable project files for simple projects, xcode and msdev7 and msdev71 capture source file lists and a few settings.
Author:
Curt Arnold
  • Field Summary

    Fields inherited from class org.apache.tools.ant.types.DataType

    checked, ref

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add comment for the generated project file.
    void
    Add a dependency definition to the project.
    void
    Required by documentation generator.
    void
    execute(CCTask task, List sources, Hashtable targets, TargetInfo linkTarget)
    Executes the task.
     
     
    Get name.
    Gets the object files directory.
    void
    Sets the directory used for object files.
    boolean
    Gets whether an existing project file should be overwritten, default is true.
    boolean
    Determine if this def should be used.
    void
    setClassname(String className)
    Class name for a user-supplied project writer.
    void
    setFailonerror(boolean value)
    Sets whether a failure to write the project file should cause the task to fail.
    void
    setIf(String propName)
    Sets the property name for the 'if' condition.
    void
    setName(String value)
    Set name.
    void
    setOutfile(File outfile)
    Sets the name for the generated project file.
    void
    setOverwrite(boolean value)
    Sets whether an existing project file should be overwritten, default is true.
    void
    Set project type.
    void
    setUnless(String propName)
    Set the property name for the 'unless' condition.

    Methods inherited from class org.apache.tools.ant.types.DataType

    checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, setRefid, tooManyAttributes, toString

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ProjectDef

      public ProjectDef()
      Constructor.
  • Method Details

    • setType

      public void setType(ProjectWriterEnum value)
      Set project type. Supported project formats
      cbuilderx Borland C++BuilderX
      msvc5 Microsoft Visual C++ 97
      msvc6 Microsoft Visual C++ 6
      msvc7 Microsoft Visual C++.NET
      msvc71 Microsoft Visual C++.NET 2003
      msvc8 Microsoft Visual C++ 2005
      msvc9 Microsoft Visual C++ 2008
      xcode Apple Xcode
      Parameters:
      value - new value
    • setOutfile

      public void setOutfile(File outfile)
      Sets the name for the generated project file.
      Parameters:
      outfile - output file name
    • setFailonerror

      public void setFailonerror(boolean value)
      Sets whether a failure to write the project file should cause the task to fail. Default is true.
      Parameters:
      value - new value
    • setOverwrite

      public void setOverwrite(boolean value)
      Sets whether an existing project file should be overwritten, default is true. If false and the project file exists, the value of failonerror will determine if the task fails.
      Parameters:
      value - new value
    • getOverwrite

      public boolean getOverwrite()
      Gets whether an existing project file should be overwritten, default is true. If false and the project file exists, the value of failonerror will determine if the task fails.
      Returns:
      value
    • isActive

      public boolean isActive()
      Determine if this def should be used. Definition will be active if the "if" variable (if specified) is set and the "unless" variable (if specified) is not set and that all reference or extended definitions are active
      Returns:
      true if processor is active
    • setClassname

      public void setClassname(String className)
      Class name for a user-supplied project writer. Use the "type" attribute to specify built-in project writer implementations.
      Parameters:
      className - full class name
    • setIf

      public void setIf(String propName)
      Sets the property name for the 'if' condition. The configuration will be ignored unless the property is defined. The value of the property is insignificant, but values that would imply misinterpretation ("false", "no") will throw an exception when evaluated.
      Parameters:
      propName - name of property
    • setUnless

      public void setUnless(String propName)
      Set the property name for the 'unless' condition. If named property is set, the configuration will be ignored. The value of the property is insignificant, but values that would imply misinterpretation ("false", "no") of the behavior will throw an exception when evaluated.
      Parameters:
      propName - name of property
    • getName

      public String getName()
      Get name.
      Returns:
      String name
    • setName

      public void setName(String value)
      Set name.
      Parameters:
      value - String name
    • execute

      public void execute(CCTask task, List sources, Hashtable targets, TargetInfo linkTarget)
      Executes the task. Compiles the given files.
      Parameters:
      task - cc task
      sources - source files (includes headers)
      targets - compilation targets
      linkTarget - link target
    • getObjdir

      public File getObjdir()
      Gets the object files directory.
      Returns:
      directory, may be null.
    • getObjdir

      public void getObjdir(File oDir)
      Sets the directory used for object files. If not specified, the object files directory from cc task will be used.
      Parameters:
      oDir - object file directory.
    • addDependency

      public void addDependency(DependencyDef dependency)
      Add a dependency definition to the project.
      Parameters:
      dependency - dependency.
    • getDependencies

      public List getDependencies()
    • addComment

      public void addComment(CommentDef comment)
      Add comment for the generated project file.
      Parameters:
      comment - comment, may not be null.
    • getComments

      public List getComments()
    • execute

      public void execute()
      Required by documentation generator.