Package net.ggtools.grand.ant
Class AntProject
- java.lang.Object
-
- net.ggtools.grand.ant.AntProject
-
- All Implemented Interfaces:
GraphProducer
public class AntProject extends Object implements GraphProducer
A graph producer from Ant build files orProjectobjects. The nodes will be the project's target and the links will be the dependencies between targets. Beside hard dependencies, this producer is also able to create weak links from dependencies introduced by the use of theantcallorforeachtasks.- Author:
- Christophe Labouisse
- See Also:
- Ant contrib tasks for
the
foreachtask.
-
-
Constructor Summary
Constructors Constructor Description AntProject(File source)Creates a new project from an Ant build file.AntProject(File source, Properties properties)Creates a new project from an Ant build file.AntProject(org.apache.tools.ant.Project project)Creates a new project from an existing Ant project.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.tools.ant.ProjectgetAntProject()Returns the underlying Ant project.GraphgetGraph()Convert an Ant project to a Grand Graph.
-
-
-
Constructor Detail
-
AntProject
public AntProject(File source) throws GrandException
Creates a new project from an Ant build file. The source object can be anything supported byProjectHelperwhich is at least a File.- Parameters:
source- The source for XML configuration.- Throws:
GrandException- if the project cannot be loaded.- See Also:
ProjectHelper.parse(org.apache.tools.ant.Project, java.lang.Object)
-
AntProject
public AntProject(File source, Properties properties) throws GrandException
Creates a new project from an Ant build file. The source object can be anything supported byProjectHelperwhich is at least a File.- Parameters:
source- The source for XML configuration.properties- a set of properties to be preset when opening the graph ornullif no properties should be preset.- Throws:
GrandException- if the project cannot be loaded.- See Also:
ProjectHelper.parse(org.apache.tools.ant.Project, java.lang.Object)
-
AntProject
public AntProject(org.apache.tools.ant.Project project)
Creates a new project from an existing Ant project.- Parameters:
project- project to create the graph from.
-
-
Method Detail
-
getAntProject
public final org.apache.tools.ant.Project getAntProject()
Returns the underlying Ant project.- Returns:
- underlying Ant project.
-
getGraph
public final Graph getGraph() throws GrandException
Convert an Ant project to a Grand Graph. The conversion is done in several steps:- Each Ant target will be converted to a Grand Node using both the
target's name and description the the node's ones. Targets with a non
empty description will be converted to Nodes with the
Node.ATTR_MAIN_NODEattribute set. If the project element has a valid default target, the corresponding node will be the graph start target. dependsattributes on targets will be translated into links.antcalls or the contributedforeachtask will be translated in links with theLink.ATTR_WEAK_LINKset.
- Specified by:
getGraphin interfaceGraphProducer- Returns:
- a graph representing the dependency of the Ant project.
- Throws:
GrandException- if the project cannot be converted to a graph.- See Also:
GraphProducer.getGraph()
- Each Ant target will be converted to a Grand Node using both the
target's name and description the the node's ones. Targets with a non
empty description will be converted to Nodes with the
-
-