org.schmant.project
Interface ProjectDependencies

All Superinterfaces:
TaskDependency
All Known Implementing Classes:
JavaProjectDependencies

public interface ProjectDependencies
extends TaskDependency

A ProjectDependencies object is a representation of the dependencies between projects in a ProjectRepository. It is used when using a TaskExecutor to run tasks such as build tasks that involve several interdependent projects. For an example of how a ProjectDependencies object is used, see the user's guide.

When iterating over a set of Project:s to be processed, the build script uses getDependencies(Project) for each project to get a collection of TaskDependency that represents the dependencies that have to be satisfied before that project can be processed. After creating tasks for processing the project, a dependency object representing those tasks are registered using registerDependency(Project, TaskDependency). That dependency object is used for the dependencies of the other projects that depend on results from this project when they are processed.

For example, in a ProjectRepository with JavaProject:s, some Java projects have compile dependencies on other Java projects. The Java project p's compile task will depend on the dependencies returned from calling getDependencies(p). The Java project will be completed when its compile task t has been run, so that is registered with registerDependency(p, t).

(The dependencies that are returned from getDependencies(Project) are not the same dependencies registered by registerDependency(Project, TaskDependency). They cannot be, since that would force clients to register projects in dependency order, forfeiting most of the point in using a ProjectDependencies object in the first place.)

The ProjectDependencies object is itself an TaskDependency that is satisfied when all its constituent dependencies are satisfied.

Since:
0.5
Author:
Karl Gustafsson

Method Summary
 Collection<? extends TaskDependency> getDependencies(Project p)
          Get dependency objects for the given project.
 void registerDependency(Project p, TaskDependency d)
          Register a dependency for a project.
 
Methods inherited from interface org.schmant.run.TaskDependency
getDependencyObservable, getSatisfiedStateLock, isSatisfied
 

Method Detail

getDependencies

Collection<? extends TaskDependency> getDependencies(Project p)
Get dependency objects for the given project. A project dependency object fires when all the project's registered dependencies have been satisfied.

Parameters:
p - The project
Returns:
Dependency objects for all the projects that the supplied project depends on. When all dependency objects have fired, the project's dependencies are satisfied. The objects returned are not objects that have been registered with registerDependency(Project, TaskDependency).

registerDependency

void registerDependency(Project p,
                        TaskDependency d)
Register a dependency for a project. When the registered dependency flags that it is satisfied, that project's dependency is satisfied. Use this to register the actual dependencies for a project.