[GRADLE-1668] TaskExecutionGraph and TaskGraphExecuter Created: 07/Jul/11  Updated: 01/Nov/13  Resolved: 01/Nov/13

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-3
Fix Version/s: None

Type: Bug
Reporter: Tim Berglund Assignee: Benjamin Muschko
Resolution: Fixed Votes: 1


 Description   

Pedantry: The org.gradle.api.invocation.Gradle class has the getGraph() method, which returns a TaskExecutionGraph. The run-time type returned by this method seems to be DefaultTaskGraphExecutor, which implements TaskGraphExecutor, which extends TaskExecutionGraph.

At the bottom of the pile, TaskExecutionGraph doesn't expose the useFilter() method, but its child interface TaskGraphExecutor does. As of this posting, training materials show useFilter being called on gradle.graph, and in 1.0-M3, the method is called in DefaultBuildExecutor.java:48. (This invocation is a little confusing to me, since the compile-time type of gradle.getBuild() is apparently TaskExecutionGraph, which doesn't expose useFilter().)

Without understanding the intended distinction between TaskExecutionGraph and TaskGraphExecutor, it seems like Gradle.getGraph() should return a TaskGraphExecutor, or the useFilter() method should be pulled up into TaskExecutionGraph.



 Comments   
Comment by Benjamin Muschko [ 01/Nov/13 ]

The method useFilter takes a parameter of type org.gradle.api.specs.Spec. I fixed the code example to the following:

def spec = new Spec<Task>() {
    boolean isSatisfiedBy(Task task) {
        task.name != 'jar'
    }
}

gradle.taskGraph.useFilter(spec)
Generated at Wed Jun 30 12:01:24 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.