Hi,
I'm looking at adding a public interface for DAG in org.gradle.api.**,
so that it can be documented (and grown). I have some questions about
which DAG methods we want to make public, and how build files should get
at it.
At this stage, the only methods on DAG which look public to me are:
boolean hasTask(path)
Set<Task> getAllTasks()
I'd like to add some events as well, so that one can listen for the
start and end of execution of a task. I would start with a
TaskExecutionListener interface, and possibly add Closure based
convenience methods later. For example:
interface TaskExecutionListener {
void beforeExecute(Task task)
void afterExecute(Task task)
}
And later, something like
taskGraph.beforeTask { task -> do something }
taskGraph.afterTask { task -> do something }
It might be interesting to add some DAG mutation methods at some point.
For example, I'd like to be able to request the execution of a task from
another task.
As far as access from build files goes, I think we are missing a good
place to hang this from. It would make sense to attach the DAG to the
object which represents the build execution as a whole, but we don't
really have such a concept. Settings plays this role for the
initialisation phase. Build is possibly the right place, but it lacks a
public api, and build files can't access it.
I think we should add an interface to the public api which wraps up the
whole build execution, called something like GradleInstance or Build. It
would be reachable from Project, using, for example,
Project.getGradleInstance()
This interface would have methods something like:
getTaskExecutionGraph()
getRootProject()
addBuildListener(BuildListener)
Some other things that could live here are gradle version, gradle home,
user home, and methods for executing a new build.
The DAG is currently passed as a method to TaskAction.execute() and is
also reachable from Task. Should we remove it from TaskAction.execute()?
If we do the above, should we remove it from Task as well? If not,
should we add it to Project and ProjectAction for consistency?
Adam
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email