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 orProject
objects. 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 theantcall
orforeach
tasks.- Author:
- Christophe Labouisse
- See Also:
- Ant contrib tasks for
the
foreach
task.
-
-
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.Project
getAntProject()
Returns the underlying Ant project.Graph
getGraph()
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 byProjectHelper
which 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 byProjectHelper
which is at least a File.- Parameters:
source
- The source for XML configuration.properties
- a set of properties to be preset when opening the graph ornull
if 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_NODE
attribute set. If the project element has a valid default target, the corresponding node will be the graph start target. depends
attributes on targets will be translated into links.antcall
s or the contributedforeach
task will be translated in links with theLink.ATTR_WEAK_LINK
set.
- Specified by:
getGraph
in 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
-
-